ALGO: add isYmonotone function
This commit is contained in:
parent
2bc3aec80a
commit
211731af0c
@ -12,7 +12,7 @@ data VCategory = VStart
|
|||||||
| VRegular
|
| VRegular
|
||||||
| VSplit
|
| VSplit
|
||||||
| VMerge
|
| VMerge
|
||||||
deriving (Show)
|
deriving (Show, Eq)
|
||||||
|
|
||||||
|
|
||||||
-- |Classify all vertices on a polygon into five categories (see VCategory).
|
-- |Classify all vertices on a polygon into five categories (see VCategory).
|
||||||
@ -108,3 +108,12 @@ above :: PT -- ^ is this one above the other?
|
|||||||
-> PT
|
-> PT
|
||||||
-> Bool
|
-> Bool
|
||||||
above = flip below
|
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