Code

use nodetype helper function to determine nodetype within lpe-spiro
authorjohanengelen <johanengelen@users.sourceforge.net>
Sat, 2 Aug 2008 20:59:59 +0000 (20:59 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Sat, 2 Aug 2008 20:59:59 +0000 (20:59 +0000)
src/live_effects/lpe-spiro.cpp

index 657ffc10b4c57dc29555873a93db85dced725b04..6a98e6d2990b274d9dda3e2445c78fe387910f37 100644 (file)
@@ -160,14 +160,10 @@ LPESpiro::doEffect(SPCurve * curve)
             bool next_is_line = ( dynamic_cast<Geom::LineSegment const *>(&*curve_it2)  ||
                                   dynamic_cast<Geom::HLineSegment const *>(&*curve_it2) ||
                                   dynamic_cast<Geom::VLineSegment const *>(&*curve_it2) );
-            Geom::Point deriv_1 = curve_it1->unitTangentAt(1);
-            Geom::Point deriv_2 = curve_it2->unitTangentAt(0);
-            double this_angle_L2 = Geom::L2(deriv_1);
-            double next_angle_L2 = Geom::L2(deriv_2);
-            double both_angles_L2 = Geom::L2(deriv_1 + deriv_2);
-            if ( (this_angle_L2 > 1e-6) &&
-                 (next_angle_L2 > 1e-6) &&
-                 ((this_angle_L2 + next_angle_L2 - both_angles_L2) < 1e-3) )
+
+            Geom::NodeType nodetype = Geom::get_nodetype(*curve_it1, *curve_it2);
+
+            if ( nodetype == Geom::NODE_SMOOTH || nodetype == Geom::NODE_SYMM )
             {
                 if (this_is_line && !next_is_line) {
                     path[ip].ty = ']';