diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-07-24 23:26:11 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-07-24 23:26:11 +0000 |
| commit | 7b6ffd82650ee1e20a53b0631d5c2dddef58e8d5 (patch) | |
| tree | 48cae26bf789b11d79f72efc16a6676f960eaaa6 /src/2geom/transforms.cpp | |
| parent | update to trunk (diff) | |
| parent | 3D box tool: the shift key must not prevent snapping of the vanishing point. ... (diff) | |
| download | inkscape-7b6ffd82650ee1e20a53b0631d5c2dddef58e8d5.tar.gz inkscape-7b6ffd82650ee1e20a53b0631d5c2dddef58e8d5.zip | |
update to trunk
(bzr r12588.1.45)
Diffstat (limited to 'src/2geom/transforms.cpp')
| -rw-r--r-- | src/2geom/transforms.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/2geom/transforms.cpp b/src/2geom/transforms.cpp index 091079d5a..41d395297 100644 --- a/src/2geom/transforms.cpp +++ b/src/2geom/transforms.cpp @@ -139,6 +139,24 @@ Affine &Affine::operator*=(Zoom const &z) { return *this; } +Affine Rotate::around(Point const &p, Coord angle) +{ + Affine result = Translate(-p) * Rotate(angle) * Translate(p); + return result; +} + +Affine reflection(Point const & vector, Point const & origin) +{ + Geom::Point vn = unit_vector(vector); + Coord cx2 = vn[X] * vn[X]; + Coord cy2 = vn[Y] * vn[Y]; + Coord c2xy = 2 * vn[X] * vn[Y]; + Affine mirror ( cx2 - cy2, c2xy, + c2xy, cy2 - cx2, + 0, 0 ); + return Translate(-origin) * mirror * Translate(origin); +} + // this checks whether the requirements of TransformConcept are satisfied for all transforms. // if you add a new transform type, include it here! void check_transforms() @@ -173,14 +191,6 @@ 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 /* |
