Struct SplineSlice<T>
SplineSlice represents a partial or complete range of curves from another Spline. A SplineSlice<T> by itself does not store any BezierKnots. It stores a reference to a separate Spline, then retrieves knots by iterating the SplineRange. Use SplineSlice<T> in conjunction with SplinePath to create seamless paths from discrete Spline segments.
Implements
Inherited Members
Namespace: UnityEngine.Splines
Assembly: solution.dll
Syntax
public struct SplineSlice<T> : ISpline, IReadOnlyList<BezierKnot>, IReadOnlyCollection<BezierKnot>, IEnumerable<BezierKnot>, IEnumerable where T : ISpline
Type Parameters
Name | Description |
---|---|
T | The type of spline that this slice represents. |
Remarks
Iterating a SplineSlice<T> is not as efficient as iterating a Spline or NativeSpline because it does not cache any information. Where performance is a concern, create a new Spline or NativeSpline from the SplineSlice<T>.
Constructors
Name | Description |
---|---|
SplineSlice(T, SplineRange) | Constructor for a new SplineSlice. |
SplineSlice(T, SplineRange, float4x4) | Constructor for a new SplineSlice. |
Fields
Name | Description |
---|---|
Range | An inclusive start index, number of indices, and direction to iterate. |
Spline | The Spline that this Slice will read BezierKnot and BezierCurve data from. A SplineSlice<T> by itself does not store any BezierKnots. Instead, it references a partial or complete range of existing Splines. |
Transform | A transform matrix to be applied to the spline knots and tangents. |
Properties
Name | Description |
---|---|
Closed | Whether the spline is open (has a start and end point) or closed (forms an unbroken loop). |
Count | Return the number of knots in this branch. This function clamps the Range to the Count of the the referenced Spline. |
this[int] | Get a BezierKnot at the zero-based index of this SplineSlice<T>. |
Methods
Name | Description |
---|---|
GetCurve(int) | Get a BezierCurve from a knot index. |
GetCurveInterpolation(int, float) | Return the normalized interpolation (t) corresponding to a distance on a BezierCurve. |
GetCurveLength(int) | Return the length of a curve. |
GetCurveUpVector(int, float) | Return the up vector for a t ratio on the curve. |
GetEnumerator() | Get an enumerator that iterates through the BezierKnot collection. Note that this will either increment or decrement indices depending on the value of the Direction. |
GetLength() | Return the sum of all curve lengths. |