MAL.ConvertUnits |
rOutValue = MAL.ConvertUnits( BYVAL rInValue AS REAL, BYVAL strFrom AS STRING, BYVAL strTo AS STRING ) AS REAL
ref_arr_out = MAL.ConvertUnits( BYREF arr_out AS ARRAY, BYREF arr_in AS ARRAY, BYVAL strFrom AS STRING, BYVAL strTo AS STRING, [BYVAL nPoint AS INTEGER=ML_ALL], [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE
Converts units from one value to another. The function can convert an entire array or a single scalar value. The units are represented as strings and can be preceeded by a multiplier of the International System of Units.
See here for a list of units and multipliers.
Example:
OPTION EXPLICIT 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 DECLARE SUB PrintArray
' Declare variables and arrays DIM nPoints AS INTEGER DIM nFrames AS INTEGER DIM hFile AS INTEGER DIM fid AS HANDLE
' Open the Test File hFile = C3DFile.Open( "e:\walk8.c3d" )
' Get the no of points and frames nFrames = C3DFile.GetNoOfFrames( hFile ) nPoints = C3DFile.GetNoOfPoints( hFile )
' Dimension the arrays DIM arrPoints(nFrames,nPoints,3) AS REAL
' Read the Points C3DFile.GetPoints( hFile, arrPoints )
' Convert to Inches MAL.ConvertUnits( arrPoints, arrPoints, C3DFile.GetUnits( hFile ), "in" ) . . . ' Close File C3DFile.Close( hFile )
END
|