Brief Index      Full Index      Events Index      I.M. Reference

Compute_Cross_Product

Functions

void Compute_Cross_Product (const HC_POINT *vector1, const HC_POINT *vector2, HC_POINT *out_vector)
void DCompute_Cross_Product (const HC_DVECTOR *vector1, const HC_DVECTOR *vector2, HC_DVECTOR *out_vector)

Function Documentation

void Compute_Cross_Product ( const HC_POINT *  vector1,
const HC_POINT *  vector2,
HC_POINT *  out_vector 
)
Parameters:
vector1- input 3D vectors.
vector2- input 3D vectors.
out_vector- output 3D vector returned to the caller. Can point to the same place as vector1 or vector2

DETAILS

Compute_Cross_Product() takes two 3-D vectors and computes their vector cross-product.

NOTES

For a bit of linear algebra review, the way to compute a cross product is to calculate the determinant of the following matrix:


        | i   j   k  |
        | x1  y1  z1 |
        | x2  y2  z2 |

Where i,j and k are the unit vectors along the X, Y and Z axes, respectively. That works out to be equal to

        i*(y1*z2 - z1*y2) - j*(x1*z2 - z1*x2) + k*(x1*y2 - y1*x2)

The result is always perpendicular to both inputs, and of length equal to the length(vector1) * length(vector2) * sin(angle between vector1 and vector2). The order of the inputs matters. Switching the inputs will reverse the result.

RESTRICTIONS

See also:
Compute_Coordinates, Compute_Dot_Product
void DCompute_Cross_Product ( const HC_DVECTOR *  vector1,
const HC_DVECTOR *  vector2,
HC_DVECTOR *  out_vector 
)

Similar to Compute_Cross_Product, but operates on double-precision data.

Parameters:
vector1- input 3D vectors.
vector2- input 3D vectors.
out_vector- output 3D vector returned to the caller. Can point to the same place as vector1 or vector2

Brief Index      Full Index      Events Index      I.M. Reference