MAL.ScalarProduct

Previous  Next

 

ref_arr_out = MAL.ScalarProduct( BYREF arr_out      AS ARRAY,

                                 BYREF arr_in1      AS ARRAY,

                                 BYREF arr_in2      AS ARRAY,

                                [BYVAL nPoint       AS INTEGER=ML_ALL],

                                [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE

 

ref_arr_out = MAL.ScalarProduct( BYREF arr_out      AS ARRAY,

                                 BYREF arr_in       AS ARRAY,

                                 BYREF nPoint1      AS INTEGER,

                                 BYVAL nPoint2      AS INTEGER,

                                [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE

 


 

Calculates the scalar product (aka Dot Product) of the 2 input vectors.  The input vectors must be 2D or 3D.  The output is always a 1D vector.  Using the second syntax, the nPoint1 must be specified as an integer.  You can use the function INT( n ) to force a number to be of type INTEGER.  Note that the point ranges are not allowed using this syntax.

 

Example:

 

DIM arrP1(nFrames,nPoints,3) AS REAL

DIM arrP2(nFrames,nPoints,3) AS REAL

DIM arrCross(nFrames,3) AS REAL

DIM arrScalar(nFrames,1) AS REAL

 

arrP1(*,1,1) = 1

arrP1(*,1,2) = 1

arrP1(*,1,3) = 1

 

arrP1(*,2,1) = 1

arrP1(*,2,2) = 0

arrP1(*,2,3) = 0

 

arrP1(*,3,1) = 0

arrP1(*,3,2) = 1

arrP1(*,3,3) = 0

 

MAL.ScalarProduct( arrScalar, arrPoints, arrP1, 1 )

CALL PrintArray( REF( arrScalar ) )

 

MAL.CrossProduct( arrCross, arrP1, 2, 3 )

CALL PrintArray( REF( arrCross ) )