mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-06 12:34:24 +00:00
committed by
Konstantin Pastbin
parent
7781528263
commit
836c39ff64
@@ -1,12 +1,10 @@
|
||||
#include "geometry/geometry_tests/equality.hpp"
|
||||
|
||||
#include "base/math.hpp"
|
||||
#include "geometry/screenbase.hpp"
|
||||
#include "geometry/transformations.hpp"
|
||||
|
||||
#include "testing/testing.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace screen_test
|
||||
{
|
||||
using test::is_equal;
|
||||
@@ -23,10 +21,10 @@ static void check_set_from_rect(ScreenBase & screen, int width, int height)
|
||||
b2 = screen.GtoP(b2);
|
||||
|
||||
// check that we are in boundaries.
|
||||
TEST(math::Between(0, width, static_cast<int>(std::lround(b1.x))), ());
|
||||
TEST(math::Between(0, width, static_cast<int>(std::lround(b2.x))), ());
|
||||
TEST(math::Between(0, height, static_cast<int>(std::lround(b1.y))), ());
|
||||
TEST(math::Between(0, height, static_cast<int>(std::lround(b2.y))), ());
|
||||
TEST(math::Between(0, width, math::iround(b1.x)), ());
|
||||
TEST(math::Between(0, width, math::iround(b2.x)), ());
|
||||
TEST(math::Between(0, height, math::iround(b1.y)), ());
|
||||
TEST(math::Between(0, height, math::iround(b2.y)), ());
|
||||
}
|
||||
|
||||
UNIT_TEST(ScreenBase_P2G2P)
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include "geometry/transformations.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include "base/math.hpp"
|
||||
|
||||
double constexpr kPerspectiveAngleFOV = math::pi / 3.0;
|
||||
double constexpr kMaxPerspectiveAngle1 = math::pi4;
|
||||
@@ -230,12 +229,12 @@ void ScreenBase::SetAngle(double angle)
|
||||
|
||||
int ScreenBase::GetWidth() const
|
||||
{
|
||||
return static_cast<int>(std::lround(m_PixelRect.SizeX()));
|
||||
return math::iround(m_PixelRect.SizeX());
|
||||
}
|
||||
|
||||
int ScreenBase::GetHeight() const
|
||||
{
|
||||
return static_cast<int>(std::lround(m_PixelRect.SizeY()));
|
||||
return math::iround(m_PixelRect.SizeY());
|
||||
}
|
||||
|
||||
ScreenBase::MatrixT ScreenBase::CalcTransform(m2::PointD const & oldPt1, m2::PointD const & oldPt2,
|
||||
|
||||
Reference in New Issue
Block a user