summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2012-03-24 21:52:32 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2012-03-24 21:52:32 +0000
commit1ea6b68442a7e0df11e12e74a3b2ffc15640a797 (patch)
treec3456dc34ad80c9cca9a596df10ce7d7e758b9a2 /src
parentpowerstroke: add Spiro rounded join! (genius idea Jasper!) (diff)
downloadinkscape-1ea6b68442a7e0df11e12e74a3b2ffc15640a797.tar.gz
inkscape-1ea6b68442a7e0df11e12e74a3b2ffc15640a797.zip
powerstroke: spiro join: more robust detection of tangent direction. fixes incorrect rounding for some paths.
(bzr r11129)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-powerstroke.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index 678b5cc67..d3843dc92 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -5,7 +5,7 @@
/* Authors:
* Johan Engelen <j.b.c.engelen@alumnus.utwente.nl>
*
- * Copyright (C) 2010-2011 Authors
+ * Copyright (C) 2010-2012 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -388,9 +388,13 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::SBasis>
Geom::Point tang1 = unitTangentAt(B[prev_i],1);
Geom::Point tang2 = unitTangentAt(B[i],0);
+ Geom::Point direction = B[i].at0() - B[prev_i].at1();
+ double tang1_sign = dot(direction,tang1);
+ double tang2_sign = dot(direction,tang2);
+
Spiro::spiro_cp *controlpoints = g_new (Spiro::spiro_cp, 4);
- controlpoints[0].x = (B[prev_i].at1() - sign*cusp.width*tang1)[Geom::X];
- controlpoints[0].y = (B[prev_i].at1() - sign*cusp.width*tang1)[Geom::Y];
+ controlpoints[0].x = (B[prev_i].at1() - tang1_sign*tang1)[Geom::X];
+ controlpoints[0].y = (B[prev_i].at1() - tang1_sign*tang1)[Geom::Y];
controlpoints[0].ty = '{';
controlpoints[1].x = B[prev_i].at1()[Geom::X];
controlpoints[1].y = B[prev_i].at1()[Geom::Y];
@@ -398,8 +402,8 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::SBasis>
controlpoints[2].x = B[i].at0()[Geom::X];
controlpoints[2].y = B[i].at0()[Geom::Y];
controlpoints[2].ty = '[';
- controlpoints[3].x = (B[i].at0() + sign*cusp.width*tang2)[Geom::X];
- controlpoints[3].y = (B[i].at0() + sign*cusp.width*tang2)[Geom::Y];
+ controlpoints[3].x = (B[i].at0() + tang2_sign*tang2)[Geom::X];
+ controlpoints[3].y = (B[i].at0() + tang2_sign*tang2)[Geom::Y];
controlpoints[3].ty = '}';
Geom::Path spiro;