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

class ScalarFunction in Tinman.Terrain.Procedural

Abstract base class for IScalarFunction implementations.

abstract class ScalarFunction implements IScalarFunction
  extends NoiseFunction<float64>

Configuration

Config

The configurator object for this type.

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

ToConfig

Returns the configuration value that describes this object.

public abstract method ToConfig ()
type ConfigValue
returns [not-null] The configuration value.
inherited NoiseFunction.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 / Attributes

ConstantValue

For constant noise functions, returns the constant value. For all others, the default value of TValue is returned.

public property ConstantValue { get }
type TValue
value The constant value.
inherited NoiseFunction.ConstantValue

IsConstant

Does this noise function return a constant value?

public virtual property IsConstant { get }
type bool
value true if this noise function is constant, false if not.
inherited NoiseFunction.IsConstant

Remarks:

A constant noise function computes the same value for all input coordinates.

One

A noise function that always returns 1.0.

public static readonly field One
type IScalarFunction

Perlin

A noise function that computes perlin noise.

public static readonly field Perlin
type IScalarFunction

Remarks:

Noise values are in the range [-1..1].

SerialType

Returns the serial type of this object.

public property SerialType { get }
type ISerialTypeInfo
value [not-null] The serial type.
inherited SerializableBase.SerialType

SerialVersion

Returns the serial data version.

public virtual property SerialVersion { get }
type int32
value [>=1] The serial data version tag.
inherited SerializableBase.SerialVersion

Remarks:

An ISerializable implementation is required to support all versions up to the one returned by SerialVersion.

See also:

ISerializable.Serialize
ISerializable.Deserialize

Zero

A noise function that always returns 0.0.

public static readonly field Zero
type IScalarFunction

Public / Methods

Abs

Returns a noise function that returns the absolute value of this function.

[Pure]
public virtual method Abs ()
type IScalarFunction
returns [not-null] The resulting noise function.
implements IScalarFunction.Abs

Remarks:

result = | this |
  out  : [>=0]

Add

Returns a noise function that sums the noise values of the given function and this one.

[Pure]
public virtual method Add (IScalarFunction function)
type IScalarFunction
params function [not-null] The noise function to add.
returns [not-null] The resulting noise function.
implements IScalarFunction.Add

Remarks:

result = this + function

Atan

Returns a noise function that computes the arcus tangent of the noise values returned by this noise function.

[Pure]
public virtual method Atan ()
type IScalarFunction
returns [not-null] The resulting noise function.
implements IScalarFunction.Atan

Remarks:

result = atan(this)
  out  : [-90..90] degrees

Cellular

A cellular noise function.

public static method Cellular (float64 b0 = 1, float64 b1 = 0, float64 b2 = 0, float64 b3 = 0, float64 a0 = 0, float64 a1 = 0, float64 a2 = 0, float64 a3 = 0, float64 c = 0)
type IScalarFunction
params b0 Cellular noise coefficient (see remarks).
  b1 Cellular noise coefficient (see remarks).
  b2 Cellular noise coefficient (see remarks).
  b3 Cellular noise coefficient (see remarks).
  a0 Cellular noise coefficient (see remarks).
  a1 Cellular noise coefficient (see remarks).
  a2 Cellular noise coefficient (see remarks).
  a3 Cellular noise coefficient (see remarks).
  c Cellular noise coefficient (see remarks).

Remarks:

The noise value is computed using the distances of the given point to the four nearest feature points by combining them according to the specified coefficients:

result := (a0 * f0 + b0) * f0
        + (a1 * f1 + b1) * f1
        + (a2 * f2 + b2) * f2
        + (a3 * f3 + b3) * f3 + c

f0      := distance to 1st nearest feature point
f1      := distance to 2nd nearest feature point
f2      := distance to 3rd nearest feature point
f3      := distance to 4th nearest feature point

Clamp

Returns a noise function that clamps the noise values returned by this function to the specified number range.

[Pure]
public virtual method Clamp (float64 minimum, float64 maximum)
type IScalarFunction
params minimum The minimum noise value.
  maximum The maximum noise value.
returns [not-null] The resulting noise function.
implements IScalarFunction.Clamp

ComputeValue

Computes the noise value for the given input vector.

public method ComputeValue (Vec3D v)
type TValue
params v Coordinate of input vector.
returns The noise value.
inherited NoiseFunction.ComputeValue

Computes the noise value for the given input vector.

public abstract method ComputeValue (float64 x, float64 y, float64 z)
type TValue
params x X-coordinate of input vector.
  y Y-coordinate of input vector.
  z Z-coordinate of input vector.
returns The noise value.
inherited NoiseFunction.ComputeValue

Constant

Returns a noise function that returns a constant scalar value.

public static method Constant (float64 value)
type IScalarFunction
params value The constant value.
returns [not-null] The noise function.

Deserialize

Initializes the state of this object from the given data stream.

public virtual method Deserialize (int32 serialVersion, ISerializer data)
type ISerializable
params serialVersion [>=1] The serial data version.
  data [not-null] The serial data stream.
returns [not-null] The deserialized object. This will typically be this, but in some circumstances, another instance may be returned (e.g. singletons).
inherited SerializableBase.Deserialize

Remarks:

The Deserialize method will be called immediately after the object has been instantiated via its default constructor.

The provided serialVersion number is guaranteed to be equal to or less than the SerialVersion returned by this object (i.e. ISerializable object must provide backwards compatibility).

See also:

ISerializable.Serialize
ISerializable.SerialVersion

Div

Returns a noise function that divides the noise values returned by this function by the noise values returned by the given noise function.

[Pure]
public virtual method Div (IScalarFunction function)
type IScalarFunction
params function [not-null] The divisor noise function.
returns [not-null] The resulting noise function.
implements IScalarFunction.Div

Remarks:

result := this / function

Equals

Compares this object with the given one.

[Pure]
public abstract method Equals (INoiseFunctionBase other)
type bool
params other The object to compare to.
returns true if this object is equal to other, false if not.
inherited NoiseFunction.Equals

HasConstantValue

Does this noise function have the given constant value?

public method HasConstantValue (TValue value)
type bool
params value The constant value.
returns true if this noise function has the given constant value, false if not.
inherited NoiseFunction.HasConstantValue

Linear

Applies a linear transformation on the output value of this noise function.

[Pure]
public method Linear (float64 scale, float64 offset)
type IScalarFunction
params scale Linear coefficient of output transform.
  offset Linear coefficient of output transform.
returns [not-null] The resulting noise function.
implements INoiseFunctionOps.Linear

Remarks:

result = noise * scale + offset
where noise is this noise function and result is the returned noise function.

LinearBase

Applies a linear transformation on the output value of this noise function.

[Pure]
public override method LinearBase (float64 scale, float64 offset)
type INoiseFunction<float64>
params scale Linear coefficient of output transform.
  offset Linear coefficient of output transform.
returns [not-null] The resulting noise function.
implements NoiseFunction.LinearBase

Remarks:

result = noise * scale + offset
where noise is this noise function and result is the returned noise function.

Log

Returns a noise function that computes the logarithm base 10 of the noise values returned by this noise function.

[Pure]
public virtual method Log ()
type IScalarFunction
returns [not-null] The resulting noise function.
implements IScalarFunction.Log

Remarks:

result = log10(this)
  in   : [>0]

Max

Returns a noise function that returns the maximum of the noise values returned by this noise function and the noise values returned by the given noise function.

[Pure]
public virtual method Max (IScalarFunction function)
type IScalarFunction
params function [not-null] The noise function.
returns [not-null] The resulting noise function.
implements IScalarFunction.Max

Remarks:

result := max(this, function)

Min

Returns a noise function that returns the minimum of the noise values returned by this noise function and the noise values returned by the given noise function.

[Pure]
public virtual method Min (IScalarFunction function)
type IScalarFunction
params function [not-null] The noise function.
returns [not-null] The resulting noise function.
implements IScalarFunction.Min

Remarks:

result := min(this, function)

Mul

Returns a noise function that multiplies the noise values returned by this noise function with the noise values returned by the given noise function.

[Pure]
public virtual method Mul (IScalarFunction function)
type IScalarFunction
params function [not-null] The noise function.
returns [not-null] The resulting noise function.
implements IScalarFunction.Mul

Remarks:

result := this * function

NaN

Returns a noise function that replaces bad number values produced by this noise function with the given values.

public virtual method NaN (float64 nan = 0, float64 neg = 0, float64 pos = 0)
type IScalarFunction
params nan The replacement value for NaN (not-a-number). Defaults to 0.
  neg The replacement value for negative infinity. Defaults to 0.
  pos The replacement value for positive infinity. Defaults to 0.
returns [not-null] The resulting noise function.
implements IScalarFunction.NaN

Neg

Returns a noise function that negates the values returned by this noise function.

[Pure]
public virtual method Neg ()
type IScalarFunction
returns [not-null] The resulting noise function.
implements IScalarFunction.Neg

Remarks:

result := -this

Pow

Returns a noise function that raises the noise values returned by this noise function to the power values returned by the given noise function.

[Pure]
public virtual method Pow (IScalarFunction function)
type IScalarFunction
params function [not-null] The noise function.
returns [not-null] The resulting noise function.
implements IScalarFunction.Pow

Remarks:

result := this ^ function

Recip

Returns a noise function that computes the reciprocal of the values returned by this noise function.

[Pure]
public virtual method Recip ()
type IScalarFunction
returns [not-null] The resulting noise function.
implements IScalarFunction.Recip

Remarks:

result := 1 / this

Serialize

Serializes the current state of this object to the given data stream.

public virtual method Serialize (ISerializer data)
params data [not-null] The serial data stream.
inherited SerializableBase.Serialize

See also:

ISerializable.Deserialize
ISerializable.SerialVersion

Simplify

Simplifies this noise function, if possible.

[Pure]
public method Simplify ()
type IScalarFunction
returns [not-null] The simplified noise function or this.
implements INoiseFunctionOps.Simplify

SimplifyBase

Simplifies this noise function, if possible.

[Pure]
public virtual method SimplifyBase ()
type INoiseFunction<TValue>
returns [not-null] The simplified noise function or this.
inherited NoiseFunction.SimplifyBase

Sin

Returns a noise function that computes the sine of the noise values returned by this noise function.

[Pure]
public virtual method Sin ()
type IScalarFunction
returns [not-null] The resulting noise function.
implements IScalarFunction.Sin

Remarks:

result = sin(this)
  in   : angle in degrees
  out  : [-1..1]

Spline

Returns a noise function that maps the noise values returned by this noise function onto the given curve.

[Pure]
public method Spline (ICurve curve, float64 minimum, float64 maximum)
type IScalarFunction
params curve [not-null] The curve.
  minimum The noise value to map to the first curve control point.
  maximum The noise value to map to the last curve control point.
returns [not-null] The resulting noise function.
implements IScalarFunction.Spline

Remarks:

The given curve is assumed to be 1D, so only the X-coordinate is used. The noise values computed by this function are used as control point indices (see Compute1D).

Sqr

Returns a noise function that computes the square value of the noise values returned by this noise function.

[Pure]
public virtual method Sqr ()
type IScalarFunction
returns [not-null] The resulting noise function.
implements IScalarFunction.Sqr

Remarks:

result := this ^ 2

Sqrt

Returns a noise function that computes the square root of the noise values returned by this noise function.

[Pure]
public virtual method Sqrt ()
type IScalarFunction
returns [not-null] The resulting noise function.
implements IScalarFunction.Sqrt

Remarks:

result := this ^ 0.5

Sub

Returns a noise function that subtracts the noise values returned by the given noise function from the noise values returned by this noise function.

[Pure]
public virtual method Sub (IScalarFunction function)
type IScalarFunction
params function [not-null] The noise function.
returns [not-null] The resulting noise function.
implements IScalarFunction.Sub

Remarks:

result := this - function

Transform

Transforms the input coordinates using the given vector function before plugging them into this noise function.

[Pure]
public virtual method Transform (IVectorFunction function)
type IScalarFunction
params function [not-null] The vector function to use for transforming the input coordinates.
returns [not-null] The resulting noise function.
implements INoiseFunctionOps.Transform

Protected / Constructors

ScalarFunction

Creates a new instance of ScalarFunction.

protected constructor ScalarFunction (ISerialTypeInfo serialType)
params serialType [not-null] The serial ID.

Protected / Methods

EqualValue

protected override sealed method EqualValue (float64 a, float64 b)
type bool
params a
  b
implements NoiseFunction.EqualValue

SimplifyAdd

protected method SimplifyAdd (INoiseFunction<TValue> a, INoiseFunction<TValue> b)
type INoiseFunction<TValue>
params a
  b
inherited NoiseFunction.SimplifyAdd

SimplifyMul

protected method SimplifyMul (INoiseFunction<TValue> a, INoiseFunction<TValue> b)
type INoiseFunction<TValue>
params a
  b
inherited NoiseFunction.SimplifyMul

SimplifySub

protected method SimplifySub (INoiseFunction<TValue> a, INoiseFunction<TValue> b)
type INoiseFunction<TValue>
params a
  b
inherited NoiseFunction.SimplifySub

ValueNeg

Negates the given noise value, so that value + (-value) = 0.

protected override sealed method ValueNeg (float64 value)
type float64
params value The noise value.
returns The resulting noise value.
overrides NoiseFunction.ValueNeg