Vector Index Array VIX

Previous  Next


vixa = VIX()




vixa = VIX( ix2 AS INTEGER,

            ix1 AS INTEGER ) AS INTEGER


vixa = VIX( ix3 AS INTEGER,

            ix2 AS INTEGER,

            ix1 AS INTEGER ) AS INTEGER



Creates a Vector Index Array (VIXA).  This is a compressed index into a multidimensional vector array.  MyBASIC2 Supports up to 4 dimensions where the Motion Analysis Library uses 3 of the dimensions.  The first used array dimension is used as the trajectory.  This is usually the frame number.  The second is usually the point or analog number and the last one is usually the data dimension.  For example:


DIM vad_array( 60, 8 )    AS REAL   ' 60 Frames, 8 channels

DIM vad_array( 60, 8, 1 ) AS REAL   ' Same as above

DIM v2d_array( 60, 4, 2 ) AS REAL   ' 60 Frames, 4 points, X/Y data

DIM v3d_array( 60, 4, 3 ) AS REAL   ' 60 Frames, 4 points, X/Y/Z data


The dimension parameters of the VIX function follows the MyBASIC2 array subscript format.  For example, to index X data of point 4 in the example above, use VIX( 4, 1 )assuming option base 1.  If you omit all the indexes, then VIX will create a "wild" VIXA where all ths fields are set to -1.  (0xFFFFFFFF)


The VIX function creates an INTEGER with the vector dimensions compressed into one 32-bit INTEGER.  The format is as follows


DIM name( n/a, ix3, ix2, ix1 ) AS TYPE




ix3 - Frames

ix2 - Points or Channels.  Default 1

ix1 - Data Dimension (1D, 2D or 3D).  Default 1D


This is encoded as


Bit 20-31: ix3 - 12 Bits, Max 4095

Bit 8-19:  ix2 - 12 Bits, Max 4095

Bit 0-7:   ix1 -  8 Bits, Max 255


Note 1;A VIX with all bits set is used to specify that all dimensions should be used.  You can use VIX( ML_ALL ) or VIX() to specify all elements.
Note 2;The latest version of MyBASIC2 supports '*' as "Wild" index when indexing an array.  The VIX function now recognizes this as and is the same ML_ALL.
Note 3;The indexes are all based on the current OPTION BASE setting






' Note;  Array will have X/Y/Z Data + Resid and Camera Mask

DIM fourP( nFrames, 4, 5 )


' Read Point 1 into first point index

C3D.GET_3D_POINT_ARR( hFid, 1, REF( fourP ), C3D_ITEM_ALL, 1 )


' Plot the X/Z data for Point 1

GRAPH.AddElement( hGraph, "Point 1", fourP, VIX( 1, 1 ), fourP, VIX( 1, 3 ) )