From 3331f181f0236168187d3fee7ca13e32b9303a94 Mon Sep 17 00:00:00 2001 From: Lajat5 Date: Sat, 6 Nov 2021 06:56:13 +0000 Subject: [PATCH] Fix #1 --- geometry/graham_scan_functions.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/geometry/graham_scan_functions.hpp b/geometry/graham_scan_functions.hpp index 9d9325289..db77ec441 100644 --- a/geometry/graham_scan_functions.hpp +++ b/geometry/graham_scan_functions.hpp @@ -63,11 +63,11 @@ namespace geometry::grahamscan { * @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); + Point nextToTop(std::stack *S) { + Point p = S->top(); + S->pop(); + Point res = S->top(); + S->push(p); return res; } @@ -174,7 +174,7 @@ namespace geometry::grahamscan { // 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) { + while (S.size() > 1 && orientation(nextToTop(&S), S.top(), points[i]) != 2) { S.pop(); } S.push(points[i]);