MappingUtil

Description

static class Tinman.Terrain.Mapping.MappingUtil

Helper class for this module.

Public / Constants

Max​Size


public constant MaxSize → (1073741824:int32)

Maximum map raster size.

See also

MapInfo

Min​Size


public constant MinSize → (256:int32)

Minimum map raster size.

See also

MapInfo

Public / Methods

Compute​Shift​To​Max​Size


[Pure]
public static method ComputeShiftToMaxSize → (1)

size in : int32

[pow2]
The raster size of the map.

returns → int32

The number of bits to shift.

Computes the number of bits to shift in order to scale the coordinates of a map raster of the given size in to a map raster of MaxSize.

Compute​Size


[Pure]
public static method ComputeSize → (3)

width in : int32

The raster width.

height opt : int32 = 0

The raster height.

minSize opt : int32 = MappingUtil.MinSize

The minimum size.

returns → int32

The raster size.

Computes the internal raster size for the given raster width and height.

Midpoint

3 overloads


[Pure]
public static method Midpoint1 → (2)

in : Vec2I

First point.

in : Vec2I

Second point.

returns → Vec2I

The midpoint.

Computes the map coordinates of the point that lies halfway between in and in.


[Pure]
public static method Midpoint2 → (2)

in : Vec3I

First point.

in : Vec3I

Second point.

returns → Vec3I

The midpoint.

Computes the map coordinates of the point that lies halfway between in and in.


[Pure]
public static method Midpoint3 → (2)

in : int32

First coordinate.

in : int32

Second coordinate.

returns → int32

The midpoint coordinate.

Computes the map coordinate that lies halfway between in and in.

Valid


[Pure]
public static method Valid → (3)

type in : MapType

The map type.

width in : int32

The map width.

height in : int32

The map height.

returns → bool

true if the combination is valid, false if not.

Checks if the given combination of map type, width and height is valid.

Wrap


[Pure]
public static method Wrap → (3)

coords in : Vec2D

The map coordinates.

wrapX in : MapWrap

Wrapping along X-axis.

wrapY in : MapWrap

Wrapping along Y-axis.

returns → Vec2D

The wrapped coordinates or Vec3D.Undefined if coords in are out of the valid map bounds.

Performs wrapping on the given map coordinates.