find_intersection

Function find_intersection 

Source
pub fn find_intersection(
    p1: &PointF64,
    p2: &PointF64,
    p3: &PointF64,
    p4: &PointF64,
) -> Option<(PointF64, Intersection)>
Expand description

Given lines (p1, p2) and (p3, p4), returns their intersection. If the two lines coincide, returns the mid-point of (p1, p2). If the two lines are parallel, return None.

Adapted from https://github.com/tyt2y3/vaserenderer/blob/master/csharp/Assets/Vaser/Vec2Ext.cs#L107

Which in turn originates from http://paulbourke.net/geometry/lineline2d/