License | BSD-3-Clause |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
Swarm.Game.Scenario.Topography.Area
Description
Synopsis
- data AreaDimensions = AreaDimensions {
- rectWidth :: Int32
- rectHeight :: Int32
- getGridDimensions :: Grid a -> AreaDimensions
- getNEGridDimensions :: NonEmptyGrid a -> AreaDimensions
- asTuple :: AreaDimensions -> (Int32, Int32)
- renderRectDimensions :: AreaDimensions -> String
- invertY :: V2 Int32 -> V2 Int32
- computeBottomRightFromUpperLeft :: AreaDimensions -> Location -> Location
- computeAbsoluteCornerDisplacement :: AreaDimensions -> V2 Int32
- cornersToArea :: Location -> Location -> AreaDimensions
- isEmpty :: AreaDimensions -> Bool
- getAreaDimensions :: [[a]] -> AreaDimensions
- computeArea :: AreaDimensions -> Int32
- fillGrid :: AreaDimensions -> a -> Grid a
Documentation
data AreaDimensions Source #
Height and width of a 2D map region
Constructors
AreaDimensions | |
Fields
|
Instances
getGridDimensions :: Grid a -> AreaDimensions Source #
computeBottomRightFromUpperLeft :: AreaDimensions -> Location -> Location Source #
Incorporates an offset by -1
, since the area is
"inclusive" of the lower-right coordinate.
Inverse of cornersToArea
.
cornersToArea :: Location -> Location -> AreaDimensions Source #
Converts the displacement vector between the two
diagonal corners of the rectangle into an AreaDimensions
record.
Adds one to both dimensions since the corner coordinates are "inclusive".
Inverse of computeBottomRightFromUpperLeft
.
isEmpty :: AreaDimensions -> Bool Source #
Has zero width or height.
getAreaDimensions :: [[a]] -> AreaDimensions Source #
Extracts the dimensions of a map grid.
computeArea :: AreaDimensions -> Int32 Source #
fillGrid :: AreaDimensions -> a -> Grid a Source #