summaryrefslogtreecommitdiffstats
path: root/src/2geom/transforms.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2012-02-26 21:59:20 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2012-02-26 21:59:20 +0000
commit7fa31d75591543f64cb70b73f19533d5b7f35dba (patch)
tree737f5efabbb21c605bdf818530227cb3d3de9dc4 /src/2geom/transforms.cpp
parentImport deprecated GtkRuler API. Probably worth tidying :-) (diff)
downloadinkscape-7fa31d75591543f64cb70b73f19533d5b7f35dba.tar.gz
inkscape-7fa31d75591543f64cb70b73f19533d5b7f35dba.zip
powerstroke: work on cusps, so people can play with it a bit. it is not done yet ! so may change in future...
(partial update to latest 2geom, for reflection transform) (bzr r11024)
Diffstat (limited to 'src/2geom/transforms.cpp')
-rw-r--r--src/2geom/transforms.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/2geom/transforms.cpp b/src/2geom/transforms.cpp
index b8355cadc..65df9b22f 100644
--- a/src/2geom/transforms.cpp
+++ b/src/2geom/transforms.cpp
@@ -5,8 +5,9 @@
* Authors:
* ? <?@?.?>
* Krzysztof KosiƄski <tweenk.pl@gmail.com>
+ * Johan Engelen
*
- * Copyright ?-2009 Authors
+ * Copyright ?-2012 Authors
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
@@ -171,8 +172,16 @@ void check_transforms()
m = z * t; m = z * s; m = z * r; m = z * h; m = z * v; m = z * z;
}
+Affine reflection(Point const & vector, Point const & origin) {
+ Geom::Point vec_norm = unit_vector(vector);
+ Affine mirror ( vec_norm[X]*vec_norm[X] - vec_norm[Y]*vec_norm[Y], 2 * vec_norm[X] * vec_norm[Y] ,
+ 2 * vec_norm[X] * vec_norm[Y], vec_norm[Y]*vec_norm[Y] - vec_norm[X]*vec_norm[X] ,
+ 0 ,0 );
+ return Translate(-origin) * mirror * Translate(origin);
}
+} // namespace Geom
+
/*
Local Variables:
mode:c++