ALGO: refactor

Move sortedXY to Vector.hs, fix shadowing of scanH.
Simplified grahamCHSteps by making use of a more generalized scanH
function.
This commit is contained in:
2014-10-13 22:06:12 +02:00
parent 09eeaeda27
commit 8300929fd7
2 changed files with 29 additions and 47 deletions

View File

@@ -4,6 +4,7 @@ module Algebra.Vector where
import Algebra.VectorTypes
import Diagrams.TwoD.Types
import MyPrelude
-- |Checks whether the Point is in a given dimension.
@@ -89,3 +90,8 @@ notcw :: PT -> PT -> PT -> Bool
notcw a b c = case getOrient a b c of
CW -> False
_ -> True
-- |Sort X and Y coordinates lexicographically.
sortedXY :: [PT] -> [PT]
sortedXY = fmap p2 . sortLex . fmap unp2