The inner product, or dot product, combines corresponding vector coordinates into a scalar. In planar geometry, it identifies perpendicular directions because a vector and its quarter-turn have dot product zero. section 15.4.1
For segment intersection, the inner product supports a vector-based calculation:
- Construct u = (-v.y, v.x), a perpendicular vector to v. section 15.4.1
- Use B + h·v = D + g·w to represent the same intersection point along both segments. section 15.4.1
- Take dot products with u to eliminate h and solve for g; repeat symmetrically to obtain h. section 15.4.1
- Accept an intersection when both scaling factors lie between zero and one, while handling shared-endpoint cases separately. section 15.4.1
Computing segment intersection
Given endpoints A, B, C, and D, calculate v = B − A, w = D − C, and u = (−v.y, v.x). The expression ((B − D)·u)/(w·u) yields one scaling factor; swapping the segments yields the other. section 15.4.1
Figure 15.19 A vector approach to check whether the point of intersection of the two lines falls within both segments
Use the vector diagram to connect the parameterized segment equation with the geometric location of the intersection point. section 15.4.1











