Node:Plane Intersections, Next:Planes Showing, Previous:Planes Returning Information, Up:Plane Reference
| bool_point intersection_point (const Point& p0, const Point& p1) | const function |
| bool_point intersection_point (const Path& p) | const function |
These functions find the intersection point of the Plane and a
line. In the first version, the
line is defined by the two Point arguments. In the second
version, the Path p must be linear, i.e.,
p.is_linear() must be true.
Both versions of Point center(2, 2, 3.5);
Reg_Polygon h(center, 6, 4, 80, 30, 10);
Plane q = h.get_plane();
Point P0 = center.mediate(h.get_point(2));
P0.shift(5 * (N - center));
Point P1(P0);
P1.rotate(h.get_point(1), h.get_point(4));
P1 = 3 * (P1 - P0);
P1.shift(P0);
P1.shift(3, -.5, -2);
bool_point bp = q.intersection_point(P0, P1);
Point i_P = bp.pt;
Point P4 = h.get_point(3).mediate(h.get_point(0), .75);
P4.shift(N - center);
Point P5(P4);
P5.rotate(h.get_point(3), h.get_point(0));
P4.shift(-1, 2);
Path theta(P4, P5);
bp = q.intersection_point(theta);
Point i_theta = bp.pt;
draw_axes();
|
| Line intersection_line (const Plane& p) | const function |
Returns a Line l. representing the line of intersection of two
Planes. See Line Reference.
In [next figure]
, Rectangle r0(origin, 5, 5, 10, 15, 6);
Rectangle r1(origin, 5, 5, 90, 50, 10);
r1 *= r0.rotate(30, 30, 30);
r1 *= r0.shift(1, -1, 3);
Plane q0 = r0.get_plane();
Plane q1 = r1.get_plane();
Line l = q0.intersection_line(q1);
l.show("l:");
-| l:
position: (0, 11.2193, 20.0759)
direction: (0.0466595, -0.570146, -0.796753)
Point P0(l.direction);
P0.shift(l.position);
P0.show("P0:");
-| P0: (0.0466595, 10.6491, 19.2791)
Point P1(-l.direction);
P1.shift(l.position);
Point P2(P0 - P1);
P2 *= 12.5;
P2.shift(P0);
cout << P2.is_on_plane(q0);
-| 1
cout << P2.is_on_plane(q1);
-| 1
Point P3(P0 - P1);
P3 *= 7;
P3.shift(P0);
cout << P3.is_on_plane(q0);
-| 1
cout << P3.is_on_plane(q1);
-| 1
|