liveBook · Manning

Vector-to-vector product

As explained in Advanced Algorithms and Data Structures

The cross product is a vector operation in three-dimensional space whose result is perpendicular to its two operand vectors and whose magnitude depends on their sine-separated area.

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:

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.

How Advanced Algorithms and Data Structures covers it

How deep it goes
Develops the perpendicular-vector derivation and implementation of scaling factors, but does not extend beyond this planar intersection use.
Examples
Uses segment endpoints A, B, C, and D, the equation B + h·v = D + g·w, and vectorScalingFactor and edgesIntersection.
What it assumes
Assumes coordinate points, vectors, scalar multiplication, and dot products while constructing the perpendicular-vector method explicitly.
What you can do after
Apply the operation to implement planar segment-intersection checks using perpendicular vectors and bounded scaling factors.
How it connects
Connects cross products with vectors, dot products, perpendicular vectors, line intersection, and line segment intersection.

Also explained in

Compare how 2 books explain vector-to-vector product →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.