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

class Heightmap in Tinman.Terrain.Heightmaps

Abstract base class for IHeightmap implementations.

abstract class Heightmap extends Disposable
  implements IHeightmap
  base of CompositeHeightmapOne
  CompositeHeightmapTwo
  MandelbrotHeightmap
  RandomHeightmap
  TestPatternHeightmap

Configuration

Config

The configurator object for this type.

public static property Config { get }
type IConfigurator<IHeightmap>
value [not-null] The configurator object.

ToConfig

Returns the configuration value that describes this object.

public virtual method ToConfig ()
type ConfigValue
returns [not-null] The configuration value.
implements IConfigurable.ToConfig

Remarks:

All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.

The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.

Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.

Public / Constants

Datasets

The shared collection of heightmap datasets.

public static readonly field Datasets
type HeightmapCollection

Public / Attributes

CanUpdate

Does this map allow updates to its content (i.e. sample data and/or metadata)?

public virtual property CanUpdate { get }
type bool
value true if the map content can be updated, false if not.
implements IMapEntity.CanUpdate

Georef

Returns georeferencing information.

public virtual property Georef { get }
type Raster
value The georeferencing object or null if no georeferencing is available.
implements IGeorefInfo.Georef

Height

Number of heightmap samples along the Y-axis.

public property Height { get }
type int32
value [>0] Heightmap height, in samples.
implements IHeightmap.Height

Horizontal

Returns the estimated horizontal resolution in terrain-space.

public virtual property Horizontal { get }
type float64
value [>0] The ground sample distance, in Metre.
implements IHeightmap.Horizontal

See also:

IGeorefInfo.Georef

IsEmpty

Is this an immutable heightmap which only contains default sample data?

public virtual property IsEmpty { get }
type bool
value true if all samples of this heightmap are equal to Default, false if not.
implements IHeightmap.IsEmpty

IsScaled

Has this heightmap been scaled (either directly or indirectly)?

public virtual property IsScaled { get }
type bool
value true if the heightmap contains scaled data, false if not.
implements IHeightmap.IsScaled

See also:

IHeightmapOps.Scale

LayerMask

The mask of heightmap layers this object uses.

public abstract property LayerMask { get }
type HeightmapLayer
value Bitwise combination of HeightmapLayer values.
implements IHeightmapLayers.LayerMask

Remarks:

These heightmap layers store actual terrain data:

Missing data is represented with the Coverage layer. It describes how much information is present in a stored heightmap sample. The semantics of coverage with heightmap samples is the same as premultiplied alpha with texture samples. A LayerMask without Coverage means that all samples are fully solid. If a LayerMask contains the Coverage layer but no others, the coverage values are used to represent 'holes' in the terrain (e.g. creating holes for caves, tunnels, etc.).

LifecycleState

Returns the lifecycle state of this object.

public virtual property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited Disposable.LifecycleState

Map

Returns a MapInfo value that describes the used map raster.

public virtual property Map { get }
type MapInfo
value The map info value.
implements IMapInfo.Map

OnUpdated

Event for listening to updates made to this heightmap.

public property OnUpdated { get }
type IEventGeneric<HeightmapEventArgs>
value [not-null] The event object.
implements IHeightmap.OnUpdated

Remarks:

This event will be fired by the thread that performs the map update.

Size

Cubemap size of heightmap.

public property Size { get }
type int32
value [pow2+1] Heightmap size, in samples.
implements IHeightmap.Size

Type

The heightmap type (rectangular or cubic).

public property Type { get }
type MapType
value The heightmap type.
implements IHeightmap.Type

Vertical

Returns the terrain-space range of elevation values.

public virtual property Vertical { get }
type VerticalRange
value The terrain-space elevation range, in vertical units (see VerticalUnit).
implements IHeightmap.Vertical

Remarks:

The default value is Default if Elevation or Displacement is present and None otherwise.

Width

Number of heightmap samples along the X-axis.

public property Width { get }
type int32
value [>0] Heightmap width, in samples.
implements IHeightmap.Width

Public / Constructors

Builder

Builds a heightmap of type Cube.

public static method Builder (int32 size)
type HeightmapBuilder
params size [pow2+1] The cubemap size.
returns [not-null] The heightmap builder object.

Builds a heightmap for the given map raster.

public static method Builder (MapInfo map)
type HeightmapBuilder
params map The map raster.
returns [not-null] The heightmap builder object.

Builds a heightmap of type Rect.

public static method Builder (int32 width, int32 height, PixelCoverage coverage = PixelCoverage.PixelIsPoint)
type HeightmapBuilder
params width [>0] The map width.
  height [>0] The map height.
  coverage The sample coverage of the rectangular heightmap. Defaults to PixelIsPoint.
returns [not-null] The heightmap builder object.

Public / Methods

AcquireTry

Acquires a strong reference to this disposable object.

[OwnerReturn, ThreadSafe]
public method AcquireTry ()
type IDisposable
returns this if a new strong reference has been acquired, null if this object is already being disposed.
inherited Disposable.AcquireTry

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Border

Pads this heightmap to the smallest fitting size of 2^n+1.

[OwnerReturn, OwnerThis]
public virtual method Border (HeightmapSample borderSample, int32 borderFalloff)
type IHeightmap
params borderSample The border heightmap sample.
  borderFalloff [>0] Width of the border falloff region, in heightmap samples.
returns [not-null] The padded heightmap.
implements IHeightmapOps.Border

Remarks:

This method will add a border region at the right and bottom edges of a rectangular heightmap (see Rect). A smooth falloff is computed at the heightmap edges in order to avoid unnecessary triangles being created by CLOD mesh refinement for overly sharp corners.

Clip

Clips away portions of this heightmap, according to the Coverage layer of the given heightmap.

[OwnerReturn, OwnerThis]
public virtual method Clip ([Owner] IHeightmap mask, bool inverse = false)
type IHeightmap
params mask [not-null] The heightmap that is used as the clip mask (see remarks).
  inverse Invert the coverage values in mask before clipping? Defaults to false.
returns [not-null] The resulting heightmap.
implements IHeightmapOps.Clip

Remarks:

The coverage values of the returned heightmap are computed like this:

inverse == false : c_out = c_in * c_mask
inverse == true  : c_out = in * (1 - c_mask)
where c_out is the normalized coverage value (i.e. in the range [0..1]) of the returned heightmap, c_in is the normalized coverage value of this heightmap and c_arg is the normalized coverage value of mask.

Combine

Adds detail to this heightmap by combining it with the given heightmap.

[OwnerReturn, OwnerThis]
public method Combine ([Owner] IHeightmap detail, ColorOp textureOp = ColorOp.Blend)
type IHeightmap
params detail [not-null] The detail heightmap.
  textureOp The color operation to apply to the Texture layer, if present. Defaults to Blend.
returns [not-null] The resulting heightmap.
implements IHeightmapOps.Combine

Remarks:

The heightmap samples of this heightmap (source) are modified using the samples of the given detail heightmap (detail) according to these rules:

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
public method Dispose ()
inherited Disposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

Flush

Flushes all cached data.

public virtual method Flush ()
implements IFlushable.Flush

Remarks:

Performing a flush may result in I/O work. Depending on the semantics of the implementing class, this work may need to be wrapped in special Begin / End method calls. See the documentation of the implementing classes for details.

In case this object represents a read-only resource, calling the Flush method has no effect.

GetRegion

Reads a block of samples from the heightmap.

[ThreadSafe]
public method GetRegion (CubemapFaceRect region, HeightmapLayer layers = HeightmapLayer.All, int32 step = 1, HeightmapRegion buffer = null, int32 bufferX = 0, int32 bufferY = 0, bool smooth = false)
type HeightmapRegion
params region The rectangular cubemap face region to fetch.
  layers The heightmap layers to fetch. Defaults to All.
  step [pow2] Step distance between samples in region. Defaults to 1.
  buffer The output heightmap sample buffer. If null or too small, a new buffer will be created. Defaults to null.
  bufferX [>=0] X-coordinate of top-left corner of target rectangle in buffer. Defaults to 0.
  bufferY [>=0] Y-coordinate of top-left corner of target rectangle buffer. Defaults to 0.
  smooth Apply smooth filtering?
returns The heightmap buffer or null if there are no samples to fetch and buffer is null.
implements IHeightmap.GetRegion

Remarks:

The region coordinates will be aligned to the closest multiple of the step distance. See StepAlign for details.

All heightmap samples that lie outside of the valid coordinate range of this heightmap have a Coverage of 0.

Only the heightmap layers (excluding Coverage) present in layers and the LayerMask of this heightmap will be filled in buffer. The Coverage layer will be filled if it is contained in layers, regardless of whether it is defined by LayerMask or not.

This method will not set Horizontal or Vertical in buffer resp. the returned buffer. The calling code is responsible for doing so if necessary.

See also:

IHeightmap.HasRegion

GetSample

Reads a single sample from the heightmap.

[ThreadSafe]
public method GetSample (int32 x, int32 y, int32 z = 0)
type HeightmapSample
params x X-coordinate of sample.
  y Y-coordinate of sample.
  z Z-coordinate of sample. Defaults to 0 (i.e. NegZ).
implements IHeightmap.GetSample

Remarks:

The returned heightmap sample will store values for each layer in LayerMask, all other values will have their respective default value. If the heightmap sample lies outside of the valid coordinate range of this heightmap, it will have a Coverage of 0, even if LayerMask does not contain the Coverage layer.

GetSamples

Reads multiple samples from the heightmap in a bulk operation.

[ThreadSafe]
public method GetSamples (Vec3I[] xyz, int32 count, HeightmapSamples buffer, HeightmapLayer layers = HeightmapLayer.All)
params xyz [not-null] Array of cubemap coordinates of heightmap map samples to fetch. The coordinates must be specified for a heightmap of size MaxSize. Each heightmap implementation will translate these normalized coordinates into its own size using bit shifting. This way the coordinates array can be shared by heightmaps of different sizes.
  count [>=0] Total number of heightmap samples to fetch.
  buffer [not-null] The heightmap sample buffer to use. If null or too small, a new buffer will be created.
  layers The heightmap layers to fetch. Defaults to All.
implements IHeightmap.GetSamples

Remarks:

All heightmap samples that lie outside of the valid coordinate range of this heightmap will have a Coverage or 0.

Only the heightmap layers (excluding Coverage) present in layers and the LayerMask of this heightmap will be filled in buffer. The Coverage layer will be filled if it is contained in layers, regardless of whether it is defined by LayerMask or not.

HasRegion

Determines if this heightmap contains data in the given region.

[ThreadSafe]
public method HasRegion (CubemapFaceRect region, CoverageFlags flags = CoverageFlags.Some)
type CoverageFlags
params region The region to check for data.
  flags The coverage flags that need to be determined. Using specific flags here will allow implementations to early-exit. Defaults to Some (i.e. all flags).
returns The resulting flag bits (contains at least those bits defined by flags ).
implements IHeightmap.HasRegion

Remarks:

The following semantic relaxations can be exploited by implementing methods in order to improve performance:

Merge

Merges the given heightmap with this one. The coverage of both heightmaps will be taken into account during merging.

[OwnerReturn, OwnerThis]
public method Merge ([Owner] IHeightmap second)
type IHeightmap
params second [not-null] The second heightmap.
returns [not-null] The resulting heightmap.
implements IHeightmapOps.Merge

Remarks:

Merged heightmaps fill data into heightmap samples in order, with heightmaps at a later stage overwriting sample data written by heightmaps of an earlier stage.

Both heightmaps (this one and second) will be scaled to the maximum possible size.


Merges the given heightmaps.

[OwnerReturn]
public static method Merge ([Owner] IHeightmap first, [Owner] IHeightmap second)
type IHeightmap
params first The first heightmap or null.
  second The second heightmap or null.
returns The resulting heightmap or null if both input heightmaps are null.

See also:

IHeightmapOps.Merge

Scale

Returns a scaled version of this heightmap.

[OwnerReturn, OwnerThis]
public virtual method Scale (int32 newSize)
type IHeightmap
params newSize [pow2+1] The scaled internal size (see Type). The minimum internal size is MinSize.
returns [not-null] The scaled heightmap.
implements IHeightmapOps.Scale

Remarks:

The maximum upscaling factor for heightmaps is 65536, so the given condition should be met when upscaling a heightmap (otherwise only the 16 most significant bits of the interpolation factor will be used):

(newSize - 1) / (Size - 1) <= 65536
where newSize is the new heightmap size and Type is the current size of this heightmap.

Split

Splits the layers of this heightmap.

[OwnerReturn, OwnerThis]
public method Split (HeightmapLayer layers)
type IHeightmap
params layers The heightmap layers to retain in the split heightmap.
returns [not-null] The resulting heightmap.
implements IHeightmapOps.Split

ToPyramid

Wraps this heightmap in a pixel pyramid.

[OwnerReturn, OwnerThis]
public virtual method ToPyramid (int32 tileSize = 256, int32 tilePad = 0, int32 levels = 0, IPixelLayer pixelLayer = null, PyramidFlags flags = PyramidFlags.None)
type IPixelPyramid
params tileSize [pow2] The tile size. Defaults to 256.
  tilePad [>=0] The tile padding. Defaults to 0.
  levels [>=0] Defines how many pyramid levels (starting at the bottommost level) shall contain data. The heightmap sample step is 1 for the bottommost level and is multiplied by two for each parent level. If 0, all pyramid levels will contain data. Defaults to 0.
  pixelLayer Optional pixel layer to use. Defaults to null.
  flags Optional pyramid flags. Defaults to None.
returns [not-null] The pixel pyramid.
implements IHeightmapOps.ToPyramid

TransformRange

Translates the normalized elevation values of this heightmap to the given range.

[OwnerReturn, OwnerThis]
public virtual method TransformRange (VerticalRange range, UnitOfMeasure unit = null, bool reinterpret = false)
type IHeightmap
params range The range to translate to (see Vertical).
  unit The vertical unit of range. If null, Metre will be used. Defaults to null.
  reinterpret Keep elevation values of this heightmap and reinterpret them according to range and unit, instead of scaling them? Defaults to false.
returns [not-null] The resulting heightmap.
implements IHeightmapOps.TransformRange

UpdateGeoref

Updates georeferencing data of this heightmap.

[ThreadSafe]
public virtual method UpdateGeoref (Raster georef)
params georef The new georeferencing data or null.
implements IMapEntity.UpdateGeoref

See also:

IMapEntity.CanUpdate

UpdateRange

Updates the vertical range of this heightmap.

[ThreadSafe]
public virtual method UpdateRange (VerticalRange range)
params range The new vertical range.
implements IHeightmap.UpdateRange

See also:

IMapEntity.CanUpdate

UpdateRegion

Updates a region of this heightmap in an atomic operation.

[ThreadSafe]
public method UpdateRegion (CubemapFaceRect region, HeightmapRegion buffer, HeightmapRegionDelegate combine = null, HeightmapLayer layers = HeightmapLayer.All, int32 bufferX = 0, int32 bufferY = 0, object userData = null)
params region The cubemap face region to update.
  buffer [not-null] The heightmap sample buffer to use (see remarks).
  combine Optional delegate for combining source and target heightmap samples. Defaults to null.
  layers The heightmap layers to update.
  bufferX [>=0] X-coordinate of top-left sample in buffer to use. Defaults to 0.
  bufferY [>=0] Y-coordinate of top-left sample in buffer to use. Defaults to 0.
  userData Optional user data object to pass to combine. Defaults to null.
implements IHeightmap.UpdateRegion

Remarks:

Depending on the values passed to buffer and combine, the following operation is performed by this method:

See also:

IMapEntity.CanUpdate

UseColorRamp

Return a heightmap that computes texture colors using an elevation-based color ramp.

[OwnerReturn, OwnerThis]
public virtual method UseColorRamp (IColorRamp colorRamp)
type IHeightmap
params colorRamp [not-null] The color ramp to use.
returns [not-null] The resulting heightmap.
implements IHeightmapOps.UseColorRamp

Remarks:

The terrain-space values of the Elevation layer (according to the vertical range and unit of the heightmap) are fed into the color ramp. The resulting diffuse color is used as the Texture layer.

Protected / Attributes

height

The height of the heightmap.

protected field height
type int32

Remarks:

This value is set by Initialize.

isCube

Is this map of type Cube?

protected field isCube
type bool

Remarks:

This value is set by Initialize.

mapType

The type of the heightmap (rectangular or cube).

protected field mapType
type MapType

Remarks:

This value is set by Initialize.

maxSizeMask

Bitmask for aligning coordinates to the size of this heightmap.

protected field maxSizeMask
type int32

Remarks:

This value is set by Initialize.

A binary and with this bitmask has the same effect as doing a right-shift of maxSizeShift bits followed by a left-shift of the same bit count.

maxSizeScale

Scale factor to apply to coordinates of this map in order to translate them to MaxSize.

protected field maxSizeScale
type int32

Remarks:

This value is set by Initialize.

maxSizeShift

Shift amount to apply to coordinates of this map in order to translate them to MaxSize.

protected field maxSizeShift
type int32

Remarks:

This value is set by Initialize.

According to MinSize and MaxSize, this value will always be in the range [0..22].

maxSizeX

Maximum cubemap face X-coordinate of this heightmap, given for MaxSize.

protected field maxSizeX
type int32

maxSizeY

Maximum cubemap face Y-coordinate of this heightmap, given for MaxSize.

protected field maxSizeY
type int32

onUpdated

The event object of OnUpdated.

[Owner]
protected field onUpdated
type EventGeneric<HeightmapEventArgs>

size

The internal size of the heightmap.

protected field size
type int32

Remarks:

This value is set by Initialize.

sizeMinusOne

The internal size of the heightmap, minus one.

protected field sizeMinusOne
type int32

Remarks:

This value is set by Initialize.

width

The width of the heightmap.

protected field width
type int32

Remarks:

This value is set by Initialize.

Protected / Constructors

Heightmap

protected constructor Heightmap ()

Protected / Methods

AssertSameSize

protected method AssertSameSize (Heightmap other)
params other

DisposeManaged

Disposes the managed resources held by a concrete subclass. This method will be called at most once per subclass.

protected override method DisposeManaged ()
overrides Disposable.DisposeManaged

Remarks:

This method will only be called when a disposable object is explicitly destroyed by user code calling the Dispose method. It will not be called when the object is collected as garbage by the system.

Overriding methods must call the DisposeManaged method of their base class. The base call should be the last statement.

The DisposeManaged method is called before the DisposeUnmanaged method.

DisposeUnmanaged

Disposes the unmanaged resources held by a concrete subclass. This method will be called exactly once per subclass.

protected virtual method DisposeUnmanaged ()
inherited Disposable.DisposeUnmanaged

Remarks:

Overriding methods must call the DisposeUnmanaged method of their base class. The base call should be the last statement.

The DisposeUnmanaged method is called after the DisposeManaged method.

DoGetRegion

Fetches a rectangular region of heightmap samples.

protected virtual method DoGetRegion (CubemapFaceRect region, int32 step, HeightmapRegion buffer, int32 bufferX, int32 bufferY, int32 bufferWidth, int32 bufferHeight, HeightmapLayer layers, bool smooth)
params region The rectangular region to fetch (already aligned to step).
  step The step value between samples. This is always a power of two (including 1).
  buffer The output heightmap buffer.
  bufferX X-coordinate of top-left pixel in buffer to set.
  bufferY Y-coordinate of top-left pixel in buffer to set.
  bufferWidth Width of buffer region to fetch.
  bufferHeight Height of buffer region to fetch.
  layers The heightmap layers to fetch. Will contain one or more layers of this heightmaps LayerMask.
  smooth Use smooth interpolation?

Remarks:

The default implementation fetches each sample individually, which is slow. Subclasses are encouraged to provide an optimized implementation for this method.

The heightmap coordinate range given by region will always be fully inside of the valid coordinate range of this heightmap.

The given buffer is guaranteed to contain at least all layers of the intersection of the specified layers and the LayerMask of this heightmap.

DoGetSample

Returns a single heightmap sample.

protected abstract method DoGetSample (int32 x, int32 y, int32 z)
type HeightmapSample
params x X-coordinate of heightmap sample.
  y Y-coordinate of heightmap sample.
  z Z-coordinate of heightmap sample (for Cube).
returns The heightmap sample.

Remarks:

The default implementations of DoGetSamples and DoGetRegion use of this method. This is convenient but will most likely be very slow. It is better to also provide optimized implementations for DoGetSamples and DoGetRegion.

The x, and y and z coordinates will always be within the valid bounds of this heightmap.

See also:

DoGetSamples
DoGetRegion

DoGetSamples

Fetches a series of heightmap samples.

protected virtual method DoGetSamples (Vec3I[] xyz, int32 count, HeightmapSamples buffer, HeightmapLayer layers)
params xyz The heightmap sample coordinates (given for a heightmap of size MaxSize).
  count Number of samples to fetch.
  buffer The output heightmap buffer.
  layers The heightmap layers to get.

Remarks:

The default implementation fetches each sample individually, which is slow. Subclasses are encouraged to provide an optimized implementation for this method.

The given buffer is guaranteed to contain at least all layers of the intersection of the specified layers and the LayerMask of this heightmap.

DoHasRegion

Checks if this heightmap contains samples in the given region.

protected abstract method DoHasRegion (CubemapFaceRect region, CoverageFlags flags)
type CoverageFlags
params region The step-aligned cubemap face region.
  flags The coverage flags that need to be determined.
returns The result of the check.

Remarks:

The given region will never be empty (see IsEmpty) and its bounds will always be inside of its cubemap face (see Face).

DoSetRegion

Stores a rectangular region of heightmap samples.

[EmptyBody]
protected virtual method DoSetRegion (CubemapFaceRect region, HeightmapRegion buffer, int32 bufferX, int32 bufferY, HeightmapLayer layers)
params region The rectangular region to fetch.
  buffer The output heightmap buffer.
  bufferX X-coordinate of top-left pixel in buffer to set.
  bufferY Y-coordinate of top-left pixel in buffer to set.
  layers The heightmap layers to fetch. Will contain one or more layers of this heightmaps LayerMask.

Remarks:

The heightmap coordinate range given by region will always be fully inside of the valid coordinate range of this heightmap.

The given buffer is guaranteed to contain at least all layers of the intersection of the specified layers and the LayerMask of this heightmap.

DoSplit

Filters this heightmap by retaining only the given heightmap layers.

[OwnerReturn, OwnerThis]
protected virtual method DoSplit (HeightmapLayer layers)
type IHeightmap
params layers The heightmap layers to retain.
returns [not-null] The resulting heightmap.

Remarks:

The given layers will never be None and will always be a subset of this heightmaps LayerMask.

Initialize

Initializes the map to the size and type of the given IHeightmap object.

protected method Initialize (IHeightmap map)
params map [not-null] The IHeightmap object.

Initializes the heightmap to the given type and size.

protected method Initialize (MapType type, int32 size, int32 width = 0, int32 height = 0)
params type The heightmap type.
  size [>=0] The internal size, in samples.
  width [>=0] The heightmap width, in samples. If 0, the internal size will be used.
  height [>=0] The heightmap height, in samples. If 0, the internal size will be used.

Remarks:

The internal size of this heightmap will be set to the maximum of size, width and height, clamped to the next power of two plus one between MinSize and MaxSize.

UpdateRegion_Lock

[EmptyBody]
protected virtual method UpdateRegion_Lock (Box3I region)
params region

UpdateRegion_Unlock

[EmptyBody]
protected virtual method UpdateRegion_Unlock (Box3I region)
params region

ValidCoords

Checks if the given heightmap coordinates are valid for this heightmap.

[Pure]
protected method ValidCoords (Vec3I v, bool maxSize = false)
type bool
params v The heightmap coordinates.
  maxSize Are the coordinate specified for a heightmap of MaxSize? Defaults to false.
returns true if the coordinates are valid, false if not.

Checks if the given heightmap coordinates are valid for this heightmap.

[Pure]
protected method ValidCoords (int32 x, int32 y, int32 z = 0, bool maxSize = false)
type bool
params x The heightmap X-coordinate.
  y The heightmap Y-coordinate.
  z The heightmap Z-coordinate. Defaults to 0.
  maxSize Are the coordinate specified for a heightmap of MaxSize? Defaults to false.
returns true if the coordinates are valid, false if not.