Class CurvyUtility
- Namespace
- FluffyUnderware.Curvy.Utils
Curvy Utility class
public static class CurvyUtility
- Inheritance
-
CurvyUtility
Methods
Approximately(float, float)
Does the same things as Mathf.Approximately, but with different handling of case where one of the two values is 0 Considering inputs of 0 and 1E-7, Mathf.Approximately will return false, while this method will return true.
public static bool Approximately(this float x, float y)
Parameters
Returns
ClampDistance(float, CurvyClamping, float)
Clamps absolute position
public static float ClampDistance(float distance, CurvyClamping clamping, float length)
Parameters
distancefloatclampingCurvyClampinglengthfloat
Returns
ClampDistance(float, CurvyClamping, float, float, float)
Clamps absolute position
public static float ClampDistance(float distance, CurvyClamping clamping, float length, float min, float max)
Parameters
distancefloatclampingCurvyClampinglengthfloatminfloatmaxfloat
Returns
ClampDistance(float, ref int, CurvyClamping, float)
Clamps absolute position and sets new direction
public static float ClampDistance(float distance, ref int dir, CurvyClamping clamping, float length)
Parameters
distancefloatdirintclampingCurvyClampinglengthfloat
Returns
ClampDistance(float, ref int, CurvyClamping, float, float, float)
Clamps absolute position and sets new direction
public static float ClampDistance(float distance, ref int dir, CurvyClamping clamping, float length, float min, float max)
Parameters
Returns
ClampTF(float, CurvyClamping)
Clamps relative position
public static float ClampTF(float tf, CurvyClamping clamping)
Parameters
tffloatclampingCurvyClamping
Returns
ClampTF(float, ref int, CurvyClamping)
Clamps relative position and sets new direction
public static float ClampTF(float tf, ref int dir, CurvyClamping clamping)
Parameters
tffloatdirintclampingCurvyClamping
Returns
ClampValue(float, CurvyClamping, float, float)
Clamps a float to a range
public static float ClampValue(float tf, CurvyClamping clamping, float minTF, float maxTF)
Parameters
tffloatclampingCurvyClampingminTFfloatmaxTFfloat
Returns
GetDefaultMaterial()
Gets the default material, i.e. Curvy/Resources/CurvyDefaultMaterial
public static Material GetDefaultMaterial()
Returns
- Material
GetNearestPointIndex(Vector3, Vector3[], int, out int, out float)
Given an input point, gets the index of the point in the array that is closest to the input point.
public static void GetNearestPointIndex(Vector3 point, Vector3[] points, int pointsCount, out int index, out float fragement)
Parameters
pointVector3the input point
pointsVector3[]A list of points to test against
pointsCountintThe number of points to test against
indexintthe index of the closest point
fragementfloata value between 0 and 1 indicating how close the input point is close to the point of index: index + 1
InterpolationSearch(float[], int, float)
Finds the index of x in an array of sorted values (ascendant order). If x not found, the closest smaller value's index is returned if any, -1 otherwise
public static int InterpolationSearch(float[] array, int elementsCount, float x)
Parameters
arrayfloat[]The array to search into
elementsCountintThe number of elements of the array to search into
xfloatThe element to search for
Returns
InterpolationSearch(float[], float)
Finds the index of x in an array of sorted values (ascendant order). If x not found, the closest smaller value's index is returned if any, -1 otherwise
public static int InterpolationSearch(float[] array, float x)
Parameters
Returns
SplineToMesh(CurvySpline)
Returns a mesh which boundaries are the input spline, similarly to what the Spline To Mesh window does, but simpler and less configurable.
public static Mesh SplineToMesh(this CurvySpline spline)
Parameters
splineCurvySpline
Returns
- Mesh