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'.
This commit is contained in:
2014-10-09 16:11:34 +02:00
parent 5ce94d36aa
commit 4877837f93

View File

@@ -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