/*
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 |