MapInfo

Description

struct Tinman.Terrain.Mapping.MapInfo

Provides information about a map raster.

A map raster is a lattice of evenly spaced data points (the spacing is defined as 1):

(0|0)
  O---O---O---O---O
  |   |   |   |   |
  O---O---O---O---O     O := data point
  |   |   |   |   |     w := raster width  (here: 4)
  O---O---O---O---O     h := raster height (here: 3)
  |   |   |   |   |
  O---O---O---O---O
                (w|h)

The raster width resp. height always refers to the edge length of the map (in spacing units), regardless of the Coverage semantic of the underlying dataset; which can be a geocoded image (see IImage), a heightmap (see IHeightmap) or a pyramid (see IPyramid).
The raster size may differ from the number of dataset samples along each axis: A dataset with countX resp. countY samples along the X-axis resp. Y-axis will have these raster dimensions:

  • PixelCoverage.PixelIsArea:
    The raster width will be countX and the raster height will be countY. A dataset sample identified by the coordinates (x,y) represents a unit square in raster space, covering the area (x,y) to (x+1,y+1).

  • PixelCoverage.PixelIsPoint:
    The raster width will be countX-1 and the raster height will be countY-1. A dataset sample identified by the coordinates (x,y) represents a point in raster space at (x,y).

The minimum resp. maximum raster size for a map is MappingUtil.MinSize resp. MappingUtil.MaxSize.

Map rasters can be rectangular or cubic (see MapType).

    (0|0)         (w|0) (s|0)
      +-------------+-----+              Y-
      |             |     |              |
      |             |     |              |
      |             |     |        X- ---O--- X+
      |             |     |              |
      |             |     |              |
(0|h) +-------------+     |              Y+
      |           (w|h)   |
      |                   |        w := raster width
      |                   |        h := raster height
      +-------------------+        s := internal raster size (power of two)
    (0|s)               (s|s)

The raster width w and height h of rectangular maps can have arbitrary values. The internal size s however is always a power of two and is greater than or equal to both w and h.

    (0|0|s)               (s|0|s)
          +-------------+            Y- |  / Z+
         /|            /|               | /
        / |           / |               |/
(0|0|0)/  |   (s|0|0)/  |        X- ----O---- X+
      +-------------+   |              /|
      |   |         |   |             / |
      |   +---------|---+         Z- /  | Y+
      |  /(0|s|s)   |  /(s|s|s)
      | /           | /          s := cubemap raster size (power of two)
      |/            |/           w := s
      +-------------+            h := s
(0|s|0)             (s|s|0)

The raster size s of a cubemap is always a power of two, and the raster width w and raster height h are equal to s.

Public / Constructors

Cube


[Pure]
public static method Cube → (2)

size opt : int32 = MappingUtil.MaxSize

[pow2]
The raster size.

coverage opt : PixelCoverage = PixelCoverage.PixelIsPoint

The pixel coverage of the underlying dataset.

returns → MapInfo

The map info value.

Creates a new instance of MapInfo for a cubic map raster (see MapType.Cube).

For


[Pure]
public static method For → (4)

type in : MapType

The map type.

width in : int32

[>0]
The raster width.

height in : int32

[>0]
The raster height.

coverage opt : PixelCoverage = PixelCoverage.PixelIsPoint

The pixel coverage of the underlying dataset.

returns → MapInfo

The map info value.

Creates a new instance of MapInfo for the given map type.

Rect


[Pure]
public static method Rect → (3)

width in : int32

[>0]
The raster width.

height in : int32

[>0]
The raster height.

coverage opt : PixelCoverage = PixelCoverage.PixelIsPoint

The pixel coverage of the underlying dataset.

returns → MapInfo

The map info value.

Creates a new instance of MapInfo for a rectangular map raster (see MapType.Rect).

Public / Attributes

Coverage


public readonly attribute Coverage → (PixelCoverage)

The pixel coverage semantic of the underlying dataset.

For PixelCoverage.PixelIsPoint, dataset coordinates and raster coordinates are equivalent.

For PixelCoverage.PixelIsArea, the following relationship between dataset coordinates and raster coordinates exists:

raster  = dataset + 0.5
dataset = raster  - 0.5

where dataset resp. raster is a component of the dataset coordinates resp. raster coordinates.

Dataset


public attribute Dataset → (get)

value : Vec2I

The dataset size, in dataset samples.

Returns the corresponding dataset size.

Face​First


public attribute FaceFirst → (get)

value : CubemapFace

The minimum CubemapFace value.

Returns the minimum CubemapFace of the map.

Face​Last


public attribute FaceLast → (get)

value : CubemapFace

The maximum CubemapFace value.

Returns the maximum CubemapFace of the map.

Height


public readonly attribute Height → (int32)

The raster height of the map (edge length, not sample count).

Size


public readonly attribute Size → (int32)

The internal resp. cubemap raster size of the map (always a power of two).

Type


public readonly attribute Type → (MapType)

The type of the map (rectangular or cubic).

Width


public readonly attribute Width → (int32)

The raster width of the map (edge length, not sample count).