Node:Path Intersections, Previous:Outputting Paths, Up:Path Reference



Intersections

bool_point intersection_point (const Path& p, const bool trace) Function
Finds the intersection point, if any, of two linear Paths. Let bp be the bool_point returned by this function. bp.pt will contains the intersection point, if it exists. If not, it will contain INVALID_POINT. If the intersection point exists and lies on both of the line segments represented by the Path and p, bp.b will be true, otherwise, false.

This function calls Point::intersection_points(), passing the first and last Points on *this and p as its arguments. If the trace argument is false, the version of Point::intersection_points() that finds the intersection point by means of a vector calculation is used. If it's true, the version that finds the intersection point of the traces of the lines on the major planes is used. See Point Reference; Intersections.

          Point A(-1, -1, -1);
          Point B(1, 1, 1);
          Path p0(A, B);
          Point C(-2, 1, 1);
          Point D(1.75, 0.25, 0.25);
          Path p1(C, D);
          bool_point bp = p0.intersection_point(p1);
          bp.pt.dotlabel("$i$");
          bp.pt.show("bp.pt:");
          -| bp.pt: (0.5, 0.5, 0.5)
          


[Figure 138. Not displayed.]

Fig. 138.