C3D.get_3d_point_arr

Previous  Next

 

nFrames = C3D.get_3d_point_arr( BYVAL Fid          AS HANDLE,

                                BYREF array        AS ARRAY,

                                BYVAL nPoint       AS INTEGER,

                               [BYVAL nItems       AS INTEGER=C3D_ITEM_ALL],

                               [BYVAL nFrameOffset AS INTEGER=0],

                               [BYVAL ixPoint      AS INTEGER=0] ) AS INTEGER

 


 

Get point Coordinates, Residuals and Camera Mask in an array of REAL.  The length of the array should be set to number of frames.  The number of items in the last dimension of the array depends on the nItems parameter.  The array can be passed as an array or as REFERENCE.  The items returned depends on the nItems bitmask.   The order or indexes of the items is as follows

 

Index 0:  Pos X

Index 1:  Pos Y

Index 2:  Pos Z

Index 3:  Residual

Index 4:  Camera Mask

 

If you decide to return 2D coordinates with the residuals, the dimension of the array should be REAL( NoOfFrames, 3 ) and the order/indexes are X = 0, Y = 1, Resid = 2.

 

The optional Frame Offset will start the reading of data at the frame 1 + nFrameOffset and then read as many frames as the array can hold or to the end of the point whichever comes first.  The output from the function is the number of frames that was read into the array.

 

The ixPoint optional parameter is used if the output array is a multi-point array declared as REAL( NoOfFrames, NoOfPoints, NoOfItems ).  

 

Please Note; ixPoint uses OPTION BASE since it's an index into an array while point numbers always starts at 1.

 

Invalid 3D values will have the Residual set to -1 (C3D_INVALID_RESID) and then 3D data is set to 3.402823466e38 (C3D_INVALID_VALUE)

 

Defined Constants

 

CONST C3D_ITEM_X        = 0x00000001   ' Return Pos X as REAL

CONST C3D_ITEM_Y        = 0x00000002   ' Return Pos Y as REAL

CONST C3D_ITEM_Z        = 0x00000004   ' Return Pos Z as REAL

CONST C3D_ITEM_RESID    = 0x00000008   ' Residuals as REAL

CONST C3D_ITEM_MASK     = 0x00000010   ' Camera Mask as an INTEGER coded as REAL

CONST C3D_ITEM_ALL      = 0x0000001F   ' Return all item in a REAL( NoOfFrames, 5 ) array

CONST C3D_ITEM_3D       = 0x00000007   ' Return 3D Point in a REAL( NoOfFrames, 3 ) array

CONST C3D_ITEM_2D       = 0x00000003   ' Return 2D Point in a REAL( NoOfFrames, 2 ) array

 

Example:

 

' Example 1 with an aray that holds data from one Point at a time

 

DIM point( nFrames, 5 )

 

IF C3D.GET_3D_POINT_ARR( hFid, 1, REF( point ) ) = C3D_SUCCESS THEN

  FOR i = nFirstFrame TO nFirstFrame+nFrames-1

     s = FORMAT( "Frame %3d: %10.3f, %10.3f, %10.3f, %10.4f, 0x%08x", i, point( i-1, 0 ),_

                                                                         point( i-1, 1 ),_

                                                                         point( i-1, 2 ),_

                                                                         point( i-1, 3 ),_

                                                                    INT( point( i-1, 4 ) ) )

     PRINT s,

  NEXT i

ENDIF

 

' Second Example uses an array that holds data from 4 Points and reads Point #1

' and stores it in index 0 using OPTION BASE 0

 

DIM fourP( nFrames, 4, 5 )

 

IF C3D.GET_3D_POINT_ARR( hFid, 1, REF( fourP ), C3D_ITEM_ALL, 0 ) = C3D_SUCCESS THEN

  FOR i = nFirstFrame TO nFirstFrame+nFrames-1

     s = FORMAT( "Frame %3d: %10.3f, %10.3f, %10.3f, %10.4f, 0x%08x", i, fourP( i-1, 0, 0 ),_

                                                                         fourP( i-1, 0, 1 ),_

                                                                         fourP( i-1, 0, 2 ),_

                                                                         fourP( i-1, 0, 3 ),_

                                                                    INT( fourP( i-1, 0, 4 ) ) )

     PRINT s,

  NEXT i

ENDIF