mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -28,27 +28,23 @@ enum CellObjectIntersection
|
||||
};
|
||||
|
||||
template <class CellId>
|
||||
CellObjectIntersection IntersectCellWithLine(CellId const cell, m2::PointD const & a,
|
||||
m2::PointD const & b)
|
||||
CellObjectIntersection IntersectCellWithLine(CellId const cell, m2::PointD const & a, m2::PointD const & b)
|
||||
{
|
||||
std::pair<uint32_t, uint32_t> const xy = cell.XY();
|
||||
uint32_t const r = cell.Radius();
|
||||
m2::PointD const cellCorners[4] = {
|
||||
m2::PointD(xy.first - r, xy.second - r), m2::PointD(xy.first - r, xy.second + r),
|
||||
m2::PointD(xy.first + r, xy.second + r), m2::PointD(xy.first + r, xy.second - r)};
|
||||
m2::PointD const cellCorners[4] = {m2::PointD(xy.first - r, xy.second - r), m2::PointD(xy.first - r, xy.second + r),
|
||||
m2::PointD(xy.first + r, xy.second + r), m2::PointD(xy.first + r, xy.second - r)};
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (m2::SegmentsIntersect(a, b, cellCorners[i], cellCorners[i == 0 ? 3 : i - 1]))
|
||||
return CELL_OBJECT_INTERSECT;
|
||||
}
|
||||
if (xy.first - r <= a.x && a.x <= xy.first + r && xy.second - r <= a.y && a.y <= xy.second + r)
|
||||
return OBJECT_INSIDE_CELL;
|
||||
return CELL_OBJECT_NO_INTERSECTION;
|
||||
}
|
||||
|
||||
template <class CellId>
|
||||
CellObjectIntersection IntersectCellWithTriangle(CellId const cell, m2::PointD const & a,
|
||||
m2::PointD const & b, m2::PointD const & c)
|
||||
CellObjectIntersection IntersectCellWithTriangle(CellId const cell, m2::PointD const & a, m2::PointD const & b,
|
||||
m2::PointD const & c)
|
||||
{
|
||||
CellObjectIntersection const i1 = IntersectCellWithLine(cell, a, b);
|
||||
if (i1 == CELL_OBJECT_INTERSECT)
|
||||
@@ -75,8 +71,8 @@ CellObjectIntersection IntersectCellWithTriangle(CellId const cell, m2::PointD c
|
||||
}
|
||||
|
||||
template <class CellId, class CellIdContainerT, typename IntersectF>
|
||||
void CoverObject(IntersectF const & intersect, uint64_t cellPenaltyArea, CellIdContainerT & out,
|
||||
int cellDepth, CellId cell)
|
||||
void CoverObject(IntersectF const & intersect, uint64_t cellPenaltyArea, CellIdContainerT & out, int cellDepth,
|
||||
CellId cell)
|
||||
{
|
||||
if (cell.Level() == cellDepth - 1)
|
||||
{
|
||||
@@ -107,13 +103,9 @@ void CoverObject(IntersectF const & intersect, uint64_t cellPenaltyArea, CellIdC
|
||||
|
||||
// This criteria is more clear for me. Let's divide if we can save more than cellPenaltyArea.
|
||||
if (subdiv.size() > 1 && cellPenaltyArea >= cellArea - subdivArea)
|
||||
{
|
||||
out.push_back(cell);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < subdiv.size(); ++i)
|
||||
out.push_back(subdiv[i]);
|
||||
}
|
||||
}
|
||||
} // namespace covering
|
||||
|
||||
Reference in New Issue
Block a user