Fix bug when forming convex hull of game room bounds

This commit is contained in:
2021-09-30 23:46:59 +01:00
parent cb23960bd7
commit 1414d08d88
14 changed files with 51 additions and 16 deletions
+3 -2
View File
@@ -25,6 +25,7 @@ import Tile
import Polyhedra
import Polyhedra.Data
import Data.List (nub)
import Control.Monad.State
import Control.Lens
import System.Random
@@ -120,9 +121,9 @@ gameRoomsFromRooms :: [Room] -> [GameRoom]
gameRoomsFromRooms = map f
where
f rm = GameRoom
{ _grViewpoints = map fst . foldl' (flip cutWalls) [] $ _rmPolys rm
{ _grViewpoints = _rmViewpoints rm ++ (map fst . foldl' (flip cutWalls) [] $ _rmPolys rm)
, _grViewpointsEx = map fst (_rmLinks rm)
, _grBound = expandPolyByFixed 100 $ orderPolygon $ convexHullSafe $ concat $ _rmBound rm ++ _rmPolys rm
, _grBound = expandPolyByFixed 100 . convexHullSafe . nub . concat $ _rmBound rm ++ _rmPolys rm
, _grDir = snd . last $ _rmLinks rm
, _grName = _rmName rm
}