MAL.OffsetPoint |
![]() ![]() |
ref_point_out = MAL.OffsetPoint( BYREF point_out AS ARRAY, BYREF point1 AS ARRAY, BYREF point2 AS ARRAY, BYVAL rOffset AS REAL, [BYVAL bPercent AS INTEGER=FALSE], [BYVAL nPoint AS INTEGER=1], [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE
ref_point_out = MAL.OffsetPoint( BYREF point_out AS ARRAY, BYREF points_in AS ARRAY, BYVAL point1 AS INTEGER, BYVAL point2 AS INTEGER, BYVAL rOffset AS REAL, [BYVAL bPercent AS INTEGER=FALSE], [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE
This function does a linear transformation to create a third point by using 2 points as reference and a distance specified as absolute distance in system units or as percent of the distance between point 1 and 2 if the bPercent parameter is set to TRUE. The first syntax uses 2 arrays to specify the reference points while the second syntax uses one array with 2 points.
Example:
OPTION EXPLICIT ON OPTION REDIM ON OPTION BASE 1
' Include C3D Support $INCLUDE "MyBASIC2_C3DFile" $LIBRARY "MyBASIC2_C3DFileLib"
' Include the MaxMAL Library $INCLUDE "MyBASIC2_MaxMAL" $LIBRARY "MyBASIC2_MaxMALLib"
' Forward Declare PrintArray and DisplayVersion DECLARE SUB PrintArray
' Declare variables and arrays DIM nPoints AS INTEGER DIM nFrames AS INTEGER DIM hFile AS INTEGER
' Display the current Library Version CALL DisplayVersion( TRUE )
' Open the Test File hFile = C3DFile.Open( "e:\Wander9.c3d" )
IF NOT hFile > 0 THEN PRINT "Error Opening File ";cFileName, STOP ENDIF
' Get the no of points and frames nFrames = C3DFile.GetNoOfFrames( hFile ) nPoints = C3DFile.GetNoOfPoints( hFile )
' Dimension the arrays DIM Position(nFrames,nPoints,3) AS REAL
' Get the Point Coordinates from C3D file IF C3DFile.GetPoints( hFile, Position ) <> nFrames THEN C3DFile.Close( hFile ) PRINT "Error Reading ";nPoints;" from file ";cFileName, STOP ENDIF
' Set the Frame Rate to use in the MaxMAL Library MAL.FrameRate( C3DFile.GetFrameRate( hFile ) )
' Display the Position Coordinates CALL PrintArray( REF( Position ) )
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Testing OffsetPoint ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' DIM Projected( nFrames, 1, 3 ) AS REAL
' Syntax 1 MAL.OffsetPoint( Projected,_ V3D( Position, 1 ),_ V3D( Position, 2 ),_ 2.0,_ TRUE,_ ML_ALL ) CALL PrintArray( REF( Projected ) )
' Syntax 2 MAL.OffsetPoint( Projected, Position, 1, 2, 2.0, TRUE ) CALL PrintArray( REF( Projected ) ) CALL PrintArray( MAL.OffsetPoint( NULL, Position, 1, 2, 2.0, TRUE ) )
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Close File ' C3DFile.Close( hFile )
END
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Print an array with up to 3 dimensions. Array is passed as a reference ' SUB PrintArray( arr AS REFERENCE ) RUN( "ArrayPlot", arr, TRUE ) END SUB |