IRasterTransform

Description

interface Tinman.Terrain.Georef.IRasterTransform

A IRasterTransform object provides a mapping between raster coordinates and map coordinates.

Raster coordinates refer to locations in a map raster (as defined by a MapInfo) and may be two-dimensional for rectangular rasters or three-dimensional for cubemap rasters. In the rectangular case, raster coordinates are interpreted against MapInfo.Width and MapInfo.Height. In the cubemap case, raster coordinates are interpreted against MapInfo.Size.

Map coordinates are two-dimensional and refer to a geographic, a projected or a local coordinate system, as defined by CoordinateSystem.

Public / Methods

Map​To​Raster


[Pure]
public method MapToRaster → (2)

in : float64

The map X-coordinate.

in : float64

The map Y-coordinate.

returns → Vec3D

The raster coordinates (Vec3D.Z will always be zero for rectangular rasters, see Size).

Translates the given map coordinates to raster coordinates.

Raster​Face


public method RasterFace → (1)

face in : CubemapFace

The cubemap face.

returns → IRasterTransform

The created IRasterTransform object. Will be this if this is a rectangular raster transform, i.e. calling this method on a rectangular raster transform has no effect.

Returns a IRasterTransform that transforms the rectangular input raster to cubemap coordinates when applying this transform.

The output raster coordinates of MapToRaster will be transformed from cubemap coordinates to cubemap face in coordinates and the input raster coordinates of RasterToMap will be transformed from cubemap face in coordinates to cubemap coordinates after resp. before plugging them into this raster transform.

Raster​Offset


public method RasterOffset → (2)

offsetX in : float64

The translation along the rectangular raster X-axis.

offsetY in : float64

The translation along the rectangular raster Y-axis.

returns → IRasterTransform

The resulting raster transform. Will be this if this is a cubemap raster transform, i.e. calling this method on a cubemap raster transform has no effect.

Returns a IRasterTransform that translates the rectangular input raster coordinates when applying this transform.

The given coordinate offsets will be subtracted from the output raster coordinates of MapToRaster and will be added to the input raster coordinates of RasterToMap after resp. before plugging them into this raster transform.

Raster​Scale


public method RasterScale → (2)

scaleX in : float64

The scale factor along the rectangular raster X-axis.

scaleY in : float64

The scale factor along the rectangular raster Y-axis.

returns → IRasterTransform

The resulting raster transform. Will be this if this is a cubemap raster transform, i.e. calling this method on a cubemap raster transform has no effect.

Returns a IRasterTransform that scales the rectangular input raster coordinates when applying this transform.

The output raster coordinates of MapToRaster will be divided by the given scale factors and the input raster coordinates of RasterToMap will be multiplied with the scale factors after resp. before plugging them into this raster transform.

Raster​Size


public method RasterSize → (1)

size in : int32

[pow2]
The desired cubemap raster size.

returns → IRasterTransform

The resulting raster transform. Will be this if this is a rectangular raster transform, i.e. calling this method on a rectangular raster transform has no effect.

Scales the cubemap of this IRasterTransform so that Size returns the same value as the given size in parameter.

Raster​To​Map


[Pure]
public method RasterToMap → (3)

in : float64

The raster X-coordinate.

in : float64

The raster Y-coordinate.

opt : float64 = 0

The raster Z-coordinate (will be ignored for rectangular rasters, see Size).

returns → Vec2D

The resulting map coordinates.

Translates the given raster coordinates to map coordinates.

A raster transform may provide a matrix which can be used to perform an equivalent transformation, see Matrix. If that matrix represents a simple transformation (i.e. composed of scaling and translation), it may be decomposed with IRasterTransform.MatrixDecompose.

Public / Attributes

Matrix


public attribute Matrix → (get)

value : Mat3D

The homogeneous 2D transformation matrix, or Mat3D.Zero iff this raster transform is not rectangular (see Size) or cannot be represented with a matrix.

Returns the homogeneous 2D transformation matrix that corresponds to this rectangular raster transform (i.e. the transformation performed by RasterToMap, where z is zero).

Size


[Constant]
public attribute Size → (get)

value : int32

The size of the cubemap this transform operates on (always a power of two, between MappingUtil.MinSize and MappingUtil.MaxSize) or 0 iff this raster operates on a rectangular raster.

Returns whether this transform operates on a cubemap raster or a rectangular raster.

The map coordinates of a cubemap raster transform are always geographic latitude and longitude, using the angular unit of the associated coordinate system (see CoordinateSystem.GeographicUnit).

The map coordinates of a rectangular raster transform may be geographic latitude and longitude (see CoordinateSystem.IsGeographic), projected easting and northing (see CoordinateSystem.IsProjection) or local X- and Y-axis values (see CoordinateSystem.IsLocal).

Extensions

Map​To​Raster


[Pure]
public static method MapToRaster → (1)

mapXY in : Vec2D

The map coordinates.

returns → Vec3D

The raster coordinates.

Translates the given map coordinates to raster coordinates.

Matrix​Decompose


public static method MatrixDecompose → (4)

allowNonUniformScaling in : bool

Allow different scale factors to be returned for each axis?

allowNegativeScaling in : bool

Allow scale factors to be negative?

scaling out : Vec2D

The scaling coefficients Sx and Sy.

translation out : Vec2D

The translation coefficients Tx and Ty.

returns → bool

true if the matrix has been decomposed,
false if the matrix cannot be decomposed.

Attempts to decompose the matrix transformation of this raster transform into scaling transformation, followed by a translation transformation.

If the raster matrix has the following form, this method will return the scaling and translation coefficients:

/               \
|  Sx   0  Tx   |
|   0  Sy  Ty   |
|   0   0   1   |
\               /

Sx := scale factor along X-axis
Sy := scale factor along Y-axis
Tx := translation along X-axis
Ty := translation along Y-axis

Raster​To​Map

2 overloads


[Pure]
public static method RasterToMap1 → (1)

rasterXY in : Vec2D

The raster coordinates.

returns → Vec2D

The map coordinates.

Translates the given raster coordinates to map coordinates.


[Pure]
public static method RasterToMap2 → (1)

rasterXYZ in : Vec3D

The raster coordinates.

returns → Vec2D

The map coordinates.

Translates the given raster coordinates to map coordinates.

Raster​Wrap


public static method RasterWrap → (2)

map in : MapInfo

The rectangular map for which to fix wrap-around.

transform in : ICoordinateTransform

[not-null]
The rectangular raster transform to fix.

returns → IRasterTransform

The fixed rectangular raster transform.

Fixes coordinate shifts that result from wrap-around of geographic longitude.