Node:Regular Closed Plane Curve Intersections, Next:, Previous:Querying Regular Closed Plane Curves, Up:Regular Closed Plane Curve Reference



Intersections

bool_point_pair intersection_points (Point ref_pt, Point p0, Point p1) const function
bool_point_pair intersection_points (const Point& ref_pt, const Path& p) const function
The version of this function taking Point arguments finds the intersection points, if any, of the Reg_Cl_Plane_Curve and the line p that passes through the Points p_0 and p_1. In the other version, the Path argument must be a linear Path, and its first and last Points are passed to the first version of this function as p0 and p1, respectively.

Let C be the Reg_Cl_Plane_Curve. C and p can intersect at at most two intersection points i_1 and i_2. Let bpp be the return value of this function. The intersection points need not be on the line segment between pt0 and pt1. bpp.first.pt will be set to the first intersection point if it exists, or INVALID_POINT if it doesn't. If the first intersection point exists and is on the line segment between pt0 and pt1

In [next figure] , the line AB is normal to the Ellipse e, or, to put it another way, AB is perpendicular to the plane of e. The intersection point i_0 lies within the perimeter of e.

The line DE is skew to the plane of e, and intersects e at i_1, on the perimeter of e.

          Point p0(2, 2, 3);
          Ellipse e(p0, 3, 4, 30, -60, -5.2);
          Point p1 = p0.mediate(e.get_point(11), .5);
          Point A = e.get_normal();
          A *= 2.5;
          A.shift(p1);
          Point B = A.mediate(p1, 2);
          bool_point_pair bpp = e.intersection_points(A, B);
          Point C(0, 2, 0);
          Point D(0, -3.5, 0);
          C *= D.rotate(2, 0, -5);
          C *= D.shift(e.get_point(4));
          bpp = e.intersection_points(C, D);
          


[Figure 154. Not displayed.]

Fig. 154.

In [next figure] , q and e are coplanar. In this case, only the intersections of q with the perimeter of e are returned by intersection_points().

          A = p0.mediate(e.get_point(3), 1.5);
          B = p0.mediate(e.get_point(11), 1.5);
          Path q(A, B);
          bpp = e.intersection_points(q);
          


[Figure 155. Not displayed.]

Fig. 155.