summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-06-25 17:54:53 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-06-25 17:54:53 +0000
commitd6710f8318ba6f95e9dd5ad96d341acc41b14a4e (patch)
tree1446b230c9eecbd03d0fd95e6edcb0075bd84558 /src
parentupdate to trunk (diff)
downloadinkscape-d6710f8318ba6f95e9dd5ad96d341acc41b14a4e.tar.gz
inkscape-d6710f8318ba6f95e9dd5ad96d341acc41b14a4e.zip
attemp to handle reverse path
(bzr r13645.1.95)
Diffstat (limited to 'src')
-rw-r--r--src/helper/geom-pointwise.cpp14
-rw-r--r--src/helper/geom-pointwise.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/src/helper/geom-pointwise.cpp b/src/helper/geom-pointwise.cpp
index 5f6c0d29e..dc95ffda4 100644
--- a/src/helper/geom-pointwise.cpp
+++ b/src/helper/geom-pointwise.cpp
@@ -83,7 +83,11 @@ void Pointwise::setStart()
*/
void Pointwise::recalculateForNewPwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Geom::PathVector const B, Satellite const S)
{
- if (_pwd2.size() > A.size()) {
+ Geom::PathVector const reversed = path_from_piecewise(remove_short_cuts(reverse(_pwd2), 0.1), 0.001);
+ Geom::PathVector const original = path_from_piecewise(remove_short_cuts(reverse(A), 0.1), 0.001);
+ if (reversed == original) {
+ pwd2Reverse(A);
+ } else if (_pwd2.size() > A.size()) {
pwd2Sustract(A);
} else if (_pwd2.size() < A.size()) {
pwd2Append(A, S);
@@ -112,6 +116,14 @@ void Pointwise::pwd2Sustract(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A)
setSatellites(sats);
}
+/** Reverse a path
+ */
+void Pointwise::pwd2Reverse(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A){
+ std::reverse(_satellites.begin(), _satellites.end());
+ setPwd2(A);
+ setSatellites(_satellites);
+}
+
/** Append nodes/subpaths to current pointwise
*/
void Pointwise::pwd2Append(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Satellite const S)
diff --git a/src/helper/geom-pointwise.h b/src/helper/geom-pointwise.h
index d83b54b79..79504ecff 100644
--- a/src/helper/geom-pointwise.h
+++ b/src/helper/geom-pointwise.h
@@ -54,6 +54,7 @@ public:
void setStart();
void recalculateForNewPwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Geom::PathVector const B, Satellite const S);
+ void pwd2Reverse(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A);
void pwd2Sustract(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A);
void pwd2Append(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Satellite const S);
void subpathToBack(size_t subpath);