Class SplineUtility
A collection of methods for extracting information about Spline types.
Inherited Members
Namespace: UnityEngine.Splines
Assembly: solution.dll
Syntax
public static class SplineUtility
Remarks
SplineUtility
methods do not consider Transform values except where explicitly requested. To perform operations in world space, you can use the SplineContainer evaluate methods or build a NativeSpline with a constructor that accepts a matrix and evaluate that spline.
Fields
Name | Description |
---|---|
CatmullRomTension | The tension value for a Catmull-Rom type spline. Use with SetTangentMode(TangentMode) and SetAutoSmoothTension(int, float) to control the curvature of the spline at control points. |
DefaultTension | The default tension value used for AutoSmooth knots. Use with SetTangentMode(TangentMode) and SetAutoSmoothTension(int, float) to control the curvature of the spline at control points. |
DrawResolutionDefault | The default resolution used when unrolling a curve to draw a preview in the Scene View. Pick resolution is used when determining how many segments are required to unroll a curve. Unrolling is the process of calculating a series of line segments to approximate a curve. Some functions in SplineUtility allow you to specify a resolution. Lower resolution means fewer segments, while higher resolutions result in more segments. Use lower resolutions where performance is critical and accuracy is not paramount. Use higher resolution where a fine degree of accuracy is necessary and performance is less important. |
PickResolutionDefault | The default resolution used when unrolling a curve to hit test while picking (selecting a spline with a cursor). Pick resolution is used when determining how many segments are required to unroll a curve. Unrolling is the process of calculating a series of line segments to approximate a curve. Some functions in SplineUtility allow you to specify a resolution. Lower resolution means fewer segments, while higher resolutions result in more segments. Use lower resolutions where performance is critical and accuracy is not paramount. Use higher resolution where a fine degree of accuracy is necessary and performance is less important. |
PickResolutionMax | The maximum resolution allowed when unrolling a curve to hit test while picking (selecting a spline with a cursor). Pick resolution is used when determining how many segments are required to unroll a curve. Unrolling is the process of calculating a series of line segments to approximate a curve. Some functions in SplineUtility allow you to specify a resolution. Lower resolution means fewer segments, while higher resolutions result in more segments. Use lower resolutions where performance is critical and accuracy is not paramount. Use higher resolution where a fine degree of accuracy is necessary and performance is less important. |
PickResolutionMin | The minimum resolution allowable when unrolling a curve to hit test while picking (selecting a spline with a cursor). Pick resolution is used when determining how many segments are required to unroll a curve. Unrolling is the process of calculating a series of line segments to approximate a curve. Some functions in SplineUtility allow you to specify a resolution. Lower resolution means fewer segments, while higher resolutions result in more segments. Use lower resolutions where performance is critical and accuracy is not paramount. Use higher resolution where a fine degree of accuracy is necessary and performance is less important. |
Methods
Name | Description |
---|---|
AddSpline<T>(T) | Creates a new spline and adds it to the ISplineContainer. |
AddSpline<T>(T, Spline) | Add a new Spline to the ISplineContainer. |
AreKnotLinked(ISplineContainer, SplineKnotIndex, SplineKnotIndex) | Checks if two knots from an ISplineContainer are linked together. |
CalculateLength<T>(T, float4x4) | Calculate the length of a spline when transformed by a matrix. |
CalculateUpVector<T>(T, float) | Calculate the normal (up) vector of a spline. This is a more accurate but more expensive operation than EvaluateUpVector<T>(T, float). |
ConvertIndexUnit<T>(T, float, PathIndexUnit) | Given a normalized interpolation ratio, calculate the associated interpolation value in another PathIndexUnit regarding a specific spline. |
ConvertIndexUnit<T>(T, float, PathIndexUnit, PathIndexUnit) | Given an interpolation value using one of the various PathIndexUnit types, calculate the associated interpolation value in another PathIndexUnit regarding a specific spline. |
CopyKnotLinks<T>(T, int, int) | Copies knot links between two splines of the same ISplineContainer. |
CurveToSplineT<T>(T, float) | Given an interpolation value for a curve, calculate the relative normalized spline interpolation. |
DuplicateSpline(ISplineContainer, SplineKnotIndex, SplineKnotIndex, out int) | Duplicate a spline between 2 knots of a source spline. |
EvaluateAcceleration<T>(T, float) | Return an interpolated acceleration at ratio t. |
EvaluateCurvatureCenter<T>(T, float) | Return the curvature center at ratio t. The curvature center represents the center of the circle that is tangent to the curve at t. This circle is in the plane defined by the curve velocity (tangent) and the curve acceleration at that point. |
EvaluateCurvature<T>(T, float) | Return an interpolated curvature at ratio t. |
EvaluateNurbs(float, List<float3>, List<double>, int, out float3) | Computes the interpolated position for NURBS defined by order, controlPoints, and knotVector at ratio t. |
EvaluatePosition<T>(T, float) | Return an interpolated position at ratio t. |
EvaluateTangent<T>(T, float) | Return an interpolated direction at ratio t. |
EvaluateUpVector<T>(T, float) | Evaluate the normal (up) vector of a spline. |
Evaluate<T>(T, float, out float3, out float3, out float3) | Compute interpolated position, direction and upDirection at ratio t. Calling this method to get the 3 vectors is faster than calling independently EvaluatePosition, EvaluateDirection and EvaluateUpVector for the same time t as it reduces some redundant computation. |
FitSplineToPoints(List<float3>, float, bool, out Spline) | Computes a Spline to approximate the curve formed by the list of provided points within the given error threshold. |
GetAutoSmoothKnot(float3, float3, float3) | Gets a BezierKnot with its tangents and rotation calculated using the previous and next knot positions. |
GetAutoSmoothKnot(float3, float3, float3, float3) | Gets a BezierKnot with its tangents and rotation calculated using the previous and next knot positions. |
GetAutoSmoothKnot(float3, float3, float3, float3, float) | Gets a BezierKnot with its tangents and rotation calculated using the previous and next knot positions. |
GetAutoSmoothTangent(float3, float3, float) | Calculates a tangent from the previous and next knot positions. |
GetAutoSmoothTangent(float3, float3, float3, float) | Gets a tangent from the previous, current, and next knot positions. |
GetBounds<T>(T) | Calculate the bounding box of a Spline. |
GetBounds<T>(T, float4x4) | Creates a bounding box for a spline. |
GetCatmullRomTangent(float3, float3) | Calculates a tangent from the previous and next knot positions. |
GetCurveCount<T>(T) | Calculates the number of curves in a spline. |
GetNearestPoint<T>(T, float3, out float3, out float, int, int) | Calculate the point on a spline nearest to a point. |
GetNearestPoint<T>(T, Ray, out float3, out float, int, int) | Calculate the point on a spline nearest to a ray. |
GetNormalizedInterpolation<T>(T, float, PathIndexUnit) | Given an interpolation value in any PathIndexUnit type, calculate the normalized interpolation ratio value relative to a Spline. |
GetPointAtLinearDistance<T>(T, float, float, out float) | Given a Spline and interpolation ratio, calculate the 3d point at a linear distance from point at spline.EvaluatePosition(t). Returns the corresponding time associated to this 3d position on the Spline. |
GetSubdivisionCount(float, int) | Gets the number of subdivisions for a spline length and resolution. |
JoinSplinesOnKnots(ISplineContainer, SplineKnotIndex, SplineKnotIndex) | Joins two splines together at the specified knots. The two splines must belong to the same container and the knots must be at an extremity of their respective splines. |
LinkKnots<T>(T, SplineKnotIndex, SplineKnotIndex) | Links two knots in an ISplineContainer. The two knots can be on different splines, but both must be in the referenced SplineContainer. If these knots are linked to other knots, all existing links are kept and updated. |
NextIndex<T>(T, int) | Gets the index of a knot that follows a spline index. This method uses the Count and Closed properties to ensure that it returns the correct index of the knot. |
Next<T>(T, int) | Gets the BezierKnot after spline[index]. This method uses the Count and Closed properties to ensure that it returns the correct knot. |
PreviousIndex<T>(T, int) | Gets the index of a knot that precedes a spline index. This method uses the Count and Closed properties to ensure that it returns the correct index of the knot. |
Previous<T>(T, int) | Gets the BezierKnot before spline[index]. This method uses the Count and Closed properties to ensure that it returns the correct knot. |
ReducePoints<T>(T, List<float3>, float) | Removes redundant points in a poly line to form a similar shape with fewer points. |
ReducePoints<T>(T, float) | Removes redundant points in a poly line to form a similar shape with fewer points. |
RemoveSplineAt<T>(T, int) | Removes a spline from a ISplineContainer. |
RemoveSpline<T>(T, Spline) | Removes a spline from a ISplineContainer. |
ReorderSpline<T>(T, int, int) | Reorders a spline in a ISplineContainer. |
ReverseFlow(ISplineContainer, int) | Reverses the flow direction of a spline. |
ReverseFlow(Spline) | Reverses the flow direction of a spline. Should only be used with Splines that aren't inside any container. |
ReverseFlow(SplineInfo) | Reverses the flow direction of a spline. |
SetLinkedKnotPosition<T>(T, SplineKnotIndex) | Sets the position of all knots linked to the knot at |
SetPivot(SplineContainer, Vector3) | Reset a transform position to a position while keeping knot positions in the same place. This modifies both knot positions and transform position. |
SplineToCurveT<T>(T, float, out float) | Given a normalized interpolation (t) for a spline, calculate the curve index and curve-relative normalized interpolation. |
SplitSplineOnKnot(ISplineContainer, SplineKnotIndex) | Splits a spline in a SplineContainer into two splines at a specified knot. |
UnlinkKnots<T>(T, IReadOnlyList<SplineKnotIndex>) | Unlinks several knots from an ISplineContainer. A knot in |