Class SplineData<T>
The SplineData{T} class is used to store information relative to a Spline without coupling data directly to the Spline class. SplineData can store any type of data, and provides options for how to index DataPoints.
Inherited Members
Namespace: UnityEngine.Splines
Assembly: solution.dll
Syntax
[Serializable]
public class SplineData<T> : IEnumerable<DataPoint<T>>, IEnumerable
Type Parameters
Name | Description |
---|---|
T | The type of data to store. |
Constructors
Name | Description |
---|---|
SplineData() | Create a new SplineData instance. |
SplineData(IEnumerable<DataPoint<T>>) | Create a new SplineData instance and initialize it with a collection of data points. DataPoints will be sorted and stored in ascending order by Index. |
SplineData(T) | Create a new SplineData instance with a single value in it. |
Properties
Name | Description |
---|---|
Count | How many data points the SplineData collection contains. |
DefaultValue | Default value to use when a new DataPoint is automatically added. |
Indexes | The DataPoint Indexes of the current SplineData. |
this[int] | Access a DataPoint<TDataType> by index. DataPoints are sorted in ascending order by the Index value. |
PathIndexUnit | PathIndexUnit defines how SplineData will interpret 't' values when interpolating data. |
Methods
Name | Description |
---|---|
Add(float, T) | Append a DataPoint<TDataType> to this collection. |
Add(DataPoint<T>) | Append a DataPoint<TDataType> to this collection. |
AddDataPointWithDefaultValue(float, bool) | Append a DataPoint<TDataType> with default value to this collection. |
Clear() | Remove all data points. |
ConvertPathUnit<TSplineType>(TSplineType, PathIndexUnit) | Given a spline and a target PathIndex Unit, convert the SplineData to a new PathIndexUnit without changing the final positions on the Spline. |
Evaluate<TSpline, TInterpolator>(TSpline, float, PathIndexUnit, TInterpolator) | Calculate an interpolated value at a given 't' along a spline. |
Evaluate<TSpline, TInterpolator>(TSpline, float, TInterpolator) | Calculate an interpolated value at a given 't' along a spline. |
GetEnumerator() | Returns an enumerator that iterates through the DataPoints collection. |
GetNormalizedInterpolation<TSplineType>(TSplineType, float) | Given a time value using a certain PathIndexUnit type, calculate the normalized time value regarding a specific spline. |
MoveDataPoint(int, float) | Move a DataPoint<TDataType> (if it exists) from this collection, from one index to the another. |
RemoveAt(int) | Remove a DataPoint<TDataType> at index. |
RemoveDataPoint(float) | Remove a DataPoint<TDataType> from this collection, if one exists. |
SetDataPoint(int, DataPoint<T>) | Set the data for a DataPoint<TDataType> at an index. |
SetDataPointNoSort(int, DataPoint<T>) | Set the data for a DataPoint<TDataType> at an index. |
SortIfNecessary() | Triggers sorting of the DataPoint<TDataType> list if the data is dirty. |
Events
Name | Description |
---|---|
Changed | Invoked any time a SplineData is modified. |