Class ResponseCurveBase<T>
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Assembly-CSharp.dll
A class that can be used as the base of the implementation of a response curve.
[Version(1, 2, 0)]
public abstract class ResponseCurveBase<T> : IResponseCurve<T>
Type Parameters
T
- Inheritance
-
ResponseCurveBase<T>
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ResponseCurveBase(IEnumerable<float>, IEnumerable<T>)
Constructs a new ResponseCurveBase.
protected ResponseCurveBase(IEnumerable<float> inputSamples, IEnumerable<T> outputSamples)
Parameters
inputSamples
IEnumerable<float>Samples of input. Assumes input is monotonically increasing.
outputSamples
IEnumerable<T>Samples of outputs.
Properties
this[float]
Evaluates the curve at the given input and returns the result.
public T this[float input] { get; }
Parameters
input
floatThe input for which output is sought.
Property Value
- T
Remarks
If the input is below the inputMin given in the constructor, the output is clamped to the first output sample.
If the input is above the inputMax given in the constructor, the output is clamped to the last output sample.
Otherwise, an index is calculated, and the output is interpolated
between outputSample[index]
and outputSample[index + 1]
.
Methods
Evaluate(float)
Evaluates the curve at the specified value.
public T Evaluate(float t)
Parameters
t
floatThe value at which to evaluate the curve.
Returns
- T
Remarks
Equivalent to curve[t]
.
Lerp(T, T, float)
Linearly interpolates between the two given samples.
protected abstract T Lerp(T outputSampleMin, T outputSampleMax, float t)
Parameters
outputSampleMin
TThe value when t is less than or equal to 0.
outputSampleMax
TThe value when t is greater than or equal to 1.
t
floatThe fraction of the minimum sample to use.
Returns
- T