Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cotanSort :: [Point] -> [Point]
- cotanSort ps = initialPoint : sortBy cotanCompare remainingPoints
- where
- initialSorting = initialSort ps
- initialPoint = head initialSorting
- remainingPoints = tail initialSorting
- (pivotx,pivoty) = initialPoint
- cotanCompare (px,py) (qx,qy)
- | pCalc > qCalc = GT
- | pCalc < qCalc = LT
- | py < qy = GT
- | px > qx = GT
- | otherwise = EQ
- where
- pCalc = (py-pivoty)*(qx-pivotx)
- qCalc = (qy-pivoty)*(px-pivotx)
Add Comment
Please, Sign In to add comment