Class CurveSample<T>
A generic class to define a curve from a specific type of data.
Namespace: Mechatronics.SystemGraph
Syntax
[Serializable]
public class CurveSample<T>
Type Parameters
Name | Description |
---|---|
T | Type that define a point on the curve. |
Constructors
CurveSample()
Create an empty curve.
Declaration
public CurveSample()
CurveSample(List<T>, Single, Single)
Create a sampled curve from a list of points.
Declaration
public CurveSample(List<T> data, float startTime, float endTime)
Parameters
Type | Name | Description |
---|---|---|
List<T> | data | List of points that define the curve. |
Single | startTime | Position of the first point on the curve in seconds. |
Single | endTime | When the curve end in seconds. |
Fields
_data
Buffer of points on the curve.
Declaration
protected readonly T[] _data
Field Value
Type | Description |
---|---|
T[] |
_dirty
Specify if the curve changed in heap.
Declaration
protected bool _dirty
Field Value
Type | Description |
---|---|
Boolean |
_dt
Time step on the curve.
Declaration
protected readonly float _dt
Field Value
Type | Description |
---|---|
Single |
_endTime
End time, in seconds.
Declaration
protected readonly float _endTime
Field Value
Type | Description |
---|---|
Single |
_numSamples
Number of sample that define the curves.
Declaration
protected readonly int _numSamples
Field Value
Type | Description |
---|---|
Int32 |
_startTime
An offset, in seconds, when the curve start.
Declaration
protected readonly float _startTime
Field Value
Type | Description |
---|---|
Single |
Properties
End
Return the end of the curve in seconds.
Declaration
public float End { get; }
Property Value
Type | Description |
---|---|
Single |
Item[Int32]
An accessor to retreive a sample.
Declaration
public T this[int i] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | i | Sample index. |
Property Value
Type | Description |
---|---|
T | The sample value. |
Length
Number of samples in the curve.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
Int32 |
Start
Return the starting offset of the curve in seconds.
Declaration
public float Start { get; }
Property Value
Type | Description |
---|---|
Single |
TimeStep
Return the time between two samples.
Declaration
public float TimeStep { get; }
Property Value
Type | Description |
---|---|
Single |
Methods
CreateComputeBufferWithCurveData()
Create the buffer to contain the sampled curve on the GPU.
Declaration
public ComputeBuffer CreateComputeBufferWithCurveData()
Returns
Type | Description |
---|---|
ComputeBuffer | A compute buffer. |
GetValue(Single)
Return an interpolated value on the curve.
Declaration
public virtual T GetValue(float t)
Parameters
Type | Name | Description |
---|---|---|
Single | t | Specific time in seconds. |
Returns
Type | Description |
---|---|
T | Value at the specified time. |