/// <summary> /// Calculate the intersection point between the segment and line. /// </summary> /// <param name="sEq">The segment equation.</param> /// <param name="lEq">The line equation.</param> /// <returns>Returns the intersection point.</returns> public static Point GetIntersection(SegmentEquation sEq, LinearEquation lEq) { var pt = LinearEquation.GetIntersection(sEq, lEq); if (sEq.IsPointInRange(pt)) { return(pt); } return(null); }
/// <summary> /// Calculate the intersection point between the 2 segments. /// </summary> /// <param name="eq1">The first segment equation.</param> /// <param name="eq2">The second segment equation.</param> /// <returns>Returns the intersection point.</returns> public static Point GetIntersection(SegmentEquation eq1, SegmentEquation eq2) { var pt = LinearEquation.GetIntersection(eq1, eq2); if (eq1.IsPointInRange(pt) && eq2.IsPointInRange(pt)) { return(pt); } return(null); }