# ScalarFunction

## Description

`abstract` `class` `Tinman.Terrain.Procedural.ScalarFunction`

Derived from

NoiseFunction<float64> abstract
IScalarFunction

Abstract base class for IScalarFunction implementations.

## Public / Constants

### One

`public` `static` `readonly` `attribute` `One` → `(IScalarFunction)`

A noise function that always returns `1.0`.

### Perlin

`public` `static` `readonly` `attribute` `Perlin` → `(IScalarFunction)`

A noise function that computes perlin noise.

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

### Zero

`public` `static` `readonly` `attribute` `Zero` → `(IScalarFunction)`

A noise function that always returns `0.0`.

## Public / Constructors

### Cellular

`public` `static` `method` `Cellular` → `(9)`

b0 opt : float64 = 1

Cellular noise coefficient (see remarks).

b1 opt : float64 = 0

Cellular noise coefficient (see remarks).

b2 opt : float64 = 0

Cellular noise coefficient (see remarks).

b3 opt : float64 = 0

Cellular noise coefficient (see remarks).

a0 opt : float64 = 0

Cellular noise coefficient (see remarks).

a1 opt : float64 = 0

Cellular noise coefficient (see remarks).

a2 opt : float64 = 0

Cellular noise coefficient (see remarks).

a3 opt : float64 = 0

Cellular noise coefficient (see remarks).

opt : float64 = 0

Cellular noise coefficient (see remarks).

returns → IScalarFunction

The noise function.

A cellular noise function.

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```

### Constant

`public` `static` `method` `Constant` → `(1)`

value in : float64

The constant value.

returns → IScalarFunction

The noise function.

Returns a noise function that returns a constant scalar value.

## Protected / Constructors

### Scalar​Function

`protected` `constructor` `ScalarFunction` → `(1)`

serialType in : ISerialTypeInfo

`[not-null]`
The serial ID.

Creates a new instance of ScalarFunction.

## Configuration

### Config

`public` `static` `attribute` `Config` → `(get)`

value : IConfigurator<IScalarFunction>

`[not-null]`
The configurator object.

The configurator object for this type.