VerticalRange

Description

struct Tinman.Terrain.Heightmaps.VerticalRange

Mapping of normalized elevation values (i.e. the range -/+ HeightmapSample.MaxValue30) to vertical coordinates in a given range (for example -1000 to +9000) in terms of some vertical coordinate system (see CoordinateSystem.Vertical).

Normalized and terrain-space elevation values are always tied at zero, independent of the given minimum and maximum elevation values (see Minimum and Maximum). For the example range of -1000 to +9000, the normalized elevation zero is mapped to 0, the normalized elevation HeightmapSample.MaxValue30 is mapped to +9000 and the negative value of HeightmapSample is mapped to -9000. The actual minimum and maximum bounds become important when elevation values are encoded in a heightmap dataset, especially when using a low bit-depth.

See also

PixelRange

Public / Constants

Default


public static readonly attribute Default → (VerticalRange)

The default elevation range for terrains.

Altitude range: [-10000..10000] units.

None


public static readonly attribute None → (VerticalRange)

No vertical range (i.e. no elevation data).

Public / Constructors

Vertical​Range


public constructor VerticalRange → (2)

first in : float64

The first terrain-space elevation value.

second in : float64

The second terrain-space elevation value.

Creates a new instance of VerticalRange.

Public / Methods

Denormalize​Elevation


[Pure]
public method DenormalizeElevation → (1)

elevation in : int64

The normalized heightmap elevation value.

returns → float64

The real-world elevation value.

Transforms the given normalized heightmap elevation value to the corresponding real-world elevation value.

Merge


[Pure]
public method Merge → (1)

other in : VerticalRange

The range to merge with.

returns → VerticalRange

The smallest possible vertical range that contains this range and the given one.

Merges this vertical range with the given one.

Normalize​Elevation


[Pure]
public method NormalizeElevation → (1)

elevation in : float64

The real-world elevation value.

returns → int64

The unclamped normalized heightmap elevation value.

Transforms the given real-world elevation value to the corresponding normalized heightmap elevation value.

Normalize​Elevation​Clamp


[Pure]
public method NormalizeElevationClamp → (1)

elevation in : float64

The real-world elevation value.

returns → int32

The normalized heightmap elevation value, clamped to +/- HeightmapSample.MaxValue30.

Transforms the given real-world elevation value to the corresponding normalized heightmap elevation value.

Scale


[Pure]
public method Scale → (1)

factor in : float64

The scale factor.

returns → VerticalRange

The resulting vertical range.

Scales this vertical range.

To​Pixel​Range


[Pure]
public method ToPixelRange → ()

returns → PixelRange

The PixelRange value.

Converts this VerticalRange value to a PixelRange value.

None is mapped to PixelRange.Identity. Otherwise, First and Second are mapped to the normalized pixel values 0 and 16777215, respectively.

Transform


[Pure]
public method Transform → (2)

source in : UnitOfMeasure

The source vertical unit or null.

target opt : UnitOfMeasure = null

The target vertical unit or null.

returns → VerticalRange

The resulting vertical range.

Transforms this vertical range from one vertical unit to another.

This method assumes that this vertical range is expressed in source in units; then the returned vertical range will be expressed in target opt units. If source in and/or target opt is null, UnitOfMeasure.Metre will be used instead.

Public / Attributes

Elevation


public attribute Elevation → (get)

value : float64

The scale factor for normalized elevation values.

Returns the factor by which normalized elevation values of this range must be multiplied in order to translate them to terrain-space elevation values.

First


public attribute First → (get)

value : float64

The first elevation value, in terrain-space.

The first terrain-space elevation value.

The elevation value is interpreted as relative height above the base geometry. The base geometry is usually an ellipsoid.

Maximum


public readonly attribute Maximum → (float64)

The maximum terrain-space elevation value.

The elevation value is interpreted as relative height above the base geometry. The base geometry is usually an ellipsoid.

Minimum


public readonly attribute Minimum → (float64)

The minimum terrain-space elevation value.

The elevation value is interpreted as relative height above the base geometry. The base geometry is usually an ellipsoid.

Range


public attribute Range → (get)

value : float64

[>=0]
The terrain-space elevation range: [-Range..Range].

The terrain-space elevation value range.

Second


public attribute Second → (get)

value : float64

The second elevation value, in terrain-space.

The second terrain-space elevation value.

The elevation value is interpreted as relative height above the base geometry. The base geometry is usually an ellipsoid.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<VerticalRange>

[not-null]
The configurator object.

The configurator object for this type.

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<VerticalRange>)

The serialization helper object for values of VerticalRange.