Code

Filters. New custom predefined cross-smooth filter (very experimental...).
[inkscape.git] / src / 2geom / curve.h
index af02d6edba9d3afeb4db2292cfef3fccd2d5c3b7..65bf86ef6e7570db3f08707e5458e7e1355dcdf4 100644 (file)
@@ -83,6 +83,8 @@ public:
 
   virtual int winding(Point p) const { return root_winding(*this, p); }
 
+  virtual int degreesOfFreedom() const { return 0;}
+
   //mental: review these
   virtual Curve *portion(double f, double t) const = 0;
   virtual Curve *reverse() const { return portion(1, 0); }
@@ -133,12 +135,12 @@ public:
    */
   virtual Point unitTangentAt(Coord t, unsigned n = 3) const
   {
-       std::vector<Point> derivs = pointAndDerivatives(t, n);
-       for (unsigned deriv_n = 1; deriv_n < derivs.size(); deriv_n++) {
+    std::vector<Point> derivs = pointAndDerivatives(t, n);
+    for (unsigned deriv_n = 1; deriv_n < derivs.size(); deriv_n++) {
       Coord length = derivs[deriv_n].length();
       if ( ! are_near(length, 0) ) {
          // length of derivative is non-zero, so return unit vector
-         derivs[deriv_n] / length;
+         return derivs[deriv_n] / length;
       }
     }
     return Point (0,0);
@@ -170,4 +172,4 @@ Coord nearest_point(Point const& p, Curve const& c)
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :