/// <returns>
        /// the intersection of the two lines if it is a point, or <c>null</c> otherwise
        /// </returns>
        public static Point2D?PointIntersectionWithLine(this BoundaryLine2D line1, Line2D line2)
        {
            var dotProduct = line1.HalfPlane.DirectionTowardInterior.DotProduct(line2.Direction);

            if (Math.Abs(dotProduct) <= Unit.ZeroDotProductTolerance)
            {
                // The lines are approximately parallel.
                return(null);
            }
            return(line1.PointIntersectionWithLineUnstable(line2.GetPortSide().Boundary));
        }
 /// <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);
Esempio n. 3
0
 public static Distance DistanceTo(this Point2D point, Line2D line) =>
 point.DistanceTo(line.GetPortSide().Boundary);