summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2014-08-23 17:14:02 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2014-08-23 17:14:02 +0000
commit9b86de418e536b38bdf0d95e75413d57fd8f76b5 (patch)
tree1a25fef3f21e11770175173044e048e9f3a0924c /src
parentadd missing files from last commit (diff)
downloadinkscape-9b86de418e536b38bdf0d95e75413d57fd8f76b5.tar.gz
inkscape-9b86de418e536b38bdf0d95e75413d57fd8f76b5.zip
properly attribute code
(bzr r13341.1.158)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-powerstroke-interpolators.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/live_effects/lpe-powerstroke-interpolators.h b/src/live_effects/lpe-powerstroke-interpolators.h
index f08259eb3..986bd3544 100644
--- a/src/live_effects/lpe-powerstroke-interpolators.h
+++ b/src/live_effects/lpe-powerstroke-interpolators.h
@@ -203,11 +203,18 @@ private:
CubicBezier calc_bezier(Point p0, Point p1, Point p2, Point p3) const {
// create interpolating bezier between p1 and p2
+ // Part of the code comes from StackOverflow user eriatarka84
+ // http://stackoverflow.com/a/23980479/2929337
+
// calculate time coords (deltas) of points
+ // the factor 0.25 can be generalized for other Catmull-Rom interpolation types
+ // see alpha in Yuksel et al. "On the Parameterization of Catmull-Rom Curves",
+ // --> http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf
double dt0 = powf(distanceSq(p0, p1), 0.25);
double dt1 = powf(distanceSq(p1, p2), 0.25);
double dt2 = powf(distanceSq(p2, p3), 0.25);
+
// safety check for repeated points
double eps = Geom::EPSILON;
if (dt1 < eps)