Bézier curves/Intersections: Difference between revisions
Content added Content deleted
(→C implementation 2: Added gnu::const attributes to try to help an optimizer.) |
|||
Line 605: | Line 605: | ||
// Convert a non-parametric spline from Bernstein basis to s-power. |
// Convert a non-parametric spline from Bernstein basis to s-power. |
||
spower_spline |
[[gnu::const]] spower_spline |
||
bernstein_spline_to_spower (bernstein_spline S) |
bernstein_spline_to_spower (bernstein_spline S) |
||
{ |
{ |
||
Line 628: | Line 628: | ||
// requires two applications of de Casteljau subdivision. On the other |
// requires two applications of de Casteljau subdivision. On the other |
||
// hand, subdivision requires two applications of the following. |
// hand, subdivision requires two applications of the following. |
||
inline spower_spline |
[[gnu::const]] inline spower_spline |
||
spower_spline_portion (spower_spline S, double t0, double t1) |
spower_spline_portion (spower_spline S, double t0, double t1) |
||
{ |
{ |
||
Line 645: | Line 645: | ||
} |
} |
||
inline spower_curve |
[[gnu::const]] inline spower_curve |
||
spower_curve_portion (spower_curve C, double t0, double t1) |
spower_curve_portion (spower_curve C, double t0, double t1) |
||
{ |
{ |
||
Line 658: | Line 658: | ||
// Given a parametric curve, is it "flat enough" to have its quadratic |
// Given a parametric curve, is it "flat enough" to have its quadratic |
||
// terms removed? |
// terms removed? |
||
[[gnu::const]] inline bool |
|||
bool |
|||
flat_enough (spower_curve C, double tol) |
flat_enough (spower_curve C, double tol) |
||
{ |
{ |