From e90e0d647b7a33f8eaadb3804d9171648504db46 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sat, 6 Nov 2021 09:03:12 +0000 Subject: [PATCH] clang-format and clang-tidy fixes for 69b6832b --- geometry/graham_scan_functions.hpp | 62 ++++++++++++++++-------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/geometry/graham_scan_functions.hpp b/geometry/graham_scan_functions.hpp index 4e99ff9fe..2de8f1db0 100644 --- a/geometry/graham_scan_functions.hpp +++ b/geometry/graham_scan_functions.hpp @@ -62,18 +62,18 @@ struct Point { // to the first point Used in compare function of qsort() Point p0; - /****************************************************************************** - * @brief A utility function to find next to top in a stack. - * @param S Stack to be used for the process. - * @returns @param Point Co-ordinates of the Point - *******************************************************************************/ - Point nextToTop(std::stack *S) { - Point p = S->top(); - S->pop(); - Point res = S->top(); - S->push(p); - return res; - } +/****************************************************************************** + * @brief A utility function to find next to top in a stack. + * @param S Stack to be used for the process. + * @returns @param Point Co-ordinates of the Point + *******************************************************************************/ +Point nextToTop(std::stack *S) { + Point p = S->top(); + S->pop(); + Point res = S->top(); + S->push(p); + return res; +} /****************************************************************************** * @brief A utility function to return square of distance between p1 and p2. @@ -164,25 +164,28 @@ std::vector convexHull(std::vector points, uint64_t size) { m++; // Update size of modified array } - // If modified array of points has less than 3 points, convex hull is not possible - if (m < 3) return {}; + // If modified array of points has less than 3 points, convex hull is not + // possible + if (m < 3) + return {}; - // Create an empty stack and push first three points to it. - std::stack S; - S.push(points[0]); - S.push(points[1]); - S.push(points[2]); + // Create an empty stack and push first three points to it. + std::stack S; + S.push(points[0]); + S.push(points[1]); + S.push(points[2]); - // Process remaining n-3 points - for (int i = 3; i < m; i++) { - // Keep removing top while the angle formed by - // points next-to-top, top, and points[i] makes - // a non-left turn - while (S.size() > 1 && orientation(nextToTop(&S), S.top(), points[i]) != 2) { - S.pop(); - } - S.push(points[i]); + // Process remaining n-3 points + for (int i = 3; i < m; i++) { + // Keep removing top while the angle formed by + // points next-to-top, top, and points[i] makes + // a non-left turn + while (S.size() > 1 && + orientation(nextToTop(&S), S.top(), points[i]) != 2) { + S.pop(); } + S.push(points[i]); + } // If modified array of points has less than 3 points, convex hull is not // possible if (m < 3) { @@ -200,7 +203,8 @@ std::vector convexHull(std::vector points, uint64_t size) { // Keep removing top while the angle formed by // points next-to-top, top, and points[i] makes // 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.push(points[i]);