コード例 #1
0
        /// <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));
        }
コード例 #2
0
 /// <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);
コード例 #3
0
 public static Distance DistanceTo(this Point2D point, Line2D line) =>
 point.DistanceTo(line.GetPortSide().Boundary);