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 (x:y:xs) = (x, y) : go (y:xs)
|
||||||
go _ = []
|
go _ = []
|
||||||
polySegments _ = []
|
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 [] = []
|
go [] = []
|
||||||
getSeg [] _ _ = Nothing
|
getSeg [] _ _ = Nothing
|
||||||
getSeg (z:zs) pt pts'
|
getSeg (z:zs) pt pts'
|
||||||
| null
|
| isInsidePoly pts (z, pt) = Just (z, pt)
|
||||||
. catMaybes
|
|
||||||
. fmap (intersectSeg'' (z, pt))
|
|
||||||
$ polySegments pts
|
|
||||||
= Just (z, pt)
|
|
||||||
| otherwise = getSeg zs pt pts'
|
| otherwise = getSeg zs pt pts'
|
||||||
aboveS pt pts' = tail . dropWhile (/= pt) $ sortedYX pts'
|
aboveS pt pts' = tail . dropWhile (/= pt) $ sortedYX pts'
|
||||||
belowS pt pts' = reverse . takeWhile (/= pt) $ sortedYX pts'
|
belowS pt pts' = reverse . takeWhile (/= pt) $ sortedYX pts'
|
||||||
|
Loading…
Reference in New Issue
Block a user