const
function: real_pair solve (char axis_unknown, real known)Returns two possible values for either the horizontal or vertical coordinate. This function assumes that the
Ellipse
lies in a major plane withcenter
at the origin. Code that calls it must ensure that these conditions are fulfilled.
solve()
is called inReg_Cl_Plane_Curve::intersection_points(Point, Point, Point)
andReg_Cl_Plane_Curve::location()
, and resolves to this function, when these functions are called on anEllipse
. However,Ellipse::location()
overloadsReg_Cl_Plane_Curve::location()
, so the latter won't normally be called on anEllipse
. See Regular Closed Plane Curve Reference; Intersections, and Regular Closed Plane Curve Reference; Querying.
const
function: real_triple get_coefficients (real Slope, real v_intercept)Let x and y stand for the x and y-coordinates of a point on an ellipse in the x-y plane, a for half of the horizontal axis (
axis_h
/ 2), and b for half of the vertical axis (axis_v
/ 2).Further, let y = mx + i be the equation of a line in the x-y plane, where m is the slope and i the y-intercept.
This function returns the coefficients of the quadratic equation that results from replacing y with mx + i in the equation for the ellipse
x^2/a^2 + y^2/b^2 = 1
namely
x^2/a^2 + (mx + i)^2/b^2 - 1 = 0 == (b^2x + a^2m^2)x^2 + 2a^2imx + (a^2i^2 - a^2b^2) = 0.The coefficients are returned in the
real_triple
in the order one would expect:r.first
is the coefficient of x^2,r.second
of x andr.third
of the constant term (x^0 == 1).
get_coefficients()
is called inReg_Cl_Plane_Curve::intersection_points(Point, Point, Point)
, and resolves to this function, when the latter is called on anEllipse
. See Regular Closed Plane Curve Reference; Intersections.