summaryrefslogtreecommitdiffstats
path: root/src/livarot/PathCutting.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2008-03-08 11:32:18 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2008-03-08 11:32:18 +0000
commit0a78ad638f3bbcd46631cb2c741fca031356b725 (patch)
treee7e0378939debb249a67c9e658bcef959b3b1a57 /src/livarot/PathCutting.cpp
parentmake the infobox narrower and place add button above it (diff)
downloadinkscape-0a78ad638f3bbcd46631cb2c741fca031356b725.tar.gz
inkscape-0a78ad638f3bbcd46631cb2c741fca031356b725.zip
Node tool: snap to paths and their nodes, incl. to the path currently being edited
(bzr r4989)
Diffstat (limited to 'src/livarot/PathCutting.cpp')
-rw-r--r--src/livarot/PathCutting.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp
index 7bc1114a3..ea8a86f3e 100644
--- a/src/livarot/PathCutting.cpp
+++ b/src/livarot/PathCutting.cpp
@@ -951,14 +951,17 @@ hence the Path-esque coding style"
*/
template<typename T> inline static T square(T x) {return x*x;}
-Path::cut_position Path::PointToCurvilignPosition(NR::Point const &pos) const
+Path::cut_position Path::PointToCurvilignPosition(NR::Point const &pos, unsigned seg) const
{
+ // if the parameter "seg" == 0, then all segments will be considered
+ // In however e.g. "seg" == 6 , then only the 6th segment will be considered
+
unsigned bestSeg = 0;
double bestRangeSquared = DBL_MAX;
double bestT = 0.0; // you need a sentinel, or make sure that you prime with correct values.
for (unsigned i = 1 ; i < pts.size() ; i++) {
- if (pts[i].isMoveTo == polyline_moveto) continue;
+ if (pts[i].isMoveTo == polyline_moveto || (seg > 0 && i != seg)) continue;
NR::Point p1, p2, localPos;
double thisRangeSquared;
double t;