The P3DC point types are p3dc_PNT2, p3dc_PNT3, and p3dc_PNT4. They represent 1x2, 1x3 and 1x4 element matrices respectively. There are several functions defined that operate on these data structures however they are primarily implemented as #define statements in the p3dc.h include file.
The following functions are described in this document:
The defined functions are as follows.
p3dc_FLOAT scaleXX(var, scalar)
Where the value XX is one of P2, P3, or P4. This function multiplies a two, three, or four component vector respectively by a scalar value.
void interceptXX(first_endpoint, second_endpoint, dT, result_endpoint)
Again where the value of XX is one of P2, P3, or P4. This function computes the value of a point along a line segment using the value dT to determine the result endpoint. These functions are used in the clipping code when clipping polygons.
p3dc_FLOAT p3dc_dot_pnt3(vector_a, vector_b)
This function computes the dot product (scalar product) of two three element vectors. It is returned as a floating point value. Note that the statement
scaleP3(vec, 1/p3dc_dot_pnt3(vec, vec))
normalizes the vector to unit length.
void p3dc_diff_pnt3(vector_a, vector_b, result_vector)
This function computes the vector difference R = B - A. Effectively this stores in result a vector, then when added to A will give you B.
void p3dc_cross_pnt3(vector_a, vector_b, result_vector)
This function finds the cross product (vector product) of the vectors A and B. Mathematically this is written as R = A X B. This function is great for finding a plane normal if you have three points.