ALGO: use 'Segment' instead of '(PT, PT)'

This commit is contained in:
hasufell 2015-01-12 22:38:10 +01:00
parent 8a248adc41
commit c8541f59b4
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 3 additions and 3 deletions

View File

@ -126,10 +126,10 @@ monotonePartitioning pts
-- |Try to eliminate the merge and split vertices by computing the
-- diagonals we have to use for splitting the polygon. This doesn't
-- necessarily make our polygon y-monotone yet.
monotoneDiagonals :: [PT] -> [(PT, PT)]
monotoneDiagonals :: [PT] -> [Segment]
monotoneDiagonals pts = catMaybes . go $ classifyList pts
where
go :: [(PT, VCategory)] -> [Maybe (PT, PT)]
go :: [(PT, VCategory)] -> [Maybe Segment]
go (x:xs) = case snd x of
VMerge -> getSeg (belowS . fst $ x) (fst x) : go xs
VSplit -> getSeg (aboveS . fst $ x) (fst x) : go xs
@ -137,7 +137,7 @@ monotoneDiagonals pts = catMaybes . go $ classifyList pts
go [] = []
getSeg :: [PT] -- all points above/below the current point
-> PT -- current point
-> Maybe (PT, PT)
-> Maybe Segment
getSeg [] _ = Nothing
getSeg (z:zs) pt
| isInsidePoly pts (z, pt) = Just (z, pt)