Node:Planes Returning Information, Next:, Previous:Planes Operators, Up:Plane Reference

### Returning Information

 real_short get_distance (const Point& p) `const` function real_short get_distance (void) `const` function
 The version of this function taking a `Point` argument returns a `real_short` r, whose `real` part (r.`first`) represents the distance of p from the `Plane`. This value is always positive. r.`second` can take on three values: 0 If the `Point` lies in the `Plane`. 1 If it lies on the side of the `Plane` pointed at by the normal to the `Plane`, considered to be the "outside". -1 If it lies on the side of the `Plane` not pointed at by the normal to the `Plane`, considered to be the "inside". The version taking no argument returns the absolute of the data member `distance` and its sign, i.e., the distance of `origin` to the `Plane`, and which side of the `Plane` it lies on. It would have been possible to use `origin` as the default for an optional `Point` argument, but I've chosen to overload this function, because of problems that may arise, when I implement `user_coordinates` and `view_coordinates` (see Point Reference; Data Members). ``` Point N(0, 1); N.rotate(-10, 20, 20); Point P(1, 1, 1); Plane q(P, N); Point A(4, -2, 4); Point B(-1, 3, 2); Point C = q.intersection_point(A, B).pt; real_short bp; bp = q.get_distance(); cout << bp.first; -| 0.675646 cout << bp.second -| -1 bp = q.get_distance(A) cout << bp.first; -| 3.40368 cout << bp.second; -| -1 bp = q.get_distance(B) cout << bp.first; -| 2.75865 cout << bp.second; -| 1 bp = q.get_distance(C) cout << bp.first; -| 0 cout << bp.second; -| 0 ``` Fig. 106.