To check whether two 2D lines are coincident, the distance of and
to
need to be calculated. For a coincident line both need to be (almost) zero.
The z component of the cross vector can be used for this quite elegantly.
Note: The cross vector is noted as an x e.g. x
To check whether the two lines and
are coincident, the z-component of two cross vectors need to be calculated. Both calculate the distance of the points on line
to
.
x
is the area of the parallelogram
, dividing it with the length of
(
) gives the shortest distance of point
to line
.
x
gives the area of the parallelogram
After dividing with this is also the shortest distance of
to line
. If both distances are small enough the lines are coincident.