Class CoefficientUtils
Namespace: Unity.Labs.Utils
Syntax
public static class CoefficientUtils
Methods
FromDistance(Single, Single, Single)
Returns the interpolation value covered by a given range. Ensure that max != min to avoid dividing by zero
Declaration
public static float FromDistance(float distance, float min, float max)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | distance | The actual distance value |
| Single | min | the distance at which the coefficient will be 0 |
| Single | max | the distance at which the coefficient will be 1 |
Returns
| Type | Description |
|---|---|
| Single | the interpolation value covered by a given range |
FromDistance(Vector3, Vector3, Single, Single)
Returns the interpolation value covered by a given range. Ensure that max != min to avoid dividing by zero
Declaration
public static float FromDistance(Vector3 a, Vector3 b, float min, float max)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | a | Either of the pair of points |
| Vector3 | b | Either of the pair of points |
| Single | min | the distance at which the coefficient will be 0 |
| Single | max | the distance at which the coefficient will be 1 |
Returns
| Type | Description |
|---|---|
| Single | the interpolation value covered by a given range |
FromInverseDistance(Vector3, Vector3, Single, Single)
Returns the interpolation value covered by a given inverse range. Ensure that max != min to avoid dividing by zero
Declaration
public static float FromInverseDistance(Vector3 a, Vector3 b, float max, float min)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | a | Either of the pair of points |
| Vector3 | b | Either of the pair of points |
| Single | max | the distance at which the coefficient will be 1 |
| Single | min | the distance at which the coefficient will be 0 |
Returns
| Type | Description |
|---|---|
| Single | the interpolation value covered by a given inverse range |