Abstract base class for IScalarFunction implementations.
abstract class
|
ScalarFunction
|
implements
|
IScalarFunction
|
||
extends
|
NoiseFunction<float64>
|
The configurator object for this type.
public
static
property
|
Config
{
get
}
|
||
type
|
IConfigurator<IScalarFunction>
|
||
value
|
|
The configurator object. |
Returns the configuration value that describes this object.
public
abstract
method
|
ToConfig
()
|
||
type
|
ConfigValue
|
||
returns
|
|
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.
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
|
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.
A
noise
function
that
always
returns
1.0
.
public
static
readonly
field
|
One
|
||
type
|
IScalarFunction
|
A noise function that computes perlin noise.
public
static
readonly
field
|
Perlin
|
||
type
|
IScalarFunction
|
Remarks:
Noise values are in the range [-1..1].
Returns the serial type of this object.
public
property
|
SerialType
{
get
}
|
||
type
|
ISerialTypeInfo
|
||
value
|
|
The serial type. | |
inherited
|
SerializableBase.SerialType
|
Returns the serial data version.
public
virtual
property
|
SerialVersion
{
get
}
|
||
type
|
int32
|
||
value
|
|
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.SerializeA
noise
function
that
always
returns
0.0
.
public
static
readonly
field
|
Zero
|
||
type
|
IScalarFunction
|
Returns a noise function that returns the absolute value of this function.
[Pure]
|
||||
public
virtual
method
|
Abs
()
|
|||
type
|
IScalarFunction
|
|||
returns
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Abs
|
Remarks:
result = | this | out : [>=0]
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Add
|
Remarks:
result = this + function
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Atan
|
Remarks:
result = atan(this) out : [-90..90] degrees
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
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Clamp
|
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
|
Returns a noise function that returns a constant scalar value.
public
static
method
|
Constant
(float64 value)
|
||
type
|
IScalarFunction
|
||
params
|
value
|
The constant value. | |
returns
|
|
The noise function. |
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
|
|
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.SerializeReturns 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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Div
|
Remarks:
result := this / function
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
|
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
|
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
|
|
The resulting noise function. | ||
implements
|
INoiseFunctionOps.Linear
|
Remarks:
result = noise * scale + offsetwhere
noise
is
this
noise
function
and
result
is
the
returned
noise
function.
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
|
|
The resulting noise function. | ||
implements
|
NoiseFunction.LinearBase
|
Remarks:
result = noise * scale + offsetwhere
noise
is
this
noise
function
and
result
is
the
returned
noise
function.
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Log
|
Remarks:
result = log10(this) in : [>0]
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Max
|
Remarks:
result := max(this, 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.
[Pure]
|
||||
public
virtual
method
|
Min
(IScalarFunction function)
|
|||
type
|
IScalarFunction
|
|||
params
|
function
|
[not-null]
|
The noise function. | |
returns
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Min
|
Remarks:
result := min(this, 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.
[Pure]
|
||||
public
virtual
method
|
Mul
(IScalarFunction function)
|
|||
type
|
IScalarFunction
|
|||
params
|
function
|
[not-null]
|
The noise function. | |
returns
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Mul
|
Remarks:
result := this * function
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
|
|
The resulting noise function. | |
implements
|
IScalarFunction.NaN
|
Returns a noise function that negates the values returned by this noise function.
[Pure]
|
||||
public
virtual
method
|
Neg
()
|
|||
type
|
IScalarFunction
|
|||
returns
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Neg
|
Remarks:
result := -this
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Pow
|
Remarks:
result := this ^ function
Returns a noise function that computes the reciprocal of the values returned by this noise function.
[Pure]
|
||||
public
virtual
method
|
Recip
()
|
|||
type
|
IScalarFunction
|
|||
returns
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Recip
|
Remarks:
result := 1 / this
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.DeserializeSimplifies this noise function, if possible.
[Pure]
|
||||
public
method
|
Simplify
()
|
|||
type
|
IScalarFunction
|
|||
returns
|
|
The
simplified
noise
function
or
this . |
||
implements
|
INoiseFunctionOps.Simplify
|
Simplifies this noise function, if possible.
[Pure]
|
||||
public
virtual
method
|
SimplifyBase
()
|
|||
type
|
INoiseFunction<TValue>
|
|||
returns
|
|
The
simplified
noise
function
or
this . |
||
inherited
|
NoiseFunction.SimplifyBase
|
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Sin
|
Remarks:
result = sin(this) in : angle in degrees out : [-1..1]
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
|
|
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).
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Sqr
|
Remarks:
result := this ^ 2
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Sqrt
|
Remarks:
result := this ^ 0.5
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
|
|
The resulting noise function. | ||
implements
|
IScalarFunction.Sub
|
Remarks:
result := this - function
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
|
|
The resulting noise function. | ||
implements
|
INoiseFunctionOps.Transform
|
Creates a new instance of ScalarFunction.
protected
constructor
|
ScalarFunction
(ISerialTypeInfo serialType)
|
||
params
|
serialType
|
[not-null]
|
The serial ID. |
protected
override
sealed
method
|
EqualValue
(float64 a,
float64 b)
|
||
type
|
bool
|
||
params
|
a
|
||
b
|
|||
implements
|
NoiseFunction.EqualValue
|
protected
method
|
SimplifyAdd
(INoiseFunction<TValue> a,
INoiseFunction<TValue> b)
|
||
type
|
INoiseFunction<TValue>
|
||
params
|
a
|
||
b
|
|||
inherited
|
NoiseFunction.SimplifyAdd
|
protected
method
|
SimplifyMul
(INoiseFunction<TValue> a,
INoiseFunction<TValue> b)
|
||
type
|
INoiseFunction<TValue>
|
||
params
|
a
|
||
b
|
|||
inherited
|
NoiseFunction.SimplifyMul
|
protected
method
|
SimplifySub
(INoiseFunction<TValue> a,
INoiseFunction<TValue> b)
|
||
type
|
INoiseFunction<TValue>
|
||
params
|
a
|
||
b
|
|||
inherited
|
NoiseFunction.SimplifySub
|
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
|