DIAG: clean up squares function

This commit is contained in:
hasufell 2014-11-14 21:29:10 +01:00
parent ecf203c825
commit da5b0a17f0
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -170,21 +170,17 @@ convexHStepsLs = GifDiag chs
(strokeTrail . fromVertices $ vt') # moveTo (head vt') # lc col (strokeTrail . fromVertices $ vt') # moveTo (head vt') # lc col
-- FIXME: hardcoded dimensions -- |Create a diagram that shows all squares of the RangeSearch algorithm
-- from the quad tree.
squares :: Diag squares :: Diag
squares = Diag f squares = Diag f
where where
f p (Object []) = mempty f p (Object []) = mempty
f p (Object vt) = f p (Object vt) =
mconcat mconcat
$ (\((xmin, xmax), (ymin, ymax)) -> rect (xmax - xmin) (ymax - ymin) # $ (\((xmin, xmax), (ymin, ymax)) -> rect (xmax - xmin) (ymax - ymin)
moveTo (p2 ( # moveTo (p2 ((xmax + xmin) / 2, (ymax + ymin) / 2)) # lw ultraThin)
((xmax + xmin) / 2), <$> (quadTreeSquares (dX p, dY p) . quadTree vtf $ (dX p, dY p))
((ymax + ymin) / 2)
)
) #
lw ultraThin)
<$> (quadTreeSquares ((0,500), (0,500)) . quadTree vtf $ (dX p, dY p))
where where
vtf = filterValidPT p vt vtf = filterValidPT p vt
f _ _ = mempty f _ _ = mempty