GroundMapGenerator

floodsim.model.logic.GroundMapGenerator
sealed trait GroundMapGenerator extends BaseMapGenerator

Trait for generating ground terrain maps with different cell types. Uses Gaussian distribution to create natural-looking terrain patterns with different building types concentrated around the center.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object MapGenerator

Members list

Value members

Concrete methods

Generates a basic ground grid with all cells as fields.

Generates a basic ground grid with all cells as fields.

Value parameters

size

the size of the grid (width and height)

Attributes

Returns

a distance grid containing only field cells

Throws
IllegalArgumentException

if size is not positive

Generates a ground grid with varied cell types. The distribution of cell types is based on distance from a random center point. using Gaussian probability to create natural-looking terrain patterns. Cell types are distributed using Gaussian probability based on distance from center:

Generates a ground grid with varied cell types. The distribution of cell types is based on distance from a random center point. using Gaussian probability to create natural-looking terrain patterns. Cell types are distributed using Gaussian probability based on distance from center:

  • Center: Squares (highest density)
  • Middle ring: Houses with concrete
  • Outer ring: Houses with grass
  • Perimeter: Fields

Value parameters

size

the size of the grid (width and height)

Attributes

Returns

a distance grid with procedurally generated terrain

Throws
IllegalArgumentException

if size is not positive

Inherited methods

protected def gaussianWeight(distance: Double, mean: Double, stdDev: Double): Double

Calculates Gaussian weight for distance-based probability calculations.

Calculates Gaussian weight for distance-based probability calculations.

Value parameters

distance

the distance from center

mean

the mean of the Gaussian distribution

stdDev

the standard deviation of the Gaussian distribution

Attributes

Returns

the Gaussian weight value

Inherited from:
BaseMapGenerator
protected def generateDistributedGrid[T](size: Int, selector: (Double, Double) => T): Map[Coordinate, T]

Common grid generation method that builds a grid based on a selection function generalizing the element type for any possible grid generation.

Common grid generation method that builds a grid based on a selection function generalizing the element type for any possible grid generation.

Type parameters

T

the type of elements in the grid

Value parameters

selector

a function that selects an element based on normalized distance and random value

size

the size of the grid (width and height)

Attributes

Returns

a map of coordinates to elements

Inherited from:
BaseMapGenerator

Inherited fields

protected val rand: Random

Attributes

Inherited from:
BaseMapGenerator