diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2015-07-04 16:15:46 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2015-07-04 16:15:46 +0000 |
| commit | 1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8 (patch) | |
| tree | a91517f9165322b4e42c6cdeb4263beaedc4d02f /src/2geom/transforms.h | |
| parent | Packaging. New Win32 installer Danish translation. (diff) | |
| parent | Upgrade to 2Geom r2413 (diff) | |
| download | inkscape-1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8.tar.gz inkscape-1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8.zip | |
Sync 2Geom to revision 2413.
May introduce regressions.
(bzr r14226)
Diffstat (limited to 'src/2geom/transforms.h')
| -rw-r--r-- | src/2geom/transforms.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/2geom/transforms.h b/src/2geom/transforms.h index 7f5635747..de4e6871f 100644 --- a/src/2geom/transforms.h +++ b/src/2geom/transforms.h @@ -40,6 +40,7 @@ #include <2geom/forward.h> #include <2geom/affine.h> #include <2geom/angle.h> +#include <boost/concept/assert.hpp> namespace Geom { @@ -95,6 +96,7 @@ public: * @ingroup Transforms */ template <typename T> T pow(T const &t, int n) { + BOOST_CONCEPT_ASSERT((TransformConcept<T>)); if (n == 0) return T::identity(); T result(T::identity()); T x(n < 0 ? t.inverse() : t); @@ -199,6 +201,7 @@ public: /** @brief Get the characteristic vector of the rotation. * @return A vector that would be obtained by applying this transform to the X versor. */ Point vector() const { return vec; } + Coord angle() const { return atan2(vec); } Coord operator[](Dim2 dim) const { return vec[dim]; } Coord operator[](unsigned dim) const { return vec[dim]; } Rotate &operator*=(Rotate const &o) { vec *= o; return *this; } @@ -216,6 +219,7 @@ public: Coord rad = (deg / 180.0) * M_PI; return Rotate(rad); } + static Affine around(Point const &p, Coord angle); friend class Point; }; @@ -343,6 +347,8 @@ inline Translate pow(Translate const &t, int n) { /** @brief Reflects objects about line. * The line, defined by a vector along the line and a point on it, acts as a mirror. + * @ingroup Transforms + * @see Line::reflection() */ Affine reflection(Point const & vector, Point const & origin); |
