SIQuaternion.EpsilonEquals

Description

Tests the equality between this quaternion and the quaternion q with a tolerance of epsilon.

C# Syntax

Int32 SIQuaternion.EpsilonEquals( SIQuaternion in_pQuat, Double in_dEpsilon );

Scripting Syntax

oBoolean = SIQuaternion.EpsilonEquals( epsilon );

Return Value

Boolean True if this quaternion equals the quaternion q; otherwise False.

Parameters

Parameter Type Description
epsilon SIQuaternion tolerance

Possible Values:

Description:

[0, +INF[ Validity domain

Examples

JScript Example

/*

	This example demonstrates how to test whether the values of two

	quaternions are within 0.002 of each other using the EpsilonEquals method

*/

var q1 = XSIMath.CreateQuaternion(1.0, 1.0, 2.0, 3.0);

var q2 = XSIMath.CreateQuaternion(1.0, 1.001, 2.0, 3.0);

var q3 = XSIMath.CreateQuaternion(1.0, 1.003, 2.0, 3.0);

// Equal by less than 0.002

ValidateEpsilonEquals(q1, q2);

// Not equal by less than 0.002

ValidateEpsilonEquals(q1, q3);

function ValidateEpsilonEquals (in_q1 , in_q2)

{

	if ( in_q1.EpsilonEquals(in_q2, 0.002) ) {

		Application.LogMessage ("in_q1 is equal to in_q2 by less than 0.002");

	} else {

		Application.LogMessage ("in_q1 is not equal to in_q2 by less than 0.002");

	}

}

// Expected results:

// INFO : in_q1 is equal to in_q2 by less than 0.002

// INFO : in_q1 is not equal to in_q2 by less than 0.002

See Also

SIQuaternion.Equals SIVector3 SIMatrix3 SIMatrix4 SIRotation SITransformation SIQuaternion