Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrachytski <siarhei.rachytski@gmail.com>2011-10-08 19:55:50 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:25:39 +0300
commitc08a25cd6a99a73fe772493f5a97e3021d5676ae (patch)
treef7f7773303172b450dacfb75bc124a2bb827fc50 /geometry
parentfece0be4bae34ee7ebed23a11b650813ff94914b (diff)
added correct transformation of PathTextElements during rendering with non-identity Matrix.
Diffstat (limited to 'geometry')
-rw-r--r--geometry/angles.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/geometry/angles.hpp b/geometry/angles.hpp
index 8a53474d5f..ba0ed7bcd3 100644
--- a/geometry/angles.hpp
+++ b/geometry/angles.hpp
@@ -3,6 +3,7 @@
#include <cmath>
#include "point2d.hpp"
+#include "../base/matrix.hpp"
#include "../base/start_mem_debug.hpp"
namespace ang
@@ -36,11 +37,38 @@ namespace ang
{
return m_cos;
}
+
+ Angle<T> const & operator*=(math::Matrix<T, 3, 3> const & m)
+ {
+ m2::Point<T> pt0(0, 0);
+ m2::Point<T> pt1(m_cos, m_sin);
+
+ pt1 *= m;
+ pt0 *= m;
+
+ m_val = atan2(pt1.y - pt0.y, pt1.x - pt0.x);
+ m_sin = sin(m_val);
+ m_cos = cos(m_val);
+
+ return this;
+ }
};
typedef Angle<double> AngleD;
typedef Angle<float> AngleF;
+ template <typename T>
+ Angle<T> const operator*(Angle<T> const & a, math::Matrix<T, 3, 3> const & m)
+ {
+ m2::Point<T> pt0(0, 0);
+ m2::Point<T> pt1(a.cos(), a.sin());
+
+ pt1 *= m;
+ pt0 *= m;
+
+ return Angle<T>(atan2(pt1.y - pt0.y, pt1.x - pt0.x));
+ }
+
/// Returns an angle of vector [p1, p2] from x-axis directed to y-axis.
/// Angle is in range [-pi, pi].
template <typename T>