TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class Geometry in Tinman.Terrain.Geometries

Base class for default IGeometry implementations in the Tinman SDK.

abstract class Geometry extends GeometryBase

Public / Attributes

Handedness

Returns the handedness of this geometry object.

[ThreadSafe]
public override property Handedness { get }
type CartesianHandedness
value The coordinate system handedness.
implements GeometryBase.Handedness

Remarks:

The handedness of a geometry is taken into account when vertex normal vectors are computed: Normal vectors are computed from vertex positions using a counter-clockwise winding in heightmap space. Since heightmap space is always right-handed, all computed normal vectors must be flipped when the application uses a left-handed world coordinate system.

Map

Returns a MapInfo value that describes the used map raster.

public property Map { get }
type MapInfo
value The map info value.
inherited GeometryBase.Map

ToGeocentric

Returns an instance of Geocentric that corresponds to this geometry.

public virtual property ToGeocentric { get }
type Geocentric
value The Geocentric object or null if this is a custom geometry object.
inherited GeometryBase.ToGeocentric

Unit

The terrain-space unit.

public virtual property Unit { get }
type UnitOfMeasure
value [not-null] The terrain-space unit.
inherited GeometryBase.Unit

Remarks:

The default unit is Metre.

Public / Constructors

ForCoordinateSystem

Creates a new instance of IGeometry that computes geocentric coordinates based on the given georeference.

public static method ForCoordinateSystem (CoordinateSystem coordSys, MapInfo map, IRasterTransform raster = null)
type IGeometry
params coordSys [not-null] The coordinate system.
  map The map raster.
  raster Optional raster transform. If null, the geometry will be of type Cube; otherwise it will be Rect. Defaults to null.
returns [not-null] The created IGeometry object.

Remarks:

Please refer to Cubemap, LatLon and Geocentric for details on the mapping between terrain-space, heightmap, geographic and geocentric coordinates.

For local coordinate systems (see IsLocal ), this method will delegate to Plane.

ForRaster

Creates a new instance of IGeometry that computes geocentric coordinates based on the given georeference.

public static method ForRaster (Raster raster, MapInfo map)
type IGeometry
params raster [not-null] The georeference.
  map The map raster.
returns [not-null] The created IGeometry object.

Remarks:

Please refer to Cubemap, LatLon and Geocentric for details on the mapping between terrain-space, heightmap, geographic and geocentric coordinates.

For local coordinate systems (see IsLocal ), this method will delegate to Plane.

Plane

Creates a new instance of IGeometry of type Rect that uses a plane as base geometry.

public static method Plane (int32 width, int32 height, float64 scale, UnitOfMeasure unit = null)
type IGeometry
params width [>0] The heightmap width.
  height [>0] The heightmap height.
  scale Scale factor from heightmap coordinates to terrain-space.
  unit The terrain-space unit. If null, Metre will be used. Defaults to null.
returns [not-null] The created IGeometry object.

Remarks:

The positive heightmap space X-axis is mapped to the positive terrain space X-axis, the positive heightmap space Y-axis is mapped to the positive terrain space Z-axis and the heightmap elevation is mapped to the positive terrain space Y-axis. The center sample of the heightmap is mapped to the terrain space origin:

Heightmap space:
----------------

O--------+     +----> X
|(0,0)   |     |
|        |     |
|        |     V
|   (w,h)|
+--------O     Y

Terrain space:
--------------
                  | Z-
 (-w/2,-h/2)      |      (w/2,-h/2)
            +-----+-----+
            |     |     |
            |     |     |
     X- ----+-----0-----+---- X+
            |     |     |
            |     |     |
            +-----+-----+
 (-w/2,-h/2)      |      (w/2,h/2)
                  | Z+

w := Heightmap width, minus one
h := Heightmap height, minus one

Sphere

Creates a new instance of IGeometry that uses a sphere as base geometry.

public static method Sphere (int32 cubeSize, float64 radius, UnitOfMeasure unit = null)
type IGeometry
params cubeSize [pow2+1] The heightmap which will be used with the geometry object.
  radius [>0] Radius of zero-altitude sphere, in terrain-space.
  unit The terrain-space unit. If null, Metre will be used. Defaults to null.
returns [not-null] The created IGeometry object.

Remarks:

Please refer to Cubemap, LatLon and Geocentric for details on the mapping between terrain-space, heightmap, geographic and geocentric coordinates.

Public / Methods

ComputeCoordinates

Computes the heightmap coordinates that correspond to the given geographic coordinates.

[ThreadSafe]
public virtual method ComputeCoordinates (LatLon geographic)
type Vec3D
params geographic The geographic coordinates.
returns The heightmap coordinates or Undefined is this geometry object is not geo-referenced (see ToGeocentric).
inherited GeometryBase.ComputeCoordinates

Computes the heightmap coordinates and elevation that correspond to the given position.

[ThreadSafe]
public abstract method ComputeCoordinates (float64 positionX, float64 positionY, float64 positionZ, out Vec3D heightmap)
type float64
params positionX X-coordinate of position in terrain-space.
  positionY Y-coordinate of position in terrain-space.
  positionZ Z-coordinate of position in terrain-space.
  heightmap Output for heightmap coordinates.
returns The terrain-space elevation, in terrain-space units (see Unit).
inherited GeometryBase.ComputeCoordinates

ComputeLatLon

Computes the geographic coordinates that correspond to the given heightmap coordinates.

[ThreadSafe]
public virtual method ComputeLatLon (float64 heightmapX, float64 heightmapY, float64 heightmapZ)
type LatLon
params heightmapX The heightmap X-coordinate.
  heightmapY The heightmap Y-coordinate.
  heightmapZ The heightmap Z-coordinate.
returns The geographic coordinates or Undefined if this geometry object is not geo-referenced (see ToGeocentric).
inherited GeometryBase.ComputeLatLon

ComputeNorth

Computes the vertex north-vector for the given heightmap coordinates.

[ThreadSafe]
public abstract method ComputeNorth (float64 heightmapX, float64 heightmapY, float64 heightmapZ)
type Vec3D
params heightmapX The heightmap X-coordinate.
  heightmapY The heightmap Y-coordinate.
  heightmapZ The heightmap Z-coordinate.
returns The unit-length vertex north-vector.
inherited GeometryBase.ComputeNorth

Remarks:

The north-vector is perpendicular to the up-vector and points towards the terrain North Pole, which is defined by the implementing class and can assume different meanings.

ComputePosition

Computes the vertex position that corresponds to the given heightmap coordinates and elevation.

[ThreadSafe]
public abstract method ComputePosition (float64 heightmapX, float64 heightmapY, float64 heightmapZ, float64 elevation, out Vec3D position, out Vec3D up)
params heightmapX The heightmap X-coordinate.
  heightmapY The heightmap Y-coordinate.
  heightmapZ The heightmap Z-coordinate.
  elevation The terrain-space elevation, in terrain-space units (see Unit).
  position Output for vertex position.
  up Output for unit-length up-vector.
returns The vertex position.
inherited GeometryBase.ComputePosition

ComputeUp

Computes the vertex up-vector for the given heightmap coordinates.

[ThreadSafe]
public virtual method ComputeUp (float64 heightmapX, float64 heightmapY, float64 heightmapZ)
type Vec3D
params heightmapX The heightmap X-coordinate.
  heightmapY The heightmap Y-coordinate.
  heightmapZ The heightmap Z-coordinate.
returns The unit-length vertex up-vector.
inherited GeometryBase.ComputeUp

ToHandedness

Transforms this geometry to the given handedness by flipping the Z-axis if necessary.

public virtual method ToHandedness (CartesianHandedness handedness)
type IGeometry
params handedness The requested handedness.
returns [not-null] The resulting geometry.
inherited GeometryBase.ToHandedness

Transform

Creates a geometry that transforms the output coordinates of this geometry with the given matrix.

public virtual method Transform (Mat4D matrix)
type IGeometry
params matrix The transformation matrix.
returns [not-null] The resulting geometry.
inherited GeometryBase.Transform

Protected / Constructors

Geometry

Creates a new instance of Geometry for Cube.

protected constructor Geometry (int32 size)
params size [pow2+1] The map size.

Creates a new instance of Geometry for Rect.

protected constructor Geometry (int32 width, int32 height)
params width [>0] The map width.
  height [>0] The map height.