Node: Returning Elements and Information for Ellipses, Next: , Previous: Querying Ellipses, Up: Ellipse Reference



Returning Elements and Information

Point& get_center (void) Virtual function
Point get_center (void) const virtual function
These functions return center.

const Point& get_focus (const unsigned short s) Function
Point get_focus (const unsigned short s) const function
These functions return focus0 or focus1, depending on the value of s, which must be 0 or 1. If s is not 0 or 1, get_focus() returns INVALID_POINT.

real get_linear_eccentricity (void) const function
Returns linear_eccentricity.

real get_numerical_eccentricity (void) const function
Returns numerical_eccentricity.

real get_axis_v (void) Function
real get_axis_v (void) const function
Calculates and returns the value of axis_h.

get_axis_v() first checks if the Ellipse is still elliptical, using is_elliptical() (see Ellipse Reference; Querying). Operations such as scale() and shear() can cause an Ellipse to become non-elliptical. If this is the case, this function returns INVALID_REAL.

If the Ellipse is still elliptical, axis_v is recalculated and returned. In the non-const version, axis_v is also reset to the new value.

real get_axis_h (void) Function
real get_axis_h (void) const function
Calculates and returns the value of axis_h.

get_axis_h() first checks if the Ellipse is still elliptical, using is_elliptical() (see Ellipse Reference; Querying). Operations such as scale() and shear() can cause an Ellipse to become non-elliptical. If this is the case, this function returns INVALID_REAL.

If the Ellipse is still elliptical, axis_h is recalculated and returned. In the non-const version, axis_h is also reset to the new value.

signed short location (Point p) const virtual function
Returns a value l indicating the location of the Point argument p with respect to the Ellipse.

Let e stand for the Ellipse. The return values are as follows:

0
p lies on the perimeter of e.
1
p lies in the plane of e, within its perimeter.
-1
p lies in the plane of e, outside its perimeter.
-2
p and e do not lie in the same plane.
-3
e is not elliptical, possibly due to having been transformed.
          Ellipse e(origin, 3, 5, 45, 15, 3);
          e.shift(2, 1, 1);
          Point A = e.get_point(7);
          cout << e.location(A);
          -| 0
          Point B = center.mediate(e.get_point(2));
          cout << e.location(B);
          -| 1
          Point C = center.mediate(e.get_point(2), 1.5);
          cout << e.location(C);
          -| -1
          Point D = A;
          D.shift(-2, 0, 4);
          e.location(D);
          -| WARNING! In Ellipse::location():
             Point doesn't lie in plane of Ellipse.
             Returning -2.
          e.scale(1.5, 0, 1.5);
          e.location(A);
          -| WARNING! In Ellipse::do_transform(const Transform&):
             This transformation has made *this non-elliptical!
          
             ERROR! In Ellipse::location():
             Ellipse is non-elliptical. Returning -3.
          


[Figure 164. Not displayed.]

Fig. 164.

Point angle_point (real angle) const function
Returns a point on the Ellipse given an angle. A Point p is set to the zeroth Point on the Ellipse and rotated about the line from the center of the Ellipse in the direction of the normal to the plane of the Ellipse. Then, the intersection of the ray from the center through p and the perimeter of the Ellipse is returned.
          Ellipse e(origin, 6, 4);
          Point P = e.angle_point(135);
          current_picture.output(Projections::PARALLEL_X_Z);
          


[Figure 165. Not displayed.]

Fig. 165.

[next figure] demonstrates, that the rotation is unfortunately not always in the direction one would prefer. I don't have a solution to this problem yet.

          Ellipse e(origin, 6, 4, 90);
          Point P = e.angle_point(135);
          Point Q = e.angle_point(-135);
          


[Figure 166. Not displayed.]

Fig. 166.