Generate walls using points, fix at least some potential errors
This commit is contained in:
+13
-1
@@ -11,6 +11,7 @@ import Dodge.RandomHelp
|
||||
import Dodge.Path
|
||||
import Dodge.Layout.Tree
|
||||
import Dodge.Room.Data
|
||||
import Dodge.Default
|
||||
|
||||
import Geometry
|
||||
|
||||
@@ -60,8 +61,19 @@ generateFromTree t w = zoning $ placeSpots plmnts
|
||||
makePath :: Tree Room -> [(Point2,Point2)]
|
||||
makePath = concat . map _rmPath . flatten
|
||||
|
||||
-- consider nubbing walls after dividing them
|
||||
wallsFromTree :: Tree Room -> IM.IntMap Wall
|
||||
wallsFromTree t = createInnerWalls $ nubWalls $ divideWalls $ foldr cutWalls IM.empty (concatMap _rmPolys $ flatten t)
|
||||
wallsFromTree t =
|
||||
createInnerWalls
|
||||
. divideWalls
|
||||
. assignKeys
|
||||
. foldr cutWalls [] -- $ map (map (g . roundPoint2))
|
||||
. map (map roundPoint2)
|
||||
$ (concatMap _rmPolys $ flatten t)
|
||||
where
|
||||
assignKeys = IM.fromList . zip [0..] . zipWith f [0..]
|
||||
f i (x,y) = defaultWall {_wlLine = [x,y] , _wlID = i}
|
||||
g (x,y) = (x-3855,y - 2613)
|
||||
|
||||
divideWall :: Wall -> [Wall]
|
||||
divideWall wl
|
||||
|
||||
Reference in New Issue
Block a user