MAL.Shortest

Previous  Next

 

ref_arr_out = MAL.Distance( BYREF arr_out      AS ARRAY,

                            BYREF point_A      AS ARRAY,

                            BYREF point_B      AS ARRAY,

                            BYREF point_C      AS ARRAY,

                           [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE

 

ref_arr_out = MAL.Distance( BYREF arr_out      AS ARRAY,

                            BYREF arr_in       AS ARRAY,

                            BYVAL point_A      AS INTEGER,

                            BYVAL point_B      AS INTEGER,

                            BYVAL point_C      AS INTEGER,

                           [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE

 


 

Calculate shortest distance between line AB and point C.  The distance is returned in the same units as the input coordinates.

 

Example:

 

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

' Testing Shortest

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

'

DIM Result( nFrames ) AS REAL

 

' Using Point Numbers

MAL.Shortest( Result, Position, 1, 2, 4 )

CALL PrintArray( REF( Result ) )

 

' Copy Points to separate arrays

DIM pA( nFrames, 1, 3 ) AS REAL

DIM pB( nFrames, 1, 3 ) AS REAL

DIM pC( nFrames, 1, 3 ) AS REAL

 

pA( *, 1 ) = Position( *, 1 )

pB( *, 1 ) = Position( *, 2 )

pC( *, 1 ) = Position( *, 4 )

 

MAL.Shortest( Result, pA, pB, pC )

CALL PrintArray( REF( Result ) )

 

' This should be the same

CALL PrintArray( MAL.Shortest( NULL, pA, pB, pC ) )