ALGO: rm non-triangles and duplicates
This commit is contained in:
parent
534284bbe0
commit
eb1142b52f
@ -119,7 +119,7 @@ monotonePartitioning pts
|
|||||||
| otherwise = a : go xs b
|
| otherwise = a : go xs b
|
||||||
where
|
where
|
||||||
[a, b] = splitPoly pts' x
|
[a, b] = splitPoly pts' x
|
||||||
go _ _ = [[]]
|
go _ _ = []
|
||||||
|
|
||||||
|
|
||||||
-- |Try to eliminate the merge and split vertices by computing the
|
-- |Try to eliminate the merge and split vertices by computing the
|
||||||
@ -159,7 +159,7 @@ triangulate pts =
|
|||||||
go xs (p@(u:vi:vi1:ys), rs)
|
go xs (p@(u:vi:vi1:ys), rs)
|
||||||
-- case 1 and 3
|
-- case 1 and 3
|
||||||
| adjacent u (last p) xs =
|
| adjacent u (last p) xs =
|
||||||
splitPoly xs (u, (last . init) p)
|
(triangleOnly . splitPoly xs $ (u, (last . init) p))
|
||||||
++ go (fromMaybe []
|
++ go (fromMaybe []
|
||||||
. headMay
|
. headMay
|
||||||
. nonTriangleOnly
|
. nonTriangleOnly
|
||||||
@ -169,7 +169,7 @@ triangulate pts =
|
|||||||
-- case 2
|
-- case 2
|
||||||
| adjacent u vi xs && (not . null) rs =
|
| adjacent u vi xs && (not . null) rs =
|
||||||
if getAngle (vp2 vi u) (vp2 vi vi1) < pi / 2
|
if getAngle (vp2 vi u) (vp2 vi vi1) < pi / 2
|
||||||
then splitPoly xs (u, vi1)
|
then (triangleOnly . splitPoly xs $ (u, vi1))
|
||||||
++ go (fromMaybe []
|
++ go (fromMaybe []
|
||||||
. headMay
|
. headMay
|
||||||
. nonTriangleOnly
|
. nonTriangleOnly
|
||||||
@ -177,5 +177,5 @@ triangulate pts =
|
|||||||
$ (u, vi1))
|
$ (u, vi1))
|
||||||
(u:vi1:ys, rs)
|
(u:vi1:ys, rs)
|
||||||
else go xs (head rs:p, tail rs)
|
else go xs (head rs:p, tail rs)
|
||||||
| otherwise = [[]]
|
| otherwise = []
|
||||||
go _ _ = [[]]
|
go _ _ = []
|
||||||
|
Loading…
Reference in New Issue
Block a user