GridGeometrySpec

@Serializable
data class GridGeometrySpec(val spaceName: String, val cols: Int, val rows: Int, val torus: Boolean = false, val movementRule: MovementRule = MovementRule.MOORE, val allowCornerCutting: Boolean = false, val blockedCells: List<Cell> = emptyList(), val cellCosts: List<CellCost> = emptyList(), val originX: Double? = null, val originY: Double? = null, val cellSize: Double? = null)(source)

A neutral, serializable description of a grid's structural geometry — its dimensions, topology, and the obstacles/costs a GridGraph holds — keyed to the animated space it overlays by spaceName (P5a/G2).

This is the round-trip currency between the model and the layout: a GridGraph exports one via GridGraph.toSpec, the animation layer carries it in AnimationLayout.spaceGeometry, and (P5b) a modeler can rebuild a graph from one. It carries only structural fields — never display styling.

originX/originY/cellSize are the grid's physical placement in the space's world coordinates. They are distinct from a SpatialSpaceDescriptor.Grid's display cell size (chosen for drawing). When null, the renderer derives placement from the named space's bounds (cellSize = span/cols, origin = bounds min).

Constructors

Link copied to clipboard
constructor(spaceName: String, cols: Int, rows: Int, torus: Boolean = false, movementRule: MovementRule = MovementRule.MOORE, allowCornerCutting: Boolean = false, blockedCells: List<Cell> = emptyList(), cellCosts: List<CellCost> = emptyList(), originX: Double? = null, originY: Double? = null, cellSize: Double? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val cols: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val rows: Int
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Rebuilds a GridGraph from this structural spec — the consume side of the round-trip (P5b/G2). A modeler who wants the layout to be authoritative for geometry loads the layout, looks up the spec (AnimationLayout.gridGeometry(name)), and builds the graph from it. Reproduces dims, topology, obstacles, and costs exactly; the physical placement fields (originX/originY/cellSize) are layout/render concerns and are not part of the graph.