diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-09-01 18:13:15 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-09-02 16:40:15 +0300 |
commit | feda627f30fd97b62f904c43ca3c8f3f1e608ca0 (patch) | |
tree | 8dcc86ab477a17a74dd4014158c3d3dc8429c489 /geometry | |
parent | 4737649abe7a822453999dafa3563a5423833b84 (diff) |
Added tile-based model-view
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/screenbase.cpp | 21 | ||||
-rw-r--r-- | geometry/screenbase.hpp | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/geometry/screenbase.cpp b/geometry/screenbase.cpp index 32ba27b523..be334dbdf3 100644 --- a/geometry/screenbase.cpp +++ b/geometry/screenbase.cpp @@ -509,3 +509,24 @@ bool ScreenBase::IsReverseProjection3d(m2::PointD const & pt) const Vector3dT const perspectivePoint = normalizedPoint * m_Pto3d; return perspectivePoint(0, 3) < 0.0; } + +ScreenBase::Matrix3dT ScreenBase::GetModelView() const +{ + return ScreenBase::Matrix3dT { m_GtoP(0, 0), m_GtoP(1, 0), 0, m_GtoP(2, 0), + m_GtoP(0, 1), m_GtoP(1, 1), 0, m_GtoP(2, 1), + 0, 0, 1, 0, + 0, 0, 0, 1 }; +} + +ScreenBase::Matrix3dT ScreenBase::GetModelView(m2::PointD const & pivot, double scalar) const +{ + MatrixT const & m = m_GtoP; + double const s = 1.0 / scalar; + return ScreenBase::Matrix3dT + { + s * m(0, 0), s * m(1, 0), 0, m(2, 0) + pivot.x * m(0, 0) + pivot.y * m(1, 0), + s * m(0, 1), s * m(1, 1), 0, m(2, 1) + pivot.x * m(0, 1) + pivot.y * m(1, 1), + 0, 0, 1, 0, + 0, 0, 0, 1 + }; +} diff --git a/geometry/screenbase.hpp b/geometry/screenbase.hpp index 5094eabc8f..c0d462a90f 100644 --- a/geometry/screenbase.hpp +++ b/geometry/screenbase.hpp @@ -165,6 +165,9 @@ public: m2::RectD CalculatePixelRect(double scale) const; double CalculatePerspectiveAngle(double scale) const; + Matrix3dT GetModelView() const; + Matrix3dT GetModelView(m2::PointD const & pivot, double scalar) const; + static double CalculateAutoPerspectiveAngle(double scale); /// Compute arbitrary pixel transformation, that translates the (oldPt1, oldPt2) -> (newPt1, newPt2) |