From 4877837f933cb131d69db9def21a2c77943af497 Mon Sep 17 00:00:00 2001 From: hasufell Date: Thu, 9 Oct 2014 16:11:34 +0200 Subject: [PATCH] Fix step depth in grahamGetCHSteps If we have 3 points and pass 1 to 'g' then 2 steps will be computed. That means we have to substract 2 from the total length in the call to 'g'. --- Algorithms/ConvexHull.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Algorithms/ConvexHull.hs b/Algorithms/ConvexHull.hs index 4262c02..c861f86 100644 --- a/Algorithms/ConvexHull.hs +++ b/Algorithms/ConvexHull.hs @@ -69,7 +69,7 @@ grahamGetCH vs = f . grahamSort $ vs -- |Compute all steps of the graham scan algorithm to allow -- visualizing it. grahamGetCHSteps :: [PT] -> [[PT]] -grahamGetCHSteps vs = reverse . g $ (length . grahamGetCH $ vs) +grahamGetCHSteps vs = reverse . g $ (length vs - 2) where vs' = grahamSort vs g c