Apply even more clang-tidy fixes

This commit is contained in:
Jan Niklas Hasse 2022-03-25 08:49:45 +01:00
parent dcdb7442a4
commit 3380f5c805
3 changed files with 15 additions and 14 deletions

View File

@ -54,8 +54,8 @@ void Sweep::SweepPoints(SweepContext& tcx)
for (size_t i = 1; i < tcx.point_count(); i++) {
Point& point = *tcx.GetPoint(i);
Node* node = &PointEvent(tcx, point);
for (unsigned int j = 0; j < point.edge_list.size(); j++) {
EdgeEvent(tcx, point.edge_list[j], node);
for (auto& j : point.edge_list) {
EdgeEvent(tcx, j, node);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors
* Poly2Tri Copyright (c) 2009-2022, Poly2Tri Contributors
* https://github.com/jhasse/poly2tri
*
* All rights reserved.
@ -34,7 +34,7 @@
namespace p2t {
SweepContext::SweepContext(const std::vector<Point*>& polyline) : points_(polyline),
SweepContext::SweepContext(std::vector<Point*> polyline) : points_(std::move(polyline)),
front_(nullptr),
head_(nullptr),
tail_(nullptr),
@ -48,8 +48,8 @@ SweepContext::SweepContext(const std::vector<Point*>& polyline) : points_(polyli
void SweepContext::AddHole(const std::vector<Point*>& polyline)
{
InitEdges(polyline);
for(unsigned int i = 0; i < polyline.size(); i++) {
points_.push_back(polyline[i]);
for (auto i : polyline) {
points_.push_back(i);
}
}
@ -73,8 +73,8 @@ void SweepContext::InitTriangulation()
double ymax(points_[0]->y), ymin(points_[0]->y);
// Calculate bounds.
for (unsigned int i = 0; i < points_.size(); i++) {
Point& p = *points_[i];
for (auto& point : points_) {
Point& p = *point;
if (p.x > xmax)
xmax = p.x;
if (p.x < xmin)

View File

@ -1,5 +1,5 @@
/*
* Poly2Tri Copyright (c) 2009-2018, Poly2Tri Contributors
* Poly2Tri Copyright (c) 2009-2022, Poly2Tri Contributors
* https://github.com/jhasse/poly2tri
*
* All rights reserved.
@ -52,7 +52,7 @@ class SweepContext {
public:
/// Constructor
SweepContext(const std::vector<Point*>& polyline);
explicit SweepContext(std::vector<Point*> polyline);
/// Destructor
~SweepContext();
@ -103,15 +103,16 @@ struct Basin {
double width;
bool left_highest;
Basin() : left_node(NULL), bottom_node(NULL), right_node(NULL), width(0.0), left_highest(false)
Basin()
: left_node(nullptr), bottom_node(nullptr), right_node(nullptr), width(0.0), left_highest(false)
{
}
void Clear()
{
left_node = NULL;
bottom_node = NULL;
right_node = NULL;
left_node = nullptr;
bottom_node = nullptr;
right_node = nullptr;
width = 0.0;
left_highest = false;
}