MAL.TransformPoint

Previous  Next

 

ref_point_out = MAL.TransformPoint( BYREF point_out      AS ARRAY,

                                    BYREF point_in       AS ARRAY,

                                    BYREF point_ref1     AS ARRAY,

                                    BYREF point_ref2     AS ARRAY,

                                    BYREF point_ref3     AS ARRAY,

                                   [BYVAL nAxis1         AS INTEGER=ML_AXIS_X],

                                   [BYVAL nAxis2         AS INTEGER=ML_AXIS_Y],

                                   [BYVAL nOptions       AS INTEGER=ML_MOVETO],

                                   [BYVAL nPoint         AS INTEGER=ML_ALL],

                                   [BYVAL nFrameOffset   AS INTEGER=0] ) AS REFERENCE

 

ref_point_out = MAL.TransformPoint( BYREF point_out      AS ARRAY,

                                    BYREF points_in      AS ARRAY,

                                    BYVAL point_ref1     AS INTEGER,

                                    BYVAL point_ref2     AS INTEGER,

                                    BYVAL point_ref3     AS INTEGER,

                                   [BYVAL nAxis1         AS INTEGER=ML_AXIS_X],

                                   [BYVAL nAxis2         AS INTEGER=ML_AXIS_Y],

                                   [BYVAL nOptions       AS INTEGER=ML_MOVETO],

                                   [BYVAL nPoint         AS INTEGER=ML_ALL],

                                   [BYVAL nFrameOffset   AS INTEGER=0] ) AS REFERENCE

 

ref_point_out = MAL.TransformPoint( BYREF point_out      AS ARRAY,

                                    BYREF point_in       AS ARRAY,

                                    BYREF arr_TM         AS ARRAY,

                                    BYREF point_origin   AS ARRAY,

                                   [BYVAL nOptions       AS INTEGER=ML_MOVETO],

                                   [BYVAL nPoint         AS INTEGER=ML_ALL],

                                   [BYVAL nFrameOffset   AS INTEGER=0] ) AS REFERENCE

 


 

Transforms a 3D point into or to a local coordinate system.  The main difference is how any translations are handled.  When transform to ML_MOVETO local system, then the translation is done before the transformation.  When using ML_MOVEINTO then the transformation is done before any translations.

 

' Transform Point

CONST ML_MOVETO         = 92   ' Transform point(s) to local coordinate system

CONST ML_MOVEINTO       = 94   ' Transform point(s) into local coordinate system

 

In the first 2 syntaxes, the local coordinate system is defined by 3 points and 2 axis.  The points are supplied by either 3 arrays (syntax 1), or 1 array and 3 point numbers (syntax 2).  In syntax 3, a 3x3 Transformation Matrix along with the point of Origin is supplied. 

 

The nPoint argument will determine what points in the input array to transform.  The transformed points will be stored in the output array using the same point number(s).

 

Example:

 

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Testing CreateTM and TransformPoint

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'

DIM TM( nFrames, 3, 3 ) AS REAL

DIM out( nFrames, nPoints, 3 ) AS REAL

 

' Use point 1, 2 and 3 to create transformation matrix

MAL.CreateTM( TM, Position, 1, 2, 3, ML_AXIS_X, ML_AXIS_Y )

CALL PrintArray( REF( TM ) )

 

' Transform points using TM and Point 1 as origin

MAL.TransformPoint( out, Position, TM, V3D( Position, 1 ), ML_MOVETO )

CALL PrintArray( REF( out ) )

 

' Transform points using Points 1 (origina), 2 and 3 to create transformation

MAL.TransformPoint( out, Position, 1, 2, 3, ML_AXIS_X, ML_AXIS_Y, ML_MOVETO )

CALL PrintArray( REF( out ) )

 

' Should be the same as above...

MAL.TransformPoint( out, Position, V3D( Position, 1 ),_

                                  V3D( Position, 2 ),_

                                  V3D( Position, 3 ),_

                                  ML_AXIS_X,_

                                  ML_AXIS_Y,_

                                  ML_MOVETO )

CALL PrintArray( REF( out ) )