-
-
Save glguy/c51bb1e01e964f780e9255eaad77ca69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subtractBox1 :: Box n -> Box n -> [Box n] | |
subtractBox1 b1 b2 = | |
case intersectBox b1 b2 of | |
Nothing -> [b2] | |
Just i -> subtractBox' i b2 | |
-- | Worker for 'subtractBox' | |
subtractBox' :: Box n -> Box n -> [Box n] | |
subtractBox' Pt Pt = [] | |
subtractBox' (i@(Seg x y) :* is) (Seg c d :* ys) | |
= [Seg c x :* ys | c < x] ++ | |
[Seg y d :* ys | y < d] ++ | |
map (i :*) (subtractBox' is ys) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment