コード例 #1
0
 /// <summary>
 /// Whether two lines intersect.
 /// </summary>
 public static bool IntersectsWith(this PdfLine line, PdfLine other)
 {
     return(IntersectsWith(line.Point1, line.Point2, other.Point1, other.Point2));
 }
コード例 #2
0
        /// <summary>
        /// Get the t values that are the intersections of the line and the curve.
        /// </summary>
        /// <returns>List of t values where the <see cref="PdfPath.BezierCurve"/> and the <see cref="PdfLine"/> intersect.</returns>
        public static double[] FindIntersectionT(this PdfPath.BezierCurve bezierCurve, PdfLine line)
        {
            // if the bounding boxes do not intersect, they cannot intersect
            var bezierBbox = bezierCurve.GetBoundingRectangle();

            if (!bezierBbox.HasValue)
            {
                return(null);
            }
            var lineBbox = line.GetBoundingRectangle();

            if (!bezierBbox.Value.IntersectsWith(lineBbox))
            {
                return(null);
            }

            double x1 = line.Point1.X;
            double y1 = line.Point1.Y;
            double x2 = line.Point2.X;
            double y2 = line.Point2.Y;

            return(FindIntersectionT(bezierCurve, x1, y1, x2, y2));
        }
コード例 #3
0
 /// <summary>
 /// Whether the line segment contains the point.
 /// </summary>
 public static bool Contains(this PdfLine line, PdfPoint point)
 {
     return(Contains(line.Point1, line.Point2, point));
 }
コード例 #4
0
 /// <summary>
 /// Whether two lines intersect.
 /// </summary>
 public static bool IntersectsWith(this PdfLine line, PdfLine other)
 {
     return(Intersect(line, other) != null);
 }