diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-04-03 19:20:55 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-04-03 19:20:55 +0000 |
| commit | 49ec02c315e6e5068b1ad395c01db2b536dd9b9e (patch) | |
| tree | 0b8993b8d6dcc8c2716a44b7d6f64208c85bcfd6 /src | |
| parent | Update pathinfo class to allow piecewise and pathvector as input. (diff) | |
| download | inkscape-49ec02c315e6e5068b1ad395c01db2b536dd9b9e.tar.gz inkscape-49ec02c315e6e5068b1ad395c01db2b536dd9b9e.zip | |
Updated Pathinfo to discrimine degenerate curves optionaly.
Fixed redundant data in are_near from pointwise
Fixed Fillet-Chamfer lpe to allow duplicate nodes
(bzr r13645.1.73)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/geom-pathinfo.cpp | 14 | ||||
| -rw-r--r-- | src/helper/geom-pathinfo.h | 6 | ||||
| -rw-r--r-- | src/helper/geom-pointwise.cpp | 10 | ||||
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.cpp | 8 |
4 files changed, 21 insertions, 17 deletions
diff --git a/src/helper/geom-pathinfo.cpp b/src/helper/geom-pathinfo.cpp index f9d4e5dbb..a37c0e475 100644 --- a/src/helper/geom-pathinfo.cpp +++ b/src/helper/geom-pathinfo.cpp @@ -22,9 +22,9 @@ Pathinfo::Pathinfo(Piecewise<D2<SBasis> > pwd2) : _pwd2(pwd2) _setPathInfo(pwd2); } ; -Pathinfo::Pathinfo(Geom::PathVector path_vector) : _path_vector(path_vector) +Pathinfo::Pathinfo(Geom::PathVector path_vector, bool skip_degenerate) : _path_vector(path_vector) { - _setPathInfo(path_vector); + _setPathInfo(path_vector, skip_degenerate); } ; @@ -37,10 +37,10 @@ void Pathinfo::setPwd2(Piecewise<D2<SBasis> > pwd2) _setPathInfo(pwd2); } -void Pathinfo::setPathVector(Geom::PathVector path_vector) +void Pathinfo::setPathVector(Geom::PathVector path_vector, bool skip_degenerate) { _path_vector = path_vector; - _setPathInfo(path_vector); + _setPathInfo(path_vector, skip_degenerate); } void Pathinfo::_setPathInfo(Piecewise<D2<SBasis> > pwd2) @@ -49,7 +49,7 @@ void Pathinfo::_setPathInfo(Piecewise<D2<SBasis> > pwd2) } /** Store the base path data */ -void Pathinfo::_setPathInfo(Geom::PathVector path_vector) +void Pathinfo::_setPathInfo(Geom::PathVector path_vector, bool skip_degenerate) { data.clear(); Geom::PathVector path_in = @@ -69,6 +69,10 @@ void Pathinfo::_setPathInfo(Geom::PathVector path_vector) } } while (curve_it1 != curve_endit) { + if(curve_it1->isDegenerate() && skip_degenerate ){ + ++curve_it1; + continue; + } ++curve_it1; counter++; } diff --git a/src/helper/geom-pathinfo.h b/src/helper/geom-pathinfo.h index c41d92e7a..021fcca2b 100644 --- a/src/helper/geom-pathinfo.h +++ b/src/helper/geom-pathinfo.h @@ -23,10 +23,10 @@ namespace Geom { class Pathinfo { public: Pathinfo(Piecewise<D2<SBasis> > pwd2); - Pathinfo(Geom::PathVector path_vector); + Pathinfo(Geom::PathVector path_vector, bool skip_degenerate = false); virtual ~Pathinfo(); void setPwd2(Piecewise<D2<SBasis> > pwd2); - void setPathVector(Geom::PathVector path_vector); + void setPathVector(Geom::PathVector path_vector, bool skip_degenerate = false); size_t numberCurves() const; size_t subPathIndex(size_t index) const; size_t last(size_t index) const; @@ -37,8 +37,8 @@ public: std::vector<std::pair<size_t, bool> > data; private: - void _setPathInfo(Geom::PathVector path_vector); void _setPathInfo(Piecewise<D2<SBasis> > pwd2); + void _setPathInfo(Geom::PathVector path_vector, bool skip_degenerate = false); Piecewise<D2<SBasis> > _pwd2; Geom::PathVector _path_vector; }; diff --git a/src/helper/geom-pointwise.cpp b/src/helper/geom-pointwise.cpp index 714573ad5..f68c9b13f 100644 --- a/src/helper/geom-pointwise.cpp +++ b/src/helper/geom-pointwise.cpp @@ -99,7 +99,7 @@ void Pointwise::pwd2Sustract(Piecewise<D2<SBasis> > A) setPwd2(A); for (size_t i = 0; i < _satellites.size(); i++) { if (_path_info.last(i - counter) < i - counter || - !are_near(pwd2[i].at0(), A[i - counter].at0(), 0.001)) { + !are_near(pwd2[i].at0(), A[i - counter].at0())) { counter++; } else { sats.push_back(_satellites[i - counter]); @@ -130,19 +130,19 @@ void Pointwise::pwd2Append(Piecewise<D2<SBasis> > A) } else { subpath_is_changed = new_subpath_index != _path_info.subPathIndex(i - counter); } - if (!reorder && first == i - counter && !are_near(_pwd2[i - counter].at0(), A[i].at0(), 0.001) && !subpath_is_changed) { + if (!reorder && first == i - counter && !are_near(_pwd2[i - counter].at0(), A[i].at0()) && !subpath_is_changed) { //Send the modified subpath to back subpathToBack(_path_info.subPathIndex(first)); reorder = true; i--; continue; } - if (!reversed && first == i - counter && !are_near(_pwd2[i - counter].at0(), A[i].at0(), 0.001) && !subpath_is_changed) { + if (!reversed && first == i - counter && !are_near(_pwd2[i - counter].at0(), A[i].at0()) && !subpath_is_changed) { subpathReverse(first, last); reversed = true; } - if (_pwd2.size() <= i - counter || !are_near(_pwd2[i - counter].at0(), A[i].at0(), 0.001)){ + if (_pwd2.size() <= i - counter || !are_near(_pwd2[i - counter].at0(), A[i].at0())){ counter++; bool active = true; bool hidden = false; @@ -270,7 +270,7 @@ void Pointwise::insertDegenerateSatellites(Piecewise<D2<SBasis> > A, Geom::PathV int steps = 0; Satellite sat(_satellites[0].satelliteType, is_time, active, mirror_knots, hidden, amount, degrees, steps); - _satellites.insert(_satellites.begin() + counter ,sat); + _satellites.insert(_satellites.begin() + counter + 1 ,sat); } ++curve_it1; counter++; diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index fdf2469e0..6cc9062d9 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -487,11 +487,11 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) double time0 = 0; std::vector<Geom::Satellite> sats = pointwise->getSatellites(); while (curve_it1 != curve_endit) { - if ((*curve_it1).isDegenerate() || (curve_it2 != curve_endit && (*curve_it2).isDegenerate())) { + if (curve_it2 != curve_endit && (*curve_it2).isDegenerate()) { + ++curve_it2; + } + if ((*curve_it1).isDegenerate()) { ++curve_it1; - if (curve_it2 != curve_endit) { - ++curve_it2; - } counter++; counter_curves++; time0 = 0.0; |
