Check whether two 2d direction vectors are parallel

The cross product of two parallel direction vectors has zero length. The magnitude (length) of the cross product is the area enclosed by the vectors. Two parallel direction vectors obviously do not have a surface since they can be considered the same origin.

In 2D the z axis is the normal to the x and y axis. The z-axis is calculated by using the cross vector of both vectors.


The cross vector Z-component can be calculated using:
z = A_x B_y - A_y B_x

if z is very small, the vectors are parallel.

Lastest update in December 2019, inital post in September 2011

Write a comment

I appreciate comments, suggestions, compliments etc. Unfortunately I have no time to reply to them. Useful input will be used for sure!