Notes for programmers - Integer 3D Data

1.  Each 3D coordinate is stored as three 16-bit signed integers + the camera mask and residual.  Each of the integer values is generated by dividing the physical world coordinate by the POINT:SCALE parameter which is calculated as the maximum coordinate value in POINT:UNITS divided by 32000.  Note that adding any additional data to the stored 3D data will require that the POINT:SCALE factor is recalculated and all existing data points stored as signed integers are rescaled if any new data values exceed the existing maximum coordinate value.

2.  If a point is invalid then the fourth word (camera mask and residual) will be negative and the X, Y and Z coordinate values will be ignored because the residual of -1 indicates that the point is invalid.

3.  If word 4 (read as a signed 16-bit integer) is positive then the point is considered a valid point and should be interpreted as described below.

4.  Byte 1 of word 4 has seven bits that are set to “1” corresponding to the cameras that contributed to the measurement of the point, Bit 1 represents the first camera, bit 2 the second, etc.  By convention, all camera bits will be set to 0 if the point value has been interpolated, filtered or otherwise modified in any way.  Note that the camera bits are in the high byte of word 4 of the integer record – the most significant bit of this word is the residual sign bit.  Therefore, there are only seven bits available for the cameras.  Any point with a negative residual is interpreted as invalid - setting the 8th bit produces a negative signed integer and so the camera mask only supports seven cameras.

5.  Byte 2 of word 4 represents the average of the residuals for the measurement of the raw data point multiplied by the POINT:SCALE parameter scaling factor.  If byte 2 is zero then the 3D point is recorded as having been filtered, interpolated, or otherwise modified and is not a measured point.

6.  Within each 3D sample, the points are stored in the order that they are listed in the parameter section followed by the analog data samples if any analog data is present.

7.  When a C3D file contains signed integer 3D data then any corresponding analog data values must also be stored in signed integer format.