diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2012-02-26 21:59:20 +0000 |
|---|---|---|
| committer | Johan Engelen <goejendaagh@zonnet.nl> | 2012-02-26 21:59:20 +0000 |
| commit | 7fa31d75591543f64cb70b73f19533d5b7f35dba (patch) | |
| tree | 737f5efabbb21c605bdf818530227cb3d3de9dc4 /src/2geom | |
| parent | Import deprecated GtkRuler API. Probably worth tidying :-) (diff) | |
| download | inkscape-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')
| -rw-r--r-- | src/2geom/transforms.cpp | 11 | ||||
| -rw-r--r-- | src/2geom/transforms.h | 11 |
2 files changed, 19 insertions, 3 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++ diff --git a/src/2geom/transforms.h b/src/2geom/transforms.h index eaf869056..869e955c7 100644 --- a/src/2geom/transforms.h +++ b/src/2geom/transforms.h @@ -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 @@ -280,7 +281,7 @@ inline bool are_near(VShear const &a, VShear const &b, Coord eps=EPSILON) { * The translation part is applied first, then the result is scaled from the new origin. * This way when the class is used to accumulate a zoom transform, trans always points * to the new origin in original coordinates. - * @ingroup Transform */ + * @ingroup Transforms */ class Zoom : public TransformOperations< Zoom > { @@ -338,6 +339,12 @@ inline Translate pow(Translate const &t, int n) { return ret; } + +/** @brief Reflects objects about line. + * The line, defined by a vector along the line and a point on it, acts as a mirror. + */ +Affine reflection(Point const & vector, Point const & origin); + //TODO: decomposition of Affine into some finite combination of the above classes } // end namespace Geom |
