using System;
using System.Collections.Generic;
using Unity.Mathematics;
namespace UnityEngine.Splines
{
///
/// A key-value pair associating a distance to interpolation ratio ('t') value. This is used when evaluating Spline
/// attributes to ensure uniform distribution of sampling points.
///
///
[Serializable]
public struct DistanceToInterpolation
{
///
/// Distance in Unity units.
///
public float Distance;
///
/// A normalized interpolation ratio ('t').
///
public float T;
internal static readonly DistanceToInterpolation Invalid = new () { Distance = -1f, T = -1f };
}
///
/// This interface defines a collection of knot indices that should be considered disconnected from the following
/// knot indices when creating a .
///
public interface IHasEmptyCurves
{
///
/// A collection of knot indices that should be considered degenerate curves for the purpose of creating a
/// non-interpolated gap between curves.
///
public IReadOnlyList EmptyCurves { get; }
}
///
/// ISpline defines the interface from which Spline types inherit.
///
public interface ISpline : IReadOnlyList
{
///
/// Whether the spline is open (has a start and end point) or closed (forms an unbroken loop).
///
bool Closed { get; }
///
/// Return the sum of all curve lengths, accounting for state.
///
///
/// Returns the sum length of all curves composing this spline, accounting for closed state.
///
float GetLength();
///
/// Get a from a knot index.
///
/// The knot index that serves as the first control point for this curve.
///
/// A formed by the knot at index and the next knot.
///
public BezierCurve GetCurve(int index);
///
/// Return the length of a curve.
///
/// The index of the curve for which the length needs to be retrieved.
///
///
/// Returns the length of the curve of index 'index' in the spline.
///
public float GetCurveLength(int index);
///
/// Return the up vector for a t ratio on the curve. Contrary to ,
/// this method uses cached values when possible for better performance when accessing
/// these values regularly.
///
/// The index of the curve for which the length needs to be retrieved.
/// A value between 0 and 1 representing the ratio along the curve.
///
/// Returns the up vector at the t ratio of the curve of index 'index'.
///
public float3 GetCurveUpVector(int index, float t);
///
/// Return the interpolation ratio (0 to 1) corresponding to a distance on a . Distance
/// is relative to the curve.
///
/// The zero-based index of the curve.
/// The distance (measuring from the knot at curveIndex) to convert to a normalized interpolation ratio.
/// The normalized interpolation ratio matching distance on the designated curve.
public float GetCurveInterpolation(int curveIndex, float curveDistance);
}
}