diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2015-04-29 01:10:13 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2015-04-29 01:10:13 +0000 |
| commit | 5a3f7c27245b1a1858036210efbde031d199ebdc (patch) | |
| tree | dd6e11700e1732c90fc9fc867d909caea105b0a8 /src | |
| parent | fix tangent sign problems in path outline code (diff) | |
| download | inkscape-5a3f7c27245b1a1858036210efbde031d199ebdc.tar.gz inkscape-5a3f7c27245b1a1858036210efbde031d199ebdc.zip | |
Catch more intersections (can still be improved somewhat I think)
(bzr r14069)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/geom-pathstroke.cpp | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/src/helper/geom-pathstroke.cpp b/src/helper/geom-pathstroke.cpp index 6b35bb290..a33fb005b 100644 --- a/src/helper/geom-pathstroke.cpp +++ b/src/helper/geom-pathstroke.cpp @@ -412,31 +412,27 @@ void extrapolate_join(join_data jd) void join_inside(join_data jd) { Geom::Path &res = jd.res; - Geom::Curve const& incoming = res.back_open(); - Geom::Curve const& outgoing = jd.outgoing.front(); - Geom::Crossings cross = Geom::crossings(incoming, outgoing); - - if (!cross.empty()) { - // yeah if we could avoid allocing that'd be great - Geom::Curve *d1 = incoming.portion(0., cross[0].ta); - res.erase_last(); - res.append(*d1); - delete d1; - - Geom::Curve *d2 = outgoing.portion(cross[0].tb, 1.); - res.setFinal(d2->initialPoint()); - res.append(*d2); - delete d2; + Geom::Path const& temp = jd.outgoing; + Geom::Crossings cross = Geom::crossings(res, temp); + + if (cross.size() == 1) { + Geom::Path d1 = res.portion(0., cross[0].ta); + Geom::Path d2 = temp.portion(cross[0].tb, temp.size()); + + // Watch for bugs in 2geom crossing regarding severe inflection points + res.clear(); + res.append(d1); + res.setFinal(d2.initialPoint()); + res.append(d2); } else { - res.appendNew<Geom::LineSegment>(outgoing.initialPoint()); - res.append(outgoing); + res.appendNew<Geom::LineSegment>(temp.initialPoint()); + res.append(temp); + // add the rest of the path + res.insert(res.end(), ++jd.outgoing.begin(), jd.outgoing.end()); } - - // add the rest of the path - res.insert(res.end(), ++jd.outgoing.begin(), jd.outgoing.end()); } -void tangents(Geom::Point* tang, Geom::Curve const& incoming, Geom::Curve const& outgoing) +void tangents(Geom::Point tang[2], Geom::Curve const& incoming, Geom::Curve const& outgoing) { Geom::Point tang1 = Geom::unitTangentAt(reverse(incoming.toSBasis()), 0.); Geom::Point tang2 = outgoing.unitTangentAt(0.); |
