A cross product helps determine whether two vectors are parallel. For two-dimensional segment vectors v = B − A and w = D − C, a nonzero result indicates that their supporting lines meet at one point; the intersection may still fall outside either segment. section 15.4.1
Use the vector operation to turn segment intersection into scalar checks:
- Construct v from A to B and w from C to D. section 15.4.1
Testing two edges
The vectorScalingFactor method builds the segment vectors, forms a perpendicular vector, and returns a scalar factor. Calling it in both directions supplies h and g for edgesIntersection.

