# IScalarFunction

## Description

`[ShutdownSurvive]`
`interface` `Tinman.Terrain.Procedural.IScalarFunction`

Derived from
Extended by

ScalarFunction abstract

Base interface for classes that compute procedural scalar (i.e. 1D) noise values.

## Public / Methods

### Abs

`[Pure]`
`public` `method` `Abs` → `()`

returns → IScalarFunction

The resulting noise function.

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

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

`[Pure]`
`public` `method` `Add` → `(1)`

function in : IScalarFunction

`[not-null]`

returns → IScalarFunction

The resulting noise function.

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

`result = this + function`

### Atan

`[Pure]`
`public` `method` `Atan` → `()`

returns → IScalarFunction

The resulting noise function.

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

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

### Clamp

`[Pure]`
`public` `method` `Clamp` → `(2)`

minimum in : float64

The minimum noise value.

maximum in : float64

The maximum noise value.

returns → IScalarFunction

The resulting noise function.

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

### Div

`[Pure]`
`public` `method` `Div` → `(1)`

function in : IScalarFunction

`[not-null]`
The divisor noise function.

returns → IScalarFunction

The resulting noise function.

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

`result := this / function`

### Log

`[Pure]`
`public` `method` `Log` → `()`

returns → IScalarFunction

The resulting noise function.

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

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

### Max

`[Pure]`
`public` `method` `Max` → `(1)`

function in : IScalarFunction

`[not-null]`
The noise function.

returns → IScalarFunction

The resulting noise function.

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.

`result := max(this, function)`

### Min

`[Pure]`
`public` `method` `Min` → `(1)`

function in : IScalarFunction

`[not-null]`
The noise function.

returns → IScalarFunction

The resulting noise function.

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.

`result := min(this, function)`

### Mul

`[Pure]`
`public` `method` `Mul` → `(1)`

function in : IScalarFunction

`[not-null]`
The noise function.

returns → IScalarFunction

The resulting noise function.

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

`result := this * function`

### Na​N

`public` `method` `NaN` → `(3)`

nan opt : float64 = 0

The replacement value for NaN (not-a-number).

neg opt : float64 = 0

The replacement value for negative infinity.

pos opt : float64 = 0

The replacement value for positive infinity.

returns → IScalarFunction

The resulting noise function.

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

### Neg

`[Pure]`
`public` `method` `Neg` → `()`

returns → IScalarFunction

The resulting noise function.

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

`result := -this`

### Pow

`[Pure]`
`public` `method` `Pow` → `(1)`

function in : IScalarFunction

`[not-null]`
The noise function.

returns → IScalarFunction

The resulting noise function.

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

`result := this ^ function`

### Recip

`[Pure]`
`public` `method` `Recip` → `()`

returns → IScalarFunction

The resulting noise function.

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

`result := 1 / this`

### Sin

`[Pure]`
`public` `method` `Sin` → `()`

returns → IScalarFunction

The resulting noise function.

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

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

### Spline

`[Pure]`
`public` `method` `Spline` → `(3)`

curve in : ICurve

`[not-null]`
The curve.

minimum in : float64

The noise value to map to the first curve control point.

maximum in : float64

The noise value to map to the last curve control point.

returns → IScalarFunction

The resulting noise function.

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

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 ICurve.Compute1D).

### Sqr

`[Pure]`
`public` `method` `Sqr` → `()`

returns → IScalarFunction

The resulting noise function.

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

`result := this ^ 2`

### Sqrt

`[Pure]`
`public` `method` `Sqrt` → `()`

returns → IScalarFunction

The resulting noise function.

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

`result := this ^ 0.5`

### Sub

`[Pure]`
`public` `method` `Sub` → `(1)`

function in : IScalarFunction

`[not-null]`
The noise function.

returns → IScalarFunction

The resulting noise function.

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

`result := this - function`

## Extensions

`[Pure]`
`public` `static` `method` `Add` → `(1)`

value in : float64

returns → IScalarFunction

The resulting noise function.

Returns a noise function that adds the given scalar value to the noise values returned by this function.

`result := this + value`

### Clamp

`[Pure]`
`public` `static` `method` `Clamp` → `(1)`

range in : RangeD

The number range.

returns → IScalarFunction

The resulting noise function.

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

### Color​Ramp

`[Pure]`
`public` `static` `method` `ColorRamp` → `(1)`

ramp in : IColorRamp

`[not-null]`
The color ramp to use.

returns → IColorFunction

The resulting color function.

Returns a noise function that computes color values from noise values using the given color ramp.

### Div

`[Pure]`
`public` `static` `method` `Div` → `(1)`

value in : float64

The scalar divisor value.

returns → IScalarFunction

The resulting noise function.

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

`result := this / value`

### Div​Inv

`[Pure]`
`public` `static` `method` `DivInv` → `(1)`

value in : float64

The scalar dividend value.

returns → IScalarFunction

The resulting noise function.

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

`result := value / this`

### Max

`[Pure]`
`public` `static` `method` `Max` → `(1)`

value in : float64

The scalar maximum value.

returns → IScalarFunction

The resulting noise function.

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

`result := max(this, value)`

### Min

`[Pure]`
`public` `static` `method` `Min` → `(1)`

value in : float64

The scalar minimum value.

returns → IScalarFunction

The resulting noise function.

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

`result := min(this, value)`

### Mul

`[Pure]`
`public` `static` `method` `Mul` → `(1)`

value in : float64

The scalar value to multiply with.

returns → IScalarFunction

The resulting noise function.

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

`result := this * value`

### Multi​Ridged

`[Pure]`
`public` `static` `method` `MultiRidged` → `(5)`

octaves in : int32

`[>=1]`
The number of octaves.

amplitude opt : float64 = 0.5

Factor to apply to amplitude when going to the next octave. The amplitude of the first octave is `1`.

frequency opt : float64 = 2

Factor to apply to frequency when going to the next octave. The frequency of the first octave is `1`.

offset opt : float64 = 1

The offset value.

gain opt : float64 = 2

The gain value.

returns → IScalarFunction

The resulting noise function.

Returns a multifractal noise function based on this noise function.

### Multi​Sum

`[Pure]`
`public` `static` `method` `MultiSum` → `(3)`

octaves in : int32

`[>=1]`
The number of octaves.

amplitude opt : float64 = 0.5

Factor to apply to amplitude when going to the next octave. The amplitude of the first octave is `1`.

frequency opt : float64 = 2

Factor to apply to frequency when going to the next octave. The frequency of the first octave is `1`.

returns → IScalarFunction

The resulting noise function.

Returns a multifractal noise function based on this noise function.

### Op

`public` `static` `method` `Op1` → `(2)`

op in : ScalarFunctionOpCode

The operation to use.

other opt : IScalarFunction = null

The other noise function or `null` if op in is unary.

returns → IScalarFunction

The resulting noise function.

Applies the given function operator to this noise function and the given one (for binary operators only).

`public` `static` `method` `Op2` → `(2)`

op in : ScalarFunctionOpCode

The operation to use.

value in : float64

The scalar value to combine with.

returns → IScalarFunction

The resulting noise function.

Applies the given function operator to this noise function and the given scalar value (for binary operators only).

### Pow

`[Pure]`
`public` `static` `method` `Pow` → `(1)`

value in : float64

The scalar power value.

returns → IScalarFunction

The resulting noise function.

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

`result := this ^ value`

### Pow​Inv

`[Pure]`
`public` `static` `method` `PowInv` → `(1)`

value in : float64

The scalar value.

returns → IScalarFunction

The resulting noise function.

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

`result := value ^ this`

### Select

`[Pure]`
`public` `static` `method` `Select1` → `(10)`

noise0 in : IScalarFunction

`[not-null]`
The noise function to blend at index `0`.

noise1 in : IScalarFunction

`[not-null]`
The noise function to blend at index `1`.

noise2 opt : IScalarFunction = null

The noise function to blend at index `2` or `null`.

noise3 opt : IScalarFunction = null

The noise function to blend at index `3` or `null`.

noise4 opt : IScalarFunction = null

The noise function to blend at index `4` or `null`.

noise5 opt : IScalarFunction = null

The noise function to blend at index `5` or `null`.

noise6 opt : IScalarFunction = null

The noise function to blend at index `6` or `null`.

noise7 opt : IScalarFunction = null

The noise function to blend at index `7` or `null`.

noise8 opt : IScalarFunction = null

The noise function to blend at index `8` or `null`.

noise9 opt : IScalarFunction = null

The noise function to blend at index `9` or `null`.

returns → IScalarFunction

The resulting noise function.

Returns a noise function that blends between this noise function and the given one using a third blend factor noise function.

`[Pure]`
`public` `static` `method` `Select2` → `(1)`

noise in : IScalarFunction [ ]

`[not-null]`
The noise functions to blend.

returns → IScalarFunction

The resulting noise function.

Returns a noise function that blends between this noise function and the given one using a third blend factor noise function.

### Sub

`[Pure]`
`public` `static` `method` `Sub` → `(1)`

value in : float64

The scalar value to subtract.

returns → IScalarFunction

The resulting noise function.

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

`result := this - value`

### Sub​Inv

`[Pure]`
`public` `static` `method` `SubInv` → `(1)`

value in : float64

The scalar value to subtract from.

returns → IScalarFunction

The resulting noise function.

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

`result := value - this`

### Whirl

`public` `static` `method` `Whirl` → `()`

returns → IVectorFunction

The resulting noise function.

Returns a noise function that computes offset vector for perturbing the input coordinates of other noise functions.