summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Brock <zaibu@lunar-orbit.de>2016-11-29 14:01:52 +0000
committerAlexander Brock <zaibu@lunar-orbit.de>2016-11-29 14:01:52 +0000
commit69405b64831f4e92d2ac4778430c8c048d985f3f (patch)
tree1e54255933ae663fb94b0dda7dd7662e0c73c8a5 /src
parentMake tolerance of offset_curve a parameter (diff)
downloadinkscape-69405b64831f4e92d2ac4778430c8c048d985f3f.tar.gz
inkscape-69405b64831f4e92d2ac4778430c8c048d985f3f.zip
Fix instability caused by degenerate paths (patch by jabiertxof)
(bzr r15280.1.4)
Diffstat (limited to 'src')
-rw-r--r--src/helper/geom-pathstroke.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/helper/geom-pathstroke.cpp b/src/helper/geom-pathstroke.cpp
index 3a865fd48..a60441dde 100644
--- a/src/helper/geom-pathstroke.cpp
+++ b/src/helper/geom-pathstroke.cpp
@@ -1081,8 +1081,9 @@ Geom::Path half_outline(Geom::Path const& input, double width, double miter, Lin
res.start(start);
// Do two curves at a time for efficiency, since the join function needs to know the outgoing curve as well
- const size_t k = (input.back_closed().isDegenerate() && input.closed())
- ?input.size_default()-1:input.size_default();
+ const Geom::Curve &closingline = input.back_closed();
+ const size_t k = (are_near(closingline.initialPoint(), closingline.finalPoint()) && input.closed() )
+ ?input.size_open():input.size_default();
for (size_t u = 0; u < k; u += 2) {
temp.clear();
@@ -1104,7 +1105,6 @@ Geom::Path half_outline(Geom::Path const& input, double width, double miter, Lin
outline_join(res, temp, tang[0], tang[1], width, miter, join);
}
}
-
if (input.closed()) {
Geom::Curve const &c1 = res.back();
Geom::Curve const &c2 = res.front();
@@ -1116,7 +1116,6 @@ Geom::Path half_outline(Geom::Path const& input, double width, double miter, Lin
outline_join(temp, temp2, tang[0], tang[1], width, miter, join);
res.erase(res.begin());
res.erase_last();
- //
res.append(temp);
res.close();
}
@@ -1128,9 +1127,8 @@ void outline_join(Geom::Path &res, Geom::Path const& temp, Geom::Point in_tang,
{
if (res.size() == 0 || temp.size() == 0)
return;
-
Geom::Curve const& outgoing = temp.front();
- if (Geom::are_near(res.finalPoint(), outgoing.initialPoint())) {
+ if (Geom::are_near(res.finalPoint(), outgoing.initialPoint(), 0.01)) {
// if the points are /that/ close, just ignore this one
res.setFinal(temp.initialPoint());
res.append(temp);