Expand description
Conics: exact line/conic and conic/conic intersection.
A conic is A x^2 + B xy + C y^2 + D x + E y + F = 0 with exact dyadic
coefficients; circles and ellipses built from f64 data are exact.
§Line meets conic
Along p(t) = from + t*d the conic is a quadratic in t, so a hit is
a Root2 and everything crate::root decides applies: exact
tangency, exact ordering along the line, across different conics.
§Conic meets conic
Up to four points whose coordinates are, in general, roots of a quartic that radicals cannot express usefully. They are computed the way CGAL’s algebraic kernel does it:
- Shear
u = x + k*yfor a small integerk, chosen so no two intersection points shareu(finitely manykare bad). - Eliminate
y: the resultantR(u)has the points’uas roots. - The common root in
yis rational inu:y = N(u) / D(u)from the first subresultant, valid because the shear madeD(u) != 0at every real root. - Each point is a
RealRootu0plus those polynomials. Exact coordinates asRealRoots follow from a second resultant, and the sign of any conic or line at the point is the sign of one polynomial atu0.
Tangency is exact: in sheared coordinates the intersection multiplicity
at a point is the multiplicity of u0 as a root of R.
Structs§
- Conic
A x^2 + B xy + C y^2 + D x + E y + F = 0, coefficients exact.- Conic
Line Hit - One exact hit of a line with a conic:
t = (-beta +- sqrt(disc)) / alphaon the line, ort = -gamma / (2 beta)in the linear case. - Conic
Point - One exact intersection point of two conics.
Enums§
- Conic
Intersection - How two conics meet.
- Conic
Line Hits - Where a line meets a conic.
Functions§
- conic_
intersections - Exact intersection of two conics.
- line_
conic_ hits - Exact intersection of a line with a conic.