ALGO: use isInsidePoly
This commit is contained in:
parent
5b092715aa
commit
c96474e6fd
@ -24,3 +24,12 @@ polySegments p@(x':_:_:_) = go p ++ [(last p, x')]
|
||||
go (x:y:xs) = (x, y) : go (y:xs)
|
||||
go _ = []
|
||||
polySegments _ = []
|
||||
|
||||
|
||||
isInsidePoly :: [PT] -> Segment -> Bool
|
||||
isInsidePoly pts seg =
|
||||
null
|
||||
. catMaybes
|
||||
. fmap (intersectSeg'' seg)
|
||||
$ polySegments pts
|
||||
|
||||
|
@ -131,11 +131,7 @@ monotoneDiagonals pts = catMaybes . go $ classifyList pts
|
||||
go [] = []
|
||||
getSeg [] _ _ = Nothing
|
||||
getSeg (z:zs) pt pts'
|
||||
| null
|
||||
. catMaybes
|
||||
. fmap (intersectSeg'' (z, pt))
|
||||
$ polySegments pts
|
||||
= Just (z, pt)
|
||||
| isInsidePoly pts (z, pt) = Just (z, pt)
|
||||
| otherwise = getSeg zs pt pts'
|
||||
aboveS pt pts' = tail . dropWhile (/= pt) $ sortedYX pts'
|
||||
belowS pt pts' = reverse . takeWhile (/= pt) $ sortedYX pts'
|
||||
|
Loading…
Reference in New Issue
Block a user