summaryrefslogtreecommitdiffstats
path: root/src/2geom/solve-bezier-one-d.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2015-04-27 23:39:29 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2015-04-27 23:39:29 +0000
commitc883d7627a479c8c5b6a9f77b9841fa5631572ad (patch)
treefba1186e26a8cc85a1b0728425bef6f2e9aeccd9 /src/2geom/solve-bezier-one-d.cpp
parentextensions. ink2canvas.py - do not parse html comments. (Bug 1446204) (diff)
downloadinkscape-c883d7627a479c8c5b6a9f77b9841fa5631572ad.tar.gz
inkscape-c883d7627a479c8c5b6a9f77b9841fa5631572ad.zip
2Geom sync - initial commit
(bzr r14059.2.1)
Diffstat (limited to 'src/2geom/solve-bezier-one-d.cpp')
-rw-r--r--src/2geom/solve-bezier-one-d.cpp30
1 files changed, 2 insertions, 28 deletions
diff --git a/src/2geom/solve-bezier-one-d.cpp b/src/2geom/solve-bezier-one-d.cpp
index 3d87d4926..3a25e9808 100644
--- a/src/2geom/solve-bezier-one-d.cpp
+++ b/src/2geom/solve-bezier-one-d.cpp
@@ -27,7 +27,7 @@ static int SGN(t x) { return (x > 0 ? 1 : (x < 0 ? -1 : 0)); }
**/
class Bernsteins{
public:
- static const size_t MAX_DEPTH = 22;
+ static const size_t MAX_DEPTH = 53;
size_t degree, N;
std::vector<double> &solutions;
//std::vector<double> bc;
@@ -38,17 +38,9 @@ public:
{
}
- void subdivide(double const *V,
- double t,
- double *Left,
- double *Right);
-
unsigned
control_poly_flat_enough(double const *V);
- double horner(const double *b, double t);
-
-
void
find_bernstein_roots(double const *w, /* The control points */
unsigned depth, /* The depth of the recursion */
@@ -134,7 +126,7 @@ void Bernsteins::find_bernstein_roots(double const *w, /* The control points */
r = (fs*t - ft*s) / (fs - ft);
if (fabs(t-s) < e * fabs(t+s)) break;
- double fr = horner(w, r);
+ double fr = bernstein_value_at(r, w, degree);
if (fr * ft > 0)
{
@@ -191,24 +183,6 @@ void Bernsteins::find_bernstein_roots(double const *w, /* The control points */
delete[] LR;
}
-
-// suggested by Sederberg.
-double Bernsteins::horner(const double *b, double t)
-{
- double u, tn, tmp;
- u = 1.0 - t;
- tn = 1.0;
- tmp = b[0] * u;
- for(size_t i = 1; i < degree; ++i)
- {
- tn *= t;
- tmp = (tmp + tn*bc[i]*b[i]) * u;
- }
- return (tmp + tn*t*b[degree]);
-}
-
-
-
#if 0
/*
* control_poly_flat_enough :