From e40990e3b9c391cdded31f28bb8f8d448fd1d361 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 12 Jun 2016 17:27:07 +0200 Subject: Handle both directions on knot reposition (bzr r13645.1.154) --- src/live_effects/parameter/satellitesarray.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/live_effects/parameter/satellitesarray.cpp') diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp index db7cf80c0..18e1bd4de 100644 --- a/src/live_effects/parameter/satellitesarray.cpp +++ b/src/live_effects/parameter/satellitesarray.cpp @@ -305,13 +305,18 @@ void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p, { return; } - if (is_mirror) { - size_t previous_index = curve_index - 1; - if(curve_index == 0 && pathv[path_index].closed()){ - previous_index = pathv[path_index].size() - 1; - } - Geom::Curve const &curve_in = pathv[path_index][previous_index]; - double mirror_time = Geom::nearest_time(s, curve_in); + size_t previous_index = curve_index - 1; + if(curve_index == 0 && pathv[path_index].closed()){ + previous_index = pathv[path_index].size() - 1; + } + Geom::Curve const &curve_in = pathv[path_index][previous_index]; + double mirror_time = Geom::nearest_time(s, curve_in); + Geom::Point mirror = curve_in.pointAt(mirror_time); + double normal_time = Geom::nearest_time(s, pathv[path_index][curve_index]); + Geom::Point normal = pathv[path_index][curve_index].pointAt(normal_time); + double distance_mirror = Geom::distance(mirror,s); + double distance_normal = Geom::distance(normal,s); + if (distance_mirror <= distance_normal) { double time_start = 0; Satellites satellites = _pparam->_last_pathvector_satellites->getSatellites(); time_start = satellites[path_index][previous_index].time(curve_in); -- cgit v1.2.3