File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ def jarvis_march(points: list[Point]) -> list[Point]:
188188 # Check if the last point is collinear with new point and second-to-last
189189 last = len (convex_hull ) - 1
190190 if len (convex_hull ) > 1 and _is_point_on_segment (
191- points [ current_idx ], convex_hull [last - 1 ], convex_hull [ last ]
191+ convex_hull [ last ], convex_hull [last - 1 ], points [ current_idx ]
192192 ):
193193 # Remove the last point from the hull
194194 convex_hull [last ] = Point (points [current_idx ].x , points [current_idx ].y )
@@ -200,7 +200,7 @@ def jarvis_march(points: list[Point]) -> list[Point]:
200200 return []
201201
202202 last = len (convex_hull ) - 1
203- if _is_point_on_segment (convex_hull [0 ], convex_hull [last - 1 ], convex_hull [last ]):
203+ if _is_point_on_segment (convex_hull [last ], convex_hull [last - 1 ], convex_hull [0 ]):
204204 convex_hull .pop ()
205205 if len (convex_hull ) == 2 :
206206 return []
You can’t perform that action at this time.
0 commit comments