Tag Archives: cross vector

The cross product

Formula:

Nx = ( dz1 * dy2 ) – (dy1 * dz2 );
Ny = ( dx1 * dz2 ) – (dz1 * dx2 );
Nz = ( dy1 * dx2 ) – (dx1 * dy2 );

dx1 is the delta between the two x coordinates (last – first) of vector V1.
dx2 is the delta between the two x coordinates (last – first) of vector V2.
dy1 is the delta between the two y coordinates (last – first) of vector V1.
dy2 is the delta between the two y coordinates (last – first) of vector V2.
dz1 is the delta between the two z coordinates (last – first) of vector V1.
dz2 is the delta between the two z coordinates (last – first) of vector V2.

The cross product calculated between two vectors results in a vector perpendicular to both vectors. The length of this vector is the surface of the parallelogram.

If the angle between the two vectors is 0 or 180 degrees the lengths is zero.  This can be used for vector overlap checks.

In 2D only the Nz value is used, it can be used for overlaps or parallel vectors etc.

Uses:

Are two 2D vectors parallel

Are two 2D vectors  coincident

Get the intersection point of two 2D vectors

Lastest update in May 2011, inital post in May 2011