Functions added to compute the gradient of Bezier curve.
1.1 --- a/src/lemon/bezier.h Sun Jan 16 22:29:28 2005 +0000
1.2 +++ b/src/lemon/bezier.h Sun Jan 16 22:31:26 2005 +0000
1.3 @@ -21,7 +21,7 @@
1.4 ///\file
1.5 ///\brief Classes to compute with Bezier curves.
1.6 ///
1.7 -///Up to now this file is internally used by \ref graph_to_eps.h
1.8 +///Up to now this file is used internally by \ref graph_to_eps.h
1.9 ///
1.10 ///\author Alpar Juttner
1.11
1.12 @@ -58,7 +58,11 @@
1.13 {
1.14 return Bezier1(conv(p1,p2,t),p2);
1.15 }
1.16 - Bezier1 operator()(double a,double b) { return before(b).after(a/b); }
1.17 + Bezier1 revert() { return Bezier1(p2,p1);}
1.18 + Bezier1 operator()(double a,double b) { return before(b).after(a/b); }
1.19 + xy grad() { return p2-p1; }
1.20 + xy grad(double t) { return grad(); }
1.21 +
1.22 };
1.23
1.24 class Bezier2 : public BezierBase
1.25 @@ -87,8 +91,10 @@
1.26 xy r(conv(p2,p3,t));
1.27 return Bezier2(conv(q,r,t),r,p3);
1.28 }
1.29 + Bezier2 revert() { return Bezier2(p3,p2,p1);}
1.30 Bezier2 operator()(double a,double b) { return before(b).after(a/b); }
1.31 -
1.32 + Bezier1 grad() { return Bezier1(2.0*(p2-p1),2.0*(p3-p2)); }
1.33 + xy grad(double t) { return grad()(t); }
1.34 };
1.35
1.36 class Bezier3 : public BezierBase
1.37 @@ -130,8 +136,10 @@
1.38 xy c(conv(a,b,t));
1.39 return Bezier3(c,b,r,p4);
1.40 }
1.41 + Bezier3 revert() { return Bezier3(p4,p3,p2,p1);}
1.42 Bezier3 operator()(double a,double b) { return before(b).after(a/b); }
1.43 -
1.44 + Bezier2 grad() { return Bezier2(3.0*(p2-p1),3.0*(p3-p2),3.0*(p4-p3)); }
1.45 + xy grad(double t) { return grad()(t); }
1.46 };
1.47
1.48 } //END OF NAMESPACE LEMON