mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-21 05:43:37 +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:
@@ -52,8 +52,7 @@ void SimplifyDP(Iter first, Iter last, double epsilon, DistanceFn & distFn, Out
|
||||
struct SimplifyOptimalRes
|
||||
{
|
||||
SimplifyOptimalRes() = default;
|
||||
SimplifyOptimalRes(int32_t nextPoint, uint32_t pointCount)
|
||||
: m_NextPoint(nextPoint), m_PointCount(pointCount) {}
|
||||
SimplifyOptimalRes(int32_t nextPoint, uint32_t pointCount) : m_NextPoint(nextPoint), m_PointCount(pointCount) {}
|
||||
|
||||
int32_t m_NextPoint = -1;
|
||||
uint32_t m_PointCount = -1U;
|
||||
@@ -80,8 +79,7 @@ void SimplifyDP(Iter beg, Iter end, double epsilon, DistanceFn distFn, Out out)
|
||||
// Essentially, it's a trade-off between optimality and performance.
|
||||
// Values around 20 - 200 are reasonable.
|
||||
template <typename DistanceFn, typename Iter, typename Out>
|
||||
void SimplifyNearOptimal(int maxFalseLookAhead, Iter beg, Iter end, double epsilon,
|
||||
DistanceFn distFn, Out out)
|
||||
void SimplifyNearOptimal(int maxFalseLookAhead, Iter beg, Iter end, double epsilon, DistanceFn distFn, Out out)
|
||||
{
|
||||
int32_t const n = static_cast<int32_t>(end - beg);
|
||||
if (n <= 2)
|
||||
@@ -124,21 +122,20 @@ class AccumulateSkipSmallTrg
|
||||
{
|
||||
public:
|
||||
AccumulateSkipSmallTrg(DistanceFn & distFn, std::vector<Point> & vec, double eps)
|
||||
: m_distFn(distFn), m_vec(vec), m_eps(eps)
|
||||
{
|
||||
}
|
||||
: m_distFn(distFn)
|
||||
, m_vec(vec)
|
||||
, m_eps(eps)
|
||||
{}
|
||||
|
||||
void operator()(Point const & p) const
|
||||
{
|
||||
// remove points while they make linear triangle with p
|
||||
size_t count;
|
||||
while ((count = m_vec.size()) >= 2)
|
||||
{
|
||||
if (m_distFn(m_vec[count - 2], p, m_vec[count - 1]) < m_eps)
|
||||
m_vec.pop_back();
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
m_vec.push_back(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user