summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 59b1954)
raw | patch | inline | side by side (parent: 59b1954)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 13 Apr 2008 19:27:01 +0000 (19:27 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 13 Apr 2008 19:27:01 +0000 (19:27 +0000) |
src/2geom/d2-sbasis.cpp | patch | blob | history | |
src/2geom/d2-sbasis.h | patch | blob | history |
index a646e2cf4782148bdc3c13b2136c540b28dab404..dbf4da10e5effe08e320704e10aedb96bd41509e 100644 (file)
--- a/src/2geom/d2-sbasis.cpp
+++ b/src/2geom/d2-sbasis.cpp
}
//if tol>0, only force continuity where the jump is smaller than tol.
-Piecewise<D2<SBasis> > force_continuity(Piecewise<D2<SBasis> > const &f,
- double tol,
- bool closed){
+Piecewise<D2<SBasis> > force_continuity(Piecewise<D2<SBasis> > const &f, double tol, bool closed)
+{
if (f.size()==0) return f;
Piecewise<D2<SBasis> > result=f;
unsigned cur = (closed)? 0:1;
}
return result;
}
+
+std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > >
+split_at_discontinuities (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwsbin, double tol)
+{
+ using namespace Geom;
+ std::vector<Piecewise<D2<SBasis> > > ret;
+ unsigned piece_start = 0;
+ for (unsigned i=0; i<pwsbin.segs.size(); i++){
+ if (i==(pwsbin.segs.size()-1) || L2(pwsbin.segs[i].at1()- pwsbin.segs[i+1].at0()) > tol){
+ Piecewise<D2<SBasis> > piece;
+ piece.cuts.push_back(pwsbin.cuts[piece_start]);
+ for (unsigned j = piece_start; j<i+1; j++){
+ piece.segs.push_back(pwsbin.segs[j]);
+ piece.cuts.push_back(pwsbin.cuts[j+1]);
+ }
+ ret.push_back(piece);
+ piece_start = i+1;
+ }
+ }
+ return ret;
}
+
+} // namespace Geom
diff --git a/src/2geom/d2-sbasis.h b/src/2geom/d2-sbasis.h
index 95f1ca0dd3562f58150d3da9731ed91c35198695..c1f0faf4daea0e23485f68af3d24e1a912cfc0b1 100644 (file)
--- a/src/2geom/d2-sbasis.h
+++ b/src/2geom/d2-sbasis.h
Piecewise<D2<SBasis> > operator*(Piecewise<D2<SBasis> > const &a, Matrix const &m);
-Piecewise<D2<SBasis> > force_continuity(Piecewise<D2<SBasis> > const &f,
- double tol=0,
- bool closed=false);
+Piecewise<D2<SBasis> > force_continuity(Piecewise<D2<SBasis> > const &f, double tol=0, bool closed=false);
+
+std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > split_at_discontinuities (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwsbin, double tol = .0001);
class CoordIterator
: public std::iterator<std::input_iterator_tag, SBasis const>