/// <returns> /// the intersection of the two lines if it is a point, or <c>null</c> otherwise /// </returns> public static Point2D?PointIntersection(this Line2D line1, Line2D line2) => line1.GetPortSide().Boundary.PointIntersectionWithLine(line2);
public static IEnumerable <Point2D> IntersectWithLine(this Circle2D circle, Line2D line) => circle.IntersectWithLine(line.AsBoundaryLine());
/// <returns> /// the point intersection of the two lines, even if the lines are nearly parallel /// </returns> public static Point2D PointIntersectionWithLineUnstable(this Line2D line1, BoundaryLine2D line2) => line1.AsBoundaryLine().PointIntersectionWithLineUnstable(line2);
public static Either <Null, Point2D, Segment2D> IntersectWithLine(this Segment2D segment, Line2D line) => segment.IntersectWithLine(line.AsBoundaryLine());
public static bool IntersectsSegment(this Line2D line, Segment2D segment) => !segment.IntersectWithLine(line).Is <Null>();
public static Either <Null, Point2D, Segment2D> IntersectLineWithSegment(this Line2D line, Segment2D segment) => segment.IntersectWithLine(line);
public static Distance DistanceTo(this Point2D point, Line2D line) => point.DistanceTo(line.GetPortSide().Boundary);
public static Point2D ProjectOnto(this Point2D point, Line2D line) => line.PointAt(point.ProjectedSignedDistanceAlong(line));
public static Distance ProjectedSignedDistanceAlong(this Point2D point, Line2D line) => (point - line.BasePoint).GetComponentInDirection(line.Direction);
public static Line To3D(this Line2D line) => new Line(line.BasePoint.ToPoint3D(), line.Direction.To3D());