Node:Solving Ellipses, Next:, Previous:Ellipse Intersections, Up:Ellipse Reference



Solving

real_pair solve (char axis_unknown, real known) const function
Returns two possible values for either the horizontal or vertical coordinate. This function assumes that the Ellipse lies in a major plane with center at the origin. Code that calls it must ensure that these conditions are fulfilled.

solve() is called in Reg_Cl_Plane_Curve::intersection_points(Point, Point, Point) and Reg_Cl_Plane_Curve::location(), and resolves to this function, when these functions are called on an Ellipse. However, Ellipse::location() overloads Reg_Cl_Plane_Curve::location(), so the latter won't normally be called on an Ellipse. See Regular Closed Plane Curve Reference; Intersections, and Regular Closed Plane Curve Reference; Querying.

real_triple get_coefficients (real Slope, real v_intercept) const function

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 and r.third of the constant term (x^0 == 1).

get_coefficients() is called in Reg_Cl_Plane_Curve::intersection_points(Point, Point, Point), and resolves to this function, when the latter is called on an Ellipse. See Regular Closed Plane Curve Reference; Intersections.