mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
clang-format and clang-tidy fixes for 69b6832b
This commit is contained in:
parent
1a4bd721a7
commit
e90e0d647b
@ -164,8 +164,10 @@ std::vector<Point> convexHull(std::vector<Point> points, uint64_t size) {
|
|||||||
m++; // Update size of modified array
|
m++; // Update size of modified array
|
||||||
}
|
}
|
||||||
|
|
||||||
// If modified array of points has less than 3 points, convex hull is not possible
|
// If modified array of points has less than 3 points, convex hull is not
|
||||||
if (m < 3) return {};
|
// possible
|
||||||
|
if (m < 3)
|
||||||
|
return {};
|
||||||
|
|
||||||
// Create an empty stack and push first three points to it.
|
// Create an empty stack and push first three points to it.
|
||||||
std::stack<Point> S;
|
std::stack<Point> S;
|
||||||
@ -178,7 +180,8 @@ std::vector<Point> convexHull(std::vector<Point> points, uint64_t size) {
|
|||||||
// Keep removing top while the angle formed by
|
// Keep removing top while the angle formed by
|
||||||
// points next-to-top, top, and points[i] makes
|
// points next-to-top, top, and points[i] makes
|
||||||
// a non-left turn
|
// a non-left turn
|
||||||
while (S.size() > 1 && orientation(nextToTop(&S), S.top(), points[i]) != 2) {
|
while (S.size() > 1 &&
|
||||||
|
orientation(nextToTop(&S), S.top(), points[i]) != 2) {
|
||||||
S.pop();
|
S.pop();
|
||||||
}
|
}
|
||||||
S.push(points[i]);
|
S.push(points[i]);
|
||||||
@ -200,7 +203,8 @@ std::vector<Point> convexHull(std::vector<Point> points, uint64_t size) {
|
|||||||
// Keep removing top while the angle formed by
|
// Keep removing top while the angle formed by
|
||||||
// points next-to-top, top, and points[i] makes
|
// points next-to-top, top, and points[i] makes
|
||||||
// a non-left turn
|
// a non-left turn
|
||||||
while (St.size() > 1 && orientation(nextToTop(&St), St.top(), points[i]) != 2) {
|
while (St.size() > 1 &&
|
||||||
|
orientation(nextToTop(&St), St.top(), points[i]) != 2) {
|
||||||
St.pop();
|
St.pop();
|
||||||
}
|
}
|
||||||
St.push(points[i]);
|
St.push(points[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user