summaryrefslogtreecommitdiffstats
path: root/src/helper
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2015-03-29 02:20:44 +0000
committerLiam P. White <inkscapebrony@gmail.com>2015-03-29 02:20:44 +0000
commitee2b444706c7fd17c381d4c330185e02fc6d3ec9 (patch)
tree5e53958f16cf096cd50f850a1005510fe09b48c4 /src/helper
parentFix calculation of miter limit. Implement 'miter-clip' line join. (diff)
downloadinkscape-ee2b444706c7fd17c381d4c330185e02fc6d3ec9.tar.gz
inkscape-ee2b444706c7fd17c381d4c330185e02fc6d3ec9.zip
clean up previous commit
(bzr r14034)
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/geom-pathstroke.cpp33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/helper/geom-pathstroke.cpp b/src/helper/geom-pathstroke.cpp
index 1908f2db7..e34546d0e 100644
--- a/src/helper/geom-pathstroke.cpp
+++ b/src/helper/geom-pathstroke.cpp
@@ -159,6 +159,7 @@ void miter_join_internal(Geom::Path& res, Geom::Curve const& outgoing, double mi
Geom::Point p = Geom::intersection_point(incoming.finalPoint(), tang1, outgoing.initialPoint(), tang2);
bool satisfied = false;
+ bool inc_ls = res.back_open().degreesOfFreedom() <= 4;
if (p.isFinite()) {
// check size of miter
@@ -166,32 +167,20 @@ void miter_join_internal(Geom::Path& res, Geom::Curve const& outgoing, double mi
satisfied = Geom::distance(p, point_on_path) <= miter * 2.0 * width;
if (satisfied) {
// miter OK, check to see if we can do a relocation
- bool ls = res.back_open().degreesOfFreedom() <= 4;
- if (ls) {
+ if (inc_ls) {
res.setFinal(p);
} else {
res.appendNew<Geom::LineSegment>(p);
}
} else if (clip) {
// miter needs clipping, find two points
- Geom::Line bisector(point_on_path, p);
- Geom::Point point_limit = point_on_path + miter * 2.0 * width * bisector.versor();
+ Geom::Point bisector_versor = Geom::Line(point_on_path, p).versor();
+ Geom::Point point_limit = point_on_path + miter * 2.0 * width * bisector_versor;
- Geom::Line line_limit =
- Geom::Line::from_origin_and_versor( point_limit, bisector.versor().cw() );
+ Geom::Point p1 = Geom::intersection_point(incoming.finalPoint(), tang1, point_limit, bisector_versor.cw());
+ Geom::Point p2 = Geom::intersection_point(outgoing.initialPoint(), tang2, point_limit, bisector_versor.cw());
- Geom::Line incoming_line( incoming.finalPoint(), p );
- Geom::Line outgoing_line( p, outgoing.initialPoint() );
-
- Geom::OptCrossing i1 = intersection( line_limit, incoming_line );
- Geom::OptCrossing i2 = intersection( line_limit, outgoing_line );
-
- // It would be nice to have a simple point returned by intersection!
- Geom::Point p1 = line_limit.pointAt( (*i1).ta );
- Geom::Point p2 = line_limit.pointAt( (*i2).ta );
-
- bool ls = res.back_open().degreesOfFreedom() <= 4;
- if (ls) {
+ if (inc_ls) {
res.setFinal(p1);
} else {
res.appendNew<Geom::LineSegment>(p1);
@@ -203,9 +192,9 @@ void miter_join_internal(Geom::Path& res, Geom::Curve const& outgoing, double mi
res.appendNew<Geom::LineSegment>(outgoing.initialPoint());
// check if we can do another relocation
- bool ls = outgoing.degreesOfFreedom() <= 4;
+ bool out_ls = outgoing.degreesOfFreedom() <= 4;
- if ( (satisfied || clip) && ls) {
+ if ( (satisfied || clip) && out_ls) {
res.setFinal(outgoing.finalPoint());
} else {
res.append(outgoing);
@@ -337,11 +326,7 @@ void outline_helper(Geom::Path& res, Geom::Path const& to_add, double width, dou
Geom::Point tang1 = Geom::unitTangentAt(reverse(res.back().toSBasis()), 0.);
Geom::Point tang2 = Geom::unitTangentAt(to_add.front().toSBasis(), 0.);
- // Geom::Point discontinuity_vec = to_add.initialPoint() - res.finalPoint();
bool on_outside = (Geom::cross(tang1, tang2) < 0);
- // std::cout << std::fixed << std::setprecision(3)
- // << " in: " << tang1 << " out: " << tang2
- // << " side: " << (on_outside?"inside":"outside") << std::endl;
if (on_outside) {
join_func *jf;