On Tue, 9 Jan 2007, guillaume laforge wrote:
Hi Bernard,
Maybe take a look to the matrix way. You can loop into the matrix to compare
the values. It is a little bit shorter and maybe faster ?
function CompareMatrix( oObjA, oObjB )
{
var oTransA = oObjA.Kinematics.Global.Transform;
var oMatrixA = XSIMath.CreateMatrix4();
oTransA.GetMatrix4( oMatrixA );
var oTransB = oObjB.Kinematics.Global.Transform;
var oMatrixB = XSIMath.CreateMatrix4();
oTransB.GetMatrix4( oMatrixB );
for ( var row = 0 ; row < 4 ; row++ )
{
for( var col = 0 ; col < 4 ; col++ )
{
if( Math.round( oMatrixA.Value( row, col ) ) != Math.round(
oMatrixB.Value( row, col )) )
return false ;
}
}
return true ;
}
If you are after speed perhaps the usual way of comparing floats instead
of the calls to the round function:
if( fabs(valA - valB) < 0.0001 )
{
//equal - Do something
}
(Using what the equivalent of a float absolute value is in your language
of choice.)
--
Joe Laffey | Visual Effects for Film and Video
LAFFEY Computer Imaging | -------------------------------------
St. Louis, MO | Show Reel http://LAFFEY.tv/?e04089
USA | -------------------------------------
. | -*- Digital Fusion Plugins -*-
--------------------------------------------------------------------------
Mail here will be rejected --> "Real Trap" <r_trap(at)laffeycomputer.com>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi