Class Helper
- Namespace
- Alis.Core.Aspect.Math.Util
- Assembly
- Alis.dll
Contains commonly used precalculated values and mathematical operations.
public static class HelperInheritance
Inherited Members
Methods
Barycentric(float, float, float, float, float)
Returns the Cartesian coordinate for one axis of a point that is defined by a given triangle and two normalized barycentric (areal) coordinates.
public static float Barycentric(float value1, float value2, float value3, float amount1, float amount2)Parameters
value1float-
The coordinate on one axis of vertex 1 of the defining triangle.
value2float-
The coordinate on the same axis of vertex 2 of the defining triangle.
value3float-
The coordinate on the same axis of vertex 3 of the defining triangle.
amount1float-
The normalized barycentric (areal) coordinate b2, equal to the weighting factor for vertex 2, the coordinate of which is specified in value2.
amount2float-
The normalized barycentric (areal) coordinate b3, equal to the weighting factor for vertex 3, the coordinate of which is specified in value3.
Returns
- float
-
Cartesian coordinate of the specified point with respect to the axis being used.
CatmullRom(float, float, float, float, float)
Performs a Catmull-Rom interpolation using the specified positions.
public static float CatmullRom(float value1, float value2, float value3, float value4, float amount)Parameters
value1float-
The first position in the interpolation.
value2float-
The second position in the interpolation.
value3float-
The third position in the interpolation.
value4float-
The fourth position in the interpolation.
amountfloat-
Weighting factor.
Returns
- float
-
A position that is the result of the Catmull-Rom interpolation.
Clamp(float, float, float)
Restricts a value to be within a specified range.
public static float Clamp(float value, float min, float max)Parameters
valuefloat-
The value to clamp.
minfloat-
The minimum value. If
valueis less thanmin,minwill be returned. maxfloat-
The maximum value. If
valueis greater thanmax,maxwill be returned.
Returns
- float
-
The clamped value.
Distance(float, float)
Calculates the absolute value of the difference of two values.
public static float Distance(float value1, float value2)Parameters
Returns
- float
-
Distance between the two values.
Hermite(float, float, float, float, float)
Performs a Hermite spline interpolation.
public static float Hermite(float value1, float tangent1, float value2, float tangent2, float amount)Parameters
value1float-
Source position.
tangent1float-
Source tangent.
value2float-
Source position.
tangent2float-
Source tangent.
amountfloat-
Weighting factor.
Returns
- float
-
The result of the Hermite spline interpolation.
IsPowerOfTwo(int)
Determines if value is powered by two.
public static bool IsPowerOfTwo(int value)Parameters
valueint-
A value.
Returns
- bool
-
trueifvalueis powered by two; otherwisefalse.
Lerp(float, float, float)
Lerp the value 1
public static float Lerp(float value1, float value2, float amount)Parameters
Returns
- float
-
The float
Max(float, float)
Returns the greater of two values.
public static float Max(float value1, float value2)Parameters
Returns
- float
-
The greater value.
Min(float, float)
Returns the lesser of two values.
public static float Min(float value1, float value2)Parameters
Returns
- float
-
The lesser value.
SmoothStep(float, float, float)
Interpolates between two values using a cubic equation.
public static float SmoothStep(float value1, float value2, float amount)Parameters
Returns
- float
-
Interpolated value.
ToDegrees(float)
Converts radians to degrees.
public static float ToDegrees(float radians)Parameters
radiansfloat-
The angle in radians.
Returns
- float
-
The angle in degrees.
Remarks
This method uses double precission internally, though it returns single float Factor = 180 / pi
ToRadians(float)
Converts degrees to radians.
public static float ToRadians(float degrees)Parameters
degreesfloat-
The angle in degrees.
Returns
- float
-
The angle in radians.
Remarks
This method uses double precission internally, though it returns single float Factor = pi / 180
WrapAngle(float)
Reduces a given angle to a value between π and -π.
public static float WrapAngle(float angle)Parameters
anglefloat-
The angle to reduce, in radians.
Returns
- float
-
The new angle, in radians.