DIAGRAM: fix filtering of points based on the dimensions
This commit is contained in:
parent
de5aba792e
commit
e2f1c865f3
18
Diagram.hs
18
Diagram.hs
@ -116,27 +116,31 @@ convexHullLines :: Diag
|
|||||||
convexHullLines = Diag f
|
convexHullLines = Diag f
|
||||||
where
|
where
|
||||||
f _ [] = mempty
|
f _ [] = mempty
|
||||||
f _ vt
|
f p vt
|
||||||
= (strokeTrail .
|
= (strokeTrail .
|
||||||
fromVertices .
|
fromVertices .
|
||||||
flip (++) [head $ grahamGetCH vt] .
|
flip (++) [head $ grahamGetCH vtf] .
|
||||||
grahamGetCH $
|
grahamGetCH $
|
||||||
vt
|
vtf
|
||||||
) # moveTo (head $ grahamGetCH vt) # lc red
|
) # moveTo (head $ grahamGetCH vtf) # lc red
|
||||||
|
where
|
||||||
|
vtf = filter (inRange (dX p) (dY p)) vt
|
||||||
|
|
||||||
|
|
||||||
-- |Same as showConvexHullLines, except that it returns an array
|
-- |Same as showConvexHullLines, except that it returns an array
|
||||||
-- of diagrams with each step of the algorithm.
|
-- of diagrams with each step of the algorithm.
|
||||||
-- Unfortunately this is very difficult to implement as a Diag (TODO).
|
-- Unfortunately this is very difficult to implement as a Diag (TODO).
|
||||||
convexHullLinesInterval :: DiagProp -> [PT] -> [Diagram Cairo R2]
|
convexHullLinesInterval :: DiagProp -> [PT] -> [Diagram Cairo R2]
|
||||||
convexHullLinesInterval _ xs =
|
convexHullLinesInterval p xs =
|
||||||
fmap g (grahamGetCHSteps xs)
|
fmap g (grahamGetCHSteps xs)
|
||||||
where
|
where
|
||||||
g vt
|
g vt
|
||||||
= (strokeTrail .
|
= (strokeTrail .
|
||||||
fromVertices $
|
fromVertices $
|
||||||
vt
|
vtf
|
||||||
) # moveTo (head vt) # lc red
|
) # moveTo (head vtf) # lc red
|
||||||
|
where
|
||||||
|
vtf = filter (inRange (dX p) (dY p)) vt
|
||||||
|
|
||||||
|
|
||||||
-- |Creates a Diagram that shows an XAxis which is bound
|
-- |Creates a Diagram that shows an XAxis which is bound
|
||||||
|
Loading…
Reference in New Issue
Block a user