toTileCoordinate

fun Point.toTileCoordinate(tileSize: Double = 1.0, originOffset: Point = Point.ORIGIN): TileCoordinate

Converts a continuous world Point to the TileCoordinate of the tile cell that contains it.

Uses floor division so that points within tileSize of a grid line map to the correct cell, including negative coordinates.

Parameters

tileSize

World units per tile side (default 1.0, must be positive)

originOffset

World position of the grid's (0,0) corner (default Point.ORIGIN)