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:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2014-12-16 10:35:19 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:34:58 +0300
commit28c8f64c689ccf34f67f41bccda2878bce374b96 (patch)
tree90dee19d70a8e45438a3e6e14c4a2dc250086044 /geometry/angles.hpp
parent7d37e2c812a5fe288cdb91f69711beb5ed4a8c35 (diff)
Taking into account all outgoing edges for a turn generation.
Diffstat (limited to 'geometry/angles.hpp')
-rw-r--r--geometry/angles.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/geometry/angles.hpp b/geometry/angles.hpp
index 9249fa9813..0d218ea6d7 100644
--- a/geometry/angles.hpp
+++ b/geometry/angles.hpp
@@ -76,6 +76,17 @@ namespace ang
return atan2(p2.y - p1.y, p2.x - p1.x);
}
+ /// Returns an angle from vector [p, p1] to vector [p, p2]. A counterclockwise rotation.
+ /// Angle is in range [0, 2 * pi]
+ template <typename T>
+ inline T TwoVectorsAngle(m2::Point<T> const & p, m2::Point<T> const & p1, m2::Point<T> const & p2)
+ {
+ T a = ang::AngleTo(p, p2) - ang::AngleTo(p, p1);
+ while (a < 0)
+ a += math::twicePi;
+ return a;
+ }
+
double AngleIn2PI(double ang);
/// @return Oriented angle (<= PI) from rad1 to rad2.