import { type TileOpening } from '../catalogs/data/tile-geometry.js'; import type { ScenarioModel } from '../model/scenario-model.js'; /** MoMGameType.TilePixelPerSquare(): 1024 px per 3.5 units */ export declare const MOM_PIXELS_PER_UNIT: number; export type Side = 'N' | 'E' | 'S' | 'W'; export declare const SIDES: Side[]; export declare const SIDE_NAMES: Record; export interface Rect { minX: number; maxX: number; minY: number; maxY: number; } /** An opening in world space: on a tile side, spanning [from, to] along x (N/S) or y (E/W) */ export interface WorldOpening { side: Side; from: number; to: number; kind: TileOpening['kind']; } export interface PlacedTile { name: string; side: string; x: number; y: number; rotation: number; rect: Rect; /** Openings in world coordinates; empty when the tile's artwork is unknown */ openings: WorldOpening[]; /** false for custom images or unknown sides: size or doors could not be determined */ known: boolean; } /** Footprint of a catalog tile side placed at (x, y, rotation) */ export declare function tileRect(side: string, x: number, y: number, rotation: number): Rect | undefined; /** All tiles of the scenario with their world footprint and openings */ export declare function layoutTiles(model: ScenarioModel): PlacedTile[]; export interface Boundary { a: string; b: string; /** Side of tile a that touches tile b */ side: Side; from: number; to: number; /** Stretches where both tiles have an opening (walkable) */ passages: Array<{ from: number; to: number; }>; } /** Tiles sharing an edge, with the stretches where both have an opening */ export declare function findBoundaries(tiles: PlacedTile[]): Boundary[]; /** Area shared by two footprints */ export declare function overlapArea(a: Rect, b: Rect): number; /** * The tile whose footprint contains (x, y), allowing `tolerance` outside the edge (wall tokens sit on borders). * A tile that really contains the point wins over a neighbour that only reaches it through the tolerance. */ export declare function tileAt(tiles: PlacedTile[], x: number, y: number, tolerance?: number): PlacedTile | undefined; export interface PlacementCandidate { x: number; y: number; rotation: number; rect: Rect; /** Door/opening stretches connecting the new tile to the existing one */ passages: Array<{ from: number; to: number; }>; /** Other tiles the candidate would overlap */ overlaps: string[]; /** Length of edge shared with the existing tile */ shared: number; /** shared / the shorter of the two facing edges: 1 when the tiles sit flush */ flush: number; } /** * Positions for `newSide` placed against `existingTile` on `direction`, with the openings of * both tiles lined up. Tries every rotation unless one is given, slides the new tile along the * shared edge to line up each pair of openings (plus flush-corner alignments), and returns the * best candidates first: no overlap with other tiles, a connecting passage, sitting flush * against the existing tile, the widest connection (open edge to open edge), then rotation 0. */ export declare function placeTileRelative(model: ScenarioModel, existingTile: string, direction: 'north' | 'south' | 'east' | 'west', newSide: string, rotation?: number): PlacementCandidate[]; /** * A point in a catalog tile's local coordinates (TILE_CONTENT convention: x east from the west edge, * y south from the north edge, rotation 0) to world coordinates for the tile as placed. */ export declare function localToWorld(tile: Pick, [lx, ly]: [number, number]): [number, number]; /** Inverse of localToWorld */ export declare function worldToLocal(tile: Pick, x: number, y: number): [number, number]; /** Points inside a tile useful for tokens: centre, and just inside each opening (for explore tokens) */ export declare function tileSpots(tile: PlacedTile): { center: [number, number]; openings: Array<{ side: Side; kind: string; x: number; y: number; }>; }; //# sourceMappingURL=layout.d.ts.map