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:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2016-01-29 14:06:10 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:20:41 +0300
commitf4de5841f7bbfa1773ecd824d366a8bea49515a9 (patch)
tree16ee18c3f36b549e15fbf25c3e2cdfb2b5628b00 /geometry
parent2317f55b5a9460654f0916f6b85d7fa23837d3be (diff)
Improved displacement algorithm and overlays rendering
Diffstat (limited to 'geometry')
-rw-r--r--geometry/screenbase.cpp12
-rw-r--r--geometry/screenbase.hpp2
2 files changed, 14 insertions, 0 deletions
diff --git a/geometry/screenbase.cpp b/geometry/screenbase.cpp
index c00f882b86..b46a6da78c 100644
--- a/geometry/screenbase.cpp
+++ b/geometry/screenbase.cpp
@@ -411,3 +411,15 @@ m2::PointD ScreenBase::P3dtoP(m2::PointD const & pt) const
return pixelPointOriginal;
}
+
+bool ScreenBase::IsReverseProjection3d(m2::PointD const & pt) const
+{
+ if (!m_isPerspective)
+ return false;
+
+ Vector3dT const normalizedPoint{float(2.0 * pt.x / m_PixelRect.SizeX() - 1.0),
+ -float(2.0 * pt.y / m_PixelRect.SizeY() - 1.0), 0.0, 1.0};
+
+ Vector3dT const perspectivePoint = normalizedPoint * m_Pto3d;
+ return perspectivePoint(0, 3) < 0.0;
+}
diff --git a/geometry/screenbase.hpp b/geometry/screenbase.hpp
index 016feab973..93959d9998 100644
--- a/geometry/screenbase.hpp
+++ b/geometry/screenbase.hpp
@@ -139,6 +139,8 @@ public:
Matrix3dT const & Pto3dMatrix() const { return m_Pto3d; }
bool isPerspective() const { return m_isPerspective; }
+ bool IsReverseProjection3d(m2::PointD const & pt) const;
+
m2::PointD PtoP3d(m2::PointD const & pt) const;
m2::PointD PtoP3d(m2::PointD const & pt, double ptZ) const;