Array Slicers V1D, V2D, V3D |
ref_arr_out = V1D( BYREF arr_out AS ARRAY, BYREF arr_in AS ARRAY, BYVAL vixa_in AS INTEGER, [BYVAL nFrames AS INTEGER=ML_ALL] ) AS REFERENCE
ref_arr_out = V2D( BYREF arr_out AS ARRAY, BYREF arr_in AS ARRAY, BYVAL nPoint AS INTEGER, [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE
ref_arr_out = V3D( BYREF arr_out AS ARRAY, BYREF arr_in AS ARRAY, BYVAL nPoint AS INTEGER, [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE
These don't have an output array and will dynamically create the array
ref_arr_out = V1D( BYREF arr_in AS ARRAY, BYVAL vixa_in AS INTEGER, [BYVAL nFrames AS INTEGER=ML_ALL] ) AS REFERENCE
ref_arr_out = V2D( BYREF arr_in AS ARRAY, BYVAL nPoint AS INTEGER, [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE
ref_arr_out = V3D( BYREF arr_in AS ARRAY, BYVAL nPoint AS INTEGER, [BYVAL nFrameOffset AS INTEGER=0] ) AS REFERENCE
Extracts 1D, 2D and 3D vectors out of multi dimensional arrays. These vectors can be used in many of the MAL functions. The output arrays should be declared as follows. These are the formats used when creating dynamic arrays using the second syntax above.
DIM V1D( NoOfFrames ) AS TYPE DIM V2D( NoOfFrames, 2 ) AS TYPE DIM V3D( NoOfFrames, 3 ) AS TYPE
or alternatively
DIM V1D( NoOfFrames, 1 ) AS TYPE DIM V1D( NoOfFrames, 1, 1 ) AS TYPE DIM V2D( NoOfFrames, 1, 2 ) AS TYPE DIM V3D( NoOfFrames, 1, 3 ) AS TYPE
Input arrays are organized as follows
DIM ARRAY( NoOfFrames, PointNo, Dimension ) AS TYPE
Dimensions can be any of the following
1 1D Vector 2 2D Vector with X/Y data 3 3D Vector with X/Y/Z data 5 3D Vector + Residual and Camera Masks
Note 1; Points always starts with first being Point 1 and Frame Offsets are always 0 based. The VIX function uses current OPTION BASE. Note 2; Dynamic arrays will be created using the dimensions in the first table. If you need dynamic arrays with the alternate dimensions, use the NEW function.
Example:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Simple 3D Example ' OPTION BASE 1
DIM pos( nFrames, nPoints, 3 ) AS REAL DIM point( nFrames, 3 ) AS REAL DIM posref AS REFERENCE DIM i AS INTEGER
IF C3DFile.GetPoints( nFile, pos ) = nFrames THEN FOR i = 1 TO nPoints posref = V3D( pos, point, i ) NEXT i ENDIF
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Example with 60 Frames, 4 Points ' OPTION BASE 1
DIM pos3d_file( 60, 4, 3 ) AS REAL ' 3D Data DIM posc3d_file( 60, 4, 5 ) AS REAL ' 3D Data with Residual and Camera Mask DIM pos2d_file( 60, 4, 2 ) AS REAL ' 2D Data
DIM pos3d( 60, 3 ) AS REAL ' 3D Vector DIM pos2d( 60, 2 ) AS REAL ' 2D Vector DIM pos_x( 60 ) AS REAL ' 1D Vector, X Data DIM pos_y( 60 ) AS REAL ' 1D Vector, Y Data DIM pos_z( 60 ) AS REAL ' 1D Vector, Z Data DIM res( 60 ) AS REAL ' Residuals DIM ref AS REFERENCE ' Reference to Output
CONST x = 1 CONST y = 2 CONST z = 3 CONST r = 4 CONST m = 5
' Get Points, X/Y/X and Residuals.
FOR i = 1 TO 4 ref = V1D( pos_x, pos3D_file, VIX( i, x ) ) ref = V1D( pos_y, pos3D_file, VIX( i, y ) ) ref = V1D( pos_z, pos3D_file, VIX( i, z ) ) ref = V1D( res, pos3D_file, VIX( i, r ) )
ref = V2D( pos2d, pos2D_file, i )
ref = V3D( pos3d, pos3D_file, i ) NEXT i
|