Next: , Previous: Affine Transformations for Ellipses, Up: Ellipse Reference


31.7 Querying

const function: bool is_elliptical (void)

Returns true if the Ellipse is elliptical, otherwise false.

Certain transformations, such as shearing and scaling, can cause Ellipses to become non-elliptical.

— Inline const function: bool is_quadratic (void)

Returns true, because the equation for an ellipse in the x-y plane with its center at the origin is the quadratic equation x^2/a^2 + y^2/b^2 = 1 where a is half the horizontal axis and b is half the vertical axis.

          Ellipse e(origin, 5, 2, 90);
          e.draw();
          Point P(e.angle_point(-35));
          cout << ((P.get_x() * P.get_x())
                   / (e.get_axis_h()/2 * e.get_axis_h()/2))
                  + ((P.get_y() * P.get_y())
                     / (e.get_axis_v()/2 * e.get_axis_v()/2));
          -| 1


[Figure 163. Not displayed.]

Fig. 163.

const virtual functions: bool is_cubic (void)
— : bool is_quartic (void)

These functions both return false, because the equation of an ellipse is neither a cubic nor a quartic function.