x = XSIMath.CreateVector3();
y = XSIMath.CreateVector3();
// Example 1: Perpendicular vectors have 0 dot product
x.Set( 1,0,0 ) ;
y.Set( 0,1,0 ) ;
// Output is 0
Application.LogMessage( x.Dot( y ) ) ;
// Example 2: Commutative nature of dot product
x.Set( 2,0,0 ) ;
y.Set( 1,1,0 ) ;
// Output is 2 for both
Application.LogMessage( x.Dot( y ) ) ;
Application.LogMessage( y.Dot( x ) ) ;
// Example 3: When angle is zero the value
// is equal to the lengths multipled
x.Set( 2,0,0 ) ;
y.Set( 3,0,0 ) ;
//Output is 6 for both
Application.LogMessage( x.Dot( y ) ) ;
Application.LogMessage( x.length() * y.length() ) ;
|