Table of Contents

Class CurvyUtility

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

x float
y float

Returns

bool

ClampDistance(float, CurvyClamping, float)

Clamps absolute position

public static float ClampDistance(float distance, CurvyClamping clamping, float length)

Parameters

distance float
clamping CurvyClamping
length float

Returns

float

ClampDistance(float, CurvyClamping, float, float, float)

Clamps absolute position

public static float ClampDistance(float distance, CurvyClamping clamping, float length, float min, float max)

Parameters

distance float
clamping CurvyClamping
length float
min float
max float

Returns

float

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

distance float
dir int
clamping CurvyClamping
length float

Returns

float

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

distance float
dir int
clamping CurvyClamping
length float
min float
max float

Returns

float

ClampTF(float, CurvyClamping)

Clamps relative position

public static float ClampTF(float tf, CurvyClamping clamping)

Parameters

tf float
clamping CurvyClamping

Returns

float

ClampTF(float, ref int, CurvyClamping)

Clamps relative position and sets new direction

public static float ClampTF(float tf, ref int dir, CurvyClamping clamping)

Parameters

tf float
dir int
clamping CurvyClamping

Returns

float

ClampValue(float, CurvyClamping, float, float)

Clamps a float to a range

public static float ClampValue(float tf, CurvyClamping clamping, float minTF, float maxTF)

Parameters

tf float
clamping CurvyClamping
minTF float
maxTF float

Returns

float

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

point Vector3

the input point

points Vector3[]

A list of points to test against

pointsCount int

The number of points to test against

index int

the index of the closest point

fragement float

a 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

array float[]

The array to search into

elementsCount int

The number of elements of the array to search into

x float

The element to search for

Returns

int

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

array float[]

The array to search into

x float

The element to search for

Returns

int

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

spline CurvySpline

Returns

Mesh