Continue to refactor zoning to be more stream-based

This commit is contained in:
2022-06-28 03:21:55 +01:00
parent f6d96ec92c
commit e06527091e
34 changed files with 214 additions and 252 deletions
+4 -3
View File
@@ -43,13 +43,14 @@ addBlock (p:ps) wl bl w = w
}
) is lns
wallInZone wl'
| uncurry dist (_wlLine wl') <= 2*zoneSize
| uncurry dist (_wlLine wl') <= 2*wallZoneSize
= insertIMInZone x y wlid wl'
| otherwise = flip (foldl' $ flip (\(a,b) -> insertIMInZone a b wlid wl')) ips
where
(x,y) = zoneOfPoint $ uncurry midPoint (_wlLine wl)
V2 x y = wallZoneOfPoint $ uncurry midPoint (_wlLine wl)
wlid = _wlID wl
ips = map zoneOfPoint $ uncurry (divideLine (2*zoneSize)) (_wlLine wl)
ips = map (unv2 . wallZoneOfPoint) $ uncurry (divideLine (2*wallZoneSize)) (_wlLine wl)
unv2 (V2 x y) = (x,y)
addBlock _ _ _ _ = error "Trying to add a block with incomplete polygon"
placeBlock :: [Point2] -> Block -> Wall -> World -> (Int,World)