ALGO: add isYmonotone function
This commit is contained in:
parent
2bc3aec80a
commit
211731af0c
@ -12,7 +12,7 @@ data VCategory = VStart
|
||||
| VRegular
|
||||
| VSplit
|
||||
| VMerge
|
||||
deriving (Show)
|
||||
deriving (Show, Eq)
|
||||
|
||||
|
||||
-- |Classify all vertices on a polygon into five categories (see VCategory).
|
||||
@ -108,3 +108,12 @@ above :: PT -- ^ is this one above the other?
|
||||
-> PT
|
||||
-> Bool
|
||||
above = flip below
|
||||
|
||||
|
||||
-- |Check if polygon is y-monotone.
|
||||
isYmonotone :: [PT] -> Bool
|
||||
isYmonotone poly =
|
||||
not
|
||||
. any (\x -> x == VSplit || x == VMerge)
|
||||
. fmap snd
|
||||
$ classifyList poly
|
||||
|
Loading…
Reference in New Issue
Block a user