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

42
geometry/convex_hull.hpp Normal file
View File

@@ -0,0 +1,42 @@
#pragma once
#include "geometry/point2d.hpp"
#include "geometry/segment2d.hpp"
#include "base/assert.hpp"
#include <vector>
namespace m2
{
class ConvexHull
{
public:
// Builds a convex hull around |points|. The hull polygon points are
// listed in the order of a counterclockwise traversal with no three
// points lying on the same straight line.
//
// Complexity: O(n * log(n)), where n is the number of points.
ConvexHull(std::vector<PointD> const & points, double eps);
size_t Size() const { return m_hull.size(); }
bool Empty() const { return m_hull.empty(); }
PointD const & PointAt(size_t i) const
{
ASSERT(!Empty(), ());
return m_hull[i % Size()];
}
Segment2D SegmentAt(size_t i) const
{
ASSERT_GREATER_OR_EQUAL(Size(), 2, ());
return Segment2D(PointAt(i), PointAt(i + 1));
}
std::vector<PointD> const & Points() const { return m_hull; }
private:
std::vector<PointD> m_hull;
};
} // namespace m2