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++) { for (size_t i = 1; i < tcx.point_count(); i++) {
Point& point = *tcx.GetPoint(i); Point& point = *tcx.GetPoint(i);
Node* node = &PointEvent(tcx, point); Node* node = &PointEvent(tcx, point);
for (unsigned int j = 0; j < point.edge_list.size(); j++) { for (auto& j : point.edge_list) {
EdgeEvent(tcx, point.edge_list[j], node); 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 * https://github.com/jhasse/poly2tri
* *
* All rights reserved. * All rights reserved.
@ -34,7 +34,7 @@
namespace p2t { namespace p2t {
SweepContext::SweepContext(const std::vector<Point*>& polyline) : points_(polyline), SweepContext::SweepContext(std::vector<Point*> polyline) : points_(std::move(polyline)),
front_(nullptr), front_(nullptr),
head_(nullptr), head_(nullptr),
tail_(nullptr), tail_(nullptr),
@ -48,8 +48,8 @@ SweepContext::SweepContext(const std::vector<Point*>& polyline) : points_(polyli
void SweepContext::AddHole(const std::vector<Point*>& polyline) void SweepContext::AddHole(const std::vector<Point*>& polyline)
{ {
InitEdges(polyline); InitEdges(polyline);
for(unsigned int i = 0; i < polyline.size(); i++) { for (auto i : polyline) {
points_.push_back(polyline[i]); points_.push_back(i);
} }
} }
@ -73,8 +73,8 @@ void SweepContext::InitTriangulation()
double ymax(points_[0]->y), ymin(points_[0]->y); double ymax(points_[0]->y), ymin(points_[0]->y);
// Calculate bounds. // Calculate bounds.
for (unsigned int i = 0; i < points_.size(); i++) { for (auto& point : points_) {
Point& p = *points_[i]; Point& p = *point;
if (p.x > xmax) if (p.x > xmax)
xmax = p.x; xmax = p.x;
if (p.x < xmin) 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 * https://github.com/jhasse/poly2tri
* *
* All rights reserved. * All rights reserved.
@ -52,7 +52,7 @@ class SweepContext {
public: public:
/// Constructor /// Constructor
SweepContext(const std::vector<Point*>& polyline); explicit SweepContext(std::vector<Point*> polyline);
/// Destructor /// Destructor
~SweepContext(); ~SweepContext();
@ -103,15 +103,16 @@ struct Basin {
double width; double width;
bool left_highest; 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() void Clear()
{ {
left_node = NULL; left_node = nullptr;
bottom_node = NULL; bottom_node = nullptr;
right_node = NULL; right_node = nullptr;
width = 0.0; width = 0.0;
left_highest = false; left_highest = false;
} }