diff options
author | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2015-11-15 19:21:14 +0300 |
---|---|---|
committer | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2015-12-29 16:36:04 +0300 |
commit | 6dff719947501d1f709cc9e28c456f03082ef0ad (patch) | |
tree | 7446bf71f1ac9fcafc4b77193f79da8d84e7741f /geometry | |
parent | c4098b058ca713838de19b68e63273b18c23f3fd (diff) |
Review fixes.
Conflicts:
drape_frontend/frontend_renderer.cpp
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/screenbase.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/geometry/screenbase.cpp b/geometry/screenbase.cpp index e365641683..2ef6edacd8 100644 --- a/geometry/screenbase.cpp +++ b/geometry/screenbase.cpp @@ -259,7 +259,11 @@ void ScreenBase::ExtractGtoPParams(MatrixT const & m, // when it is rotated through maxRotationAngle around its near horizontal side. void ScreenBase::ApplyPerspective(double currentRotationAngle, double maxRotationAngle, double angleFOV) { - ASSERT_NOT_EQUAL(angleFOV, 0.0, ()); + ASSERT_GREATER(angleFOV, 0.0, ()); + ASSERT_LESS(angleFOV, math::pi2, ()); + ASSERT_GREATER_OR_EQUAL(maxRotationAngle, 0.0, ()); + ASSERT_LESS(maxRotationAngle, math::pi2, ()); + if (m_isPerspective) ResetPerspective(); @@ -279,13 +283,9 @@ void ScreenBase::ApplyPerspective(double currentRotationAngle, double maxRotatio double const dy = m_PixelRect.SizeY() * (m_3dScaleX - 1.0); - Scale(1.0 / m_3dScaleX); - m_PixelRect.setMaxX(m_PixelRect.maxX() * m_3dScaleX); m_PixelRect.setMaxY(m_PixelRect.maxY() * m_3dScaleY); - Scale(m_3dScaleX); - Move(0.0, dy / 2.0); SetRotationAngle(currentRotationAngle); @@ -296,6 +296,7 @@ void ScreenBase::ApplyPerspective(double currentRotationAngle, double maxRotatio void ScreenBase::SetRotationAngle(double rotationAngle) { ASSERT(m_isPerspective, ()); + ASSERT_GREATER_OR_EQUAL(rotationAngle, 0.0, ()); ASSERT_LESS_OR_EQUAL(rotationAngle, m_3dMaxAngleX, ()); if (rotationAngle > m_3dMaxAngleX) @@ -342,13 +343,10 @@ void ScreenBase::ResetPerspective() m_isPerspective = false; double const dy = m_PixelRect.SizeY() * (1.0 - 1.0 / m_3dScaleX); - Scale(m_3dScaleX); m_PixelRect.setMaxX(m_PixelRect.maxX() / m_3dScaleX); m_PixelRect.setMaxY(m_PixelRect.maxY() / m_3dScaleY); - Scale(1.0 / m_3dScaleX); - Move(0, -dy / 2.0); m_3dScaleX = m_3dScaleY = 1.0; @@ -392,7 +390,7 @@ m2::PointD ScreenBase::P3dToP(m2::PointD const & pt) const double const a = (m_3dFarZ + m_3dNearZ) / (m_3dFarZ - m_3dNearZ); double const b = -2.0 * m_3dFarZ * m_3dNearZ / (m_3dFarZ - m_3dNearZ); - normalizedZ = (a * cameraDistanceZ + b) / cameraDistanceZ; + normalizedZ = a + b / cameraDistanceZ; } Vector3dT const normalizedPoint{normalizedX, normalizedY, normalizedZ, 1.0}; |