Removed unused code.

This commit is contained in:
Daria Volvenkova 2016-05-12 16:04:02 +03:00
parent 0359fd1c86
commit 3c232e8767
4 changed files with 0 additions and 128 deletions

View file

@ -16,16 +16,6 @@ m2::PointD InterpolatePoint(m2::PointD const & startPt, m2::PointD const & endPt
return startPt + diff * t;
}
m2::RectD InterpolateRect(m2::RectD const & startRect, m2::RectD const & endRect, double t)
{
m2::PointD center = InterpolatePoint(startRect.Center(), endRect.Center(), t);
double halfSizeX = 0.5 * InterpolateDouble(startRect.SizeX(), endRect.SizeX(), t);
double halfSizeY = 0.5 * InterpolateDouble(startRect.SizeY(), endRect.SizeY(), t);
return m2::RectD(center.x - halfSizeX, center.y - halfSizeY,
center.x + halfSizeX, center.y + halfSizeY);
}
InerpolateAngle::InerpolateAngle(double startAngle, double endAngle)
{
m_startAngle = ang::AngleIn2PI(startAngle);
@ -37,22 +27,4 @@ double InerpolateAngle::Interpolate(double t) const
return m_startAngle + m_delta * t;
}
InterpolateAnyRect::InterpolateAnyRect(m2::AnyRectD const & startRect, m2::AnyRectD const & endRect)
: m_startZero(startRect.GlobalZero())
, m_endZero(endRect.GlobalZero())
, m_angleInterpolator(startRect.Angle().val(), endRect.Angle().val())
, m_startRect(startRect.GetLocalRect())
, m_endRect(endRect.GetLocalRect())
{
}
m2::AnyRectD InterpolateAnyRect::Interpolate(double t) const
{
double angle = m_angleInterpolator.Interpolate(t);
m2::PointD zero = InterpolatePoint(m_startZero, m_endZero, t);
m2::RectD rect = InterpolateRect(m_startRect, m_endRect, t);
return m2::AnyRectD(zero, angle, rect);
}
} // namespace df

View file

@ -9,7 +9,6 @@ namespace df
double InterpolateDouble(double startV, double endV, double t);
m2::PointD InterpolatePoint(m2::PointD const & startPt, m2::PointD const & endPt, double t);
m2::RectD InterpolateRect(m2::RectD const & startRect, m2::RectD const & endRect, double t);
class InerpolateAngle
{
@ -22,16 +21,4 @@ private:
double m_delta;
};
class InterpolateAnyRect
{
public:
InterpolateAnyRect(m2::AnyRectD const & startRect, m2::AnyRectD const & endRect);
m2::AnyRectD Interpolate(double t) const;
private:
m2::PointD m_startZero, m_endZero;
InerpolateAngle m_angleInterpolator;
m2::RectD m_startRect, m_endRect;
};
} // namespace df

View file

@ -1,86 +0,0 @@
#include "testing/testing.hpp"
#include "drape_frontend/animation/interpolations.hpp"
namespace
{
void IsEqual(m2::AnyRectD const & r1, m2::AnyRectD const & r2)
{
TEST(r1.LocalZero().EqualDxDy(r2.LocalZero(), 0.00001), ());
TEST_ALMOST_EQUAL_ULPS(ang::AngleIn2PI(r1.Angle().val()), ang::AngleIn2PI(r2.Angle().val()), ());
m2::RectD lR1 = r1.GetLocalRect();
m2::RectD lR2 = r2.GetLocalRect();
TEST_ALMOST_EQUAL_ULPS(lR1.minX(), lR2.minX(), ());
TEST_ALMOST_EQUAL_ULPS(lR1.minY(), lR2.minY(), ());
TEST_ALMOST_EQUAL_ULPS(lR1.maxX(), lR2.maxX(), ());
TEST_ALMOST_EQUAL_ULPS(lR1.maxY(), lR2.maxY(), ());
}
}
UNIT_TEST(MoveRectTest)
{
double const halfSizeX = 0.5;
double const halfSizeY = 0.5;
double const angle = 0.0;
m2::RectD const sizeRect(-halfSizeX, -halfSizeY, halfSizeX, halfSizeY);
m2::AnyRectD src(m2::PointD(27.0, 30.0), angle, sizeRect);
m2::AnyRectD dst(m2::PointD(28.0, 31.0), angle, sizeRect);
df::InterpolateAnyRect inter(src, dst);
IsEqual(src, inter.Interpolate(0.0));
IsEqual(m2::AnyRectD(m2::PointD(27.5, 30.5), angle, sizeRect), inter.Interpolate(0.5));
IsEqual(dst, inter.Interpolate(1.0));
}
UNIT_TEST(RotateRectTest)
{
double const halfSizeX = 0.5;
double const halfSizeY = 0.5;
m2::PointD zero(27.0, 30.0);
m2::RectD const sizeRect(-halfSizeX, -halfSizeY, halfSizeX, halfSizeY);
{
m2::AnyRectD src(zero, 0.0, sizeRect);
m2::AnyRectD dst(zero, math::pi2, sizeRect);
df::InterpolateAnyRect inter(src, dst);
IsEqual(src, inter.Interpolate(0.0));
IsEqual(m2::AnyRectD(zero, math::pi4, sizeRect), inter.Interpolate(0.5));
IsEqual(dst, inter.Interpolate(1.0));
}
{
m2::AnyRectD src(zero, math::pi + math::pi2, sizeRect);
m2::AnyRectD dst(zero, 0.0, sizeRect);
df::InterpolateAnyRect inter(src, dst);
IsEqual(src, inter.Interpolate(0.0));
IsEqual(m2::AnyRectD(zero, math::pi + math::pi2 + math::pi4, sizeRect), inter.Interpolate(0.5));
IsEqual(dst, inter.Interpolate(1.0));
}
}
UNIT_TEST(ScaleRectTest)
{
m2::PointD zero(27.0, 30.0);
double const angle = 0.0;
m2::AnyRectD src(zero, angle, m2::RectD(-0.5, -0.5, 0.5, 0.5));
m2::AnyRectD dst(zero, angle, m2::RectD(-2.0, -2.0, 2.0, 2.0));
df::InterpolateAnyRect inter(src, dst);
IsEqual(src, inter.Interpolate(0.0));
IsEqual(m2::AnyRectD(zero, angle, m2::RectD(-1.25, -1.25, 1.25, 1.25)), inter.Interpolate(0.5));
IsEqual(dst, inter.Interpolate(1.0));
}
UNIT_TEST(RectInterpolateTest)
{
m2::AnyRectD src(m2::PointD(27.0, 36.0), math::pi2, m2::RectD(-1.0, -1.0, 1.0, 1.0));
m2::AnyRectD dst(m2::PointD(29.0, 30.0), math::pi, m2::RectD(-0.5, -0.5, 0.5, 0.5));
df::InterpolateAnyRect inter(src, dst);
IsEqual(src, inter.Interpolate(0.0));
m2::AnyRectD res(m2::PointD(28.0, 33.0), math::pi2 + math::pi4, m2::RectD(-0.75, -0.75, 0.75, 0.75));
IsEqual(res, inter.Interpolate(0.5));
IsEqual(dst, inter.Interpolate(1.0));
}

View file

@ -18,7 +18,6 @@ macx-* {
SOURCES += \
../../testing/testingmain.cpp \
anyrect_interpolation_tests.cpp \
navigator_test.cpp \
object_pool_tests.cpp \
user_event_stream_tests.cpp \