Point Range, PTS

Previous  Next

 

range = PTS( from AS INTEGER,

             to   AS INTEGER ) AS INTEGER

 


 

Returns the a range of point numbers.  The range is specified as a from/to pair.  This can be used by any MAL function that can use a point number as argument.  Point numbers always starts with 1 being the first point.

 

Technical Description

 

The function creates a 32bit integer where the lower 16 bits defines the from (max 65535) and the upper 16 bits defines the to (also max 65535).

 

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

 

CONST cFileName = "e:\walk8.c3d"

 

CLS

 

' Open the Test File

hFile = C3DFile.Open( cFileName )

 

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 arrPoints(nFrames,nPoints,3) AS REAL

 

IF C3DFile.GetPoints( hFile, arrPoints ) <> nFrames THEN

  C3DFile.Close( hFile )

  PRINT "Error Reading ";nPoints;" from file ";cFileName,

  STOP

ENDIF

 

DIM arrVLen(nFrames,nPoints,1) AS REAL

 

' Calculate Vector Length or Point 2 and 3

MAL.VectorLength( arrVLen, arrPoints, PTS( 2, 3 ) )

CALL PrintArray( REF( arrVLen ) )

 

' Close File

C3DFile.Close( hFile )

 

END