diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-08-11 03:11:03 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-08-11 03:11:03 +0000 |
| commit | 50ab28bfaaf986c4dd0cc363cc3c9cd0f15b82c2 (patch) | |
| tree | d53152cc22042192a4c5b39bc8fb3dd57ed6342a | |
| parent | Added reset modifier to knot in fillet chamfer (diff) | |
| download | inkscape-50ab28bfaaf986c4dd0cc363cc3c9cd0f15b82c2.tar.gz inkscape-50ab28bfaaf986c4dd0cc363cc3c9cd0f15b82c2.zip | |
Code refactor: now helper paths draw ok when handle is degenerate or cirle handle is biger then the distance to node. also remove code duplication at loop
(bzr r13341.1.136)
| -rw-r--r-- | src/live_effects/lpe-simplify.cpp | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index c4c2d449b..a817f30f1 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -202,33 +202,27 @@ LPESimplify::generateHelperPath(Geom::PathVector result) if(nodes){ drawNode(curve_it1->initialPoint()); } - while (curve_it2 != curve_endit) { - cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1); - if (cubic) { - if(handles){ - drawHandle((*cubic)[1]); - drawHandle((*cubic)[2]); - drawHandleLine((*cubic)[0],(*cubic)[1]); - drawHandleLine((*cubic)[3],(*cubic)[2]); + while (curve_it1 != curve_endit) { + cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1); + if (cubic) { + if(handles) { + if(!are_near((*cubic)[0],(*cubic)[1])){ + drawHandle((*cubic)[1]); + drawHandleLine((*cubic)[0],(*cubic)[1]); + } + if(!are_near((*cubic)[3],(*cubic)[2])){ + drawHandle((*cubic)[2]); + drawHandleLine((*cubic)[3],(*cubic)[2]); + } + } + } + if(nodes) { + drawNode(curve_it1->finalPoint()); + } + ++curve_it1; + if(curve_it2 != curve_endit){ + ++curve_it2; } - } - if(nodes){ - drawNode(curve_it1->finalPoint()); - } - ++curve_it1; - ++curve_it2; - } - cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1); - if (cubic) { - if(handles){ - drawHandle((*cubic)[1]); - drawHandle((*cubic)[2]); - drawHandleLine((*cubic)[0],(*cubic)[1]); - drawHandleLine((*cubic)[3],(*cubic)[2]); - } - } - if(nodes){ - drawNode(curve_it1->finalPoint()); } } } @@ -264,8 +258,8 @@ LPESimplify::drawHandleLine(Geom::Point p,Geom::Point p2) { Geom::Path path; path.start( p ); - if(helper_size > 0.0){ - double diameter = helper_size/0.67; + double diameter = helper_size/0.67; + if(helper_size > 0.0 && Geom::distance(p,p2) > (diameter * 0.35)){ Geom::Ray ray2(p, p2); p2 = p2 - Geom::Point::polar(ray2.angle(),(diameter * 0.35)); } |
