Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)

To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
This commit is contained in:
Konstantin Pastbin
2025-04-13 16:37:30 +07:00
commit e3e4a1985a
12931 changed files with 13195100 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
#include "testing/testing.hpp"
#include "geometry/line2d.hpp"
#include "geometry/point2d.hpp"
#include "geometry/segment2d.hpp"
namespace line2d_tests
{
using namespace m2;
double const kEps = 1e-12;
using Result = IntersectionResult;
using Type = Result::Type;
Result Intersect(Line2D const & lhs, Line2D const & rhs)
{
return Intersect(lhs, rhs, kEps);
}
UNIT_TEST(LineIntersection_Smoke)
{
{
Line2D const line(Segment2D(PointD(0, 0), PointD(1, 0)));
TEST_EQUAL(Intersect(line, line).m_type, Type::Infinity, ());
}
{
Line2D const lhs(Segment2D(PointD(0, 0), PointD(1, 1)));
Line2D const rhs(Segment2D(PointD(-10, -10), PointD(-100, -100)));
TEST_EQUAL(Intersect(lhs, rhs).m_type, Type::Infinity, ());
}
{
Line2D const lhs(Segment2D(PointD(0, 0), PointD(10, 10)));
Line2D const rhs(Segment2D(PointD(10, 11), PointD(0, 1)));
TEST_EQUAL(Intersect(lhs, rhs).m_type, Type::Zero, ());
}
{
Line2D const lhs(Segment2D(PointD(10, 0), PointD(9, 10)));
Line2D const rhs(Segment2D(PointD(-10, 0), PointD(-9, 10)));
auto const result = Intersect(lhs, rhs);
TEST_EQUAL(result.m_type, Type::One, ());
TEST(AlmostEqualAbs(result.m_point, PointD(0, 100), kEps), (result.m_point));
}
}
} // namespace line2d_tests