diff options
| author | Alexander Brock <zaibu@lunar-orbit.de> | 2016-11-29 16:17:14 +0000 |
|---|---|---|
| committer | Alexander Brock <zaibu@lunar-orbit.de> | 2016-11-29 16:17:14 +0000 |
| commit | 30cc2099eec035d794735d1742eb21c3d2401dee (patch) | |
| tree | f91d66efc36242b0411fa85e49a47dcb46d9674b /src/helper/geom-pathstroke.cpp | |
| parent | Fix instability caused by degenerate paths (patch by jabiertxof) (diff) | |
| download | inkscape-30cc2099eec035d794735d1742eb21c3d2401dee.tar.gz inkscape-30cc2099eec035d794735d1742eb21c3d2401dee.zip | |
Make tolerance a parameter on every level
(bzr r15280.1.5)
Diffstat (limited to 'src/helper/geom-pathstroke.cpp')
| -rw-r--r-- | src/helper/geom-pathstroke.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/helper/geom-pathstroke.cpp b/src/helper/geom-pathstroke.cpp index a60441dde..b39bb7f91 100644 --- a/src/helper/geom-pathstroke.cpp +++ b/src/helper/geom-pathstroke.cpp @@ -1019,13 +1019,19 @@ void peak_cap(Geom::PathBuilder& res, Geom::Path const& with_dir, Geom::Path con namespace Inkscape { -Geom::PathVector outline(Geom::Path const& input, double width, double miter, LineJoinType join, LineCapType butt) +Geom::PathVector outline( + Geom::Path const& input, + double width, + double miter, + LineJoinType join, + LineCapType butt, + double tolerance) { if (input.size() == 0) return Geom::PathVector(); // nope, don't even try Geom::PathBuilder res; - Geom::Path with_dir = half_outline(input, width/2., miter, join); - Geom::Path against_dir = half_outline(input.reversed(), width/2., miter, join); + Geom::Path with_dir = half_outline(input, width/2., miter, join, tolerance); + Geom::Path against_dir = half_outline(input.reversed(), width/2., miter, join, tolerance); res.moveTo(with_dir[0].initialPoint()); res.append(with_dir); @@ -1064,9 +1070,21 @@ Geom::PathVector outline(Geom::Path const& input, double width, double miter, Li return res.peek(); } -Geom::Path half_outline(Geom::Path const& input, double width, double miter, LineJoinType join) +Geom::Path half_outline( + Geom::Path const& input, + double width, + double miter, + LineJoinType join, + double tolerance) { - double const tolerance = 5.0 * (width/100); // Tolerance is 5% + if (tolerance <= 0) { + if (width > 0) { + tolerance = 5.0 * (std::abs(width)/100); + } + else { + tolerance = 1e-4; + } + } Geom::Path res; if (input.size() == 0) return res; |
