Mathf
Provides constants and static methods for common mathematical functions.
Provides constants and static methods for common mathematical functions.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Methods127
Abs3 overloads
public static double Abs(double s);Returns the absolute value of Color.S (i.e. positive value).
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input number.
public static int Abs(int s);Returns the absolute value of Color.S (i.e. positive value).
| Name | Type | Default |
|---|---|---|
s | int | — |
sThe input number.
public static float Abs(float s);Returns the absolute value of Color.S (i.e. positive value).
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input number.
Acos2 overloads
public static double Acos(double s);Returns the arc cosine of Color.S in radians.
Use to get the angle of cosine Color.S.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input cosine value. Must be on the range of -1.0 to 1.0.
doubleAn angle that would result in the given cosine value. On the range 0 to Tau/2.
public static float Acos(float s);Returns the arc cosine of Color.S in radians.
Use to get the angle of cosine Color.S.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input cosine value. Must be on the range of -1.0 to 1.0.
floatAn angle that would result in the given cosine value. On the range 0 to Tau/2.
Acosh2 overloads
public static double Acosh(double s);Returns the hyperbolic arc (also called inverse) cosine of Color.S in radians.
Use it to get the angle from an angle's cosine in hyperbolic space if
Color.S is larger or equal to 1.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input hyperbolic cosine value.
doubleAn angle that would result in the given hyperbolic cosine value.
public static float Acosh(float s);Returns the hyperbolic arc (also called inverse) cosine of Color.S in radians.
Use it to get the angle from an angle's cosine in hyperbolic space if
Color.S is larger or equal to 1.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input hyperbolic cosine value.
floatAn angle that would result in the given hyperbolic cosine value.
AngleDifference2 overloads
public static double AngleDifference(double from, double to);Returns the difference between the two angles,
in range of -Mathf.Pi, Mathf.Pi.
When PhysicsRayQueryParameters2D.From and PhysicsRayQueryParameters2D.To are opposite,
returns -Mathf.Pi if from is smaller than to,
or Mathf.Pi otherwise.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
fromThe start angle.
toThe destination angle.
doubleThe difference between the two angles.
public static float AngleDifference(float from, float to);Returns the difference between the two angles,
in range of -Mathf.Pi, Mathf.Pi.
When PhysicsRayQueryParameters2D.From and PhysicsRayQueryParameters2D.To are opposite,
returns -Mathf.Pi if from is smaller than to,
or Mathf.Pi otherwise.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
fromThe start angle.
toThe destination angle.
floatThe difference between the two angles.
Asin2 overloads
public static double Asin(double s);Returns the arc sine of Color.S in radians.
Use to get the angle of sine Color.S.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input sine value. Must be on the range of -1.0 to 1.0.
doubleAn angle that would result in the given sine value. On the range -Tau/4 to Tau/4.
public static float Asin(float s);Returns the arc sine of Color.S in radians.
Use to get the angle of sine Color.S.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input sine value. Must be on the range of -1.0 to 1.0.
floatAn angle that would result in the given sine value. On the range -Tau/4 to Tau/4.
Asinh2 overloads
public static double Asinh(double s);Returns the hyperbolic arc (also called inverse) sine of Color.S in radians.
Use it to get the angle from an angle's sine in hyperbolic space.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input hyperbolic sine value.
doubleAn angle that would result in the given hyperbolic sine value.
public static float Asinh(float s);Returns the hyperbolic arc (also called inverse) sine of Color.S in radians.
Use it to get the angle from an angle's sine in hyperbolic space.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input hyperbolic sine value.
floatAn angle that would result in the given hyperbolic sine value.
Atan2 overloads
public static double Atan(double s);Returns the arc tangent of Color.S in radians.
Use to get the angle of tangent Color.S.
The method cannot know in which quadrant the angle should fall.
See Mathf.Atan2 if you have both y and x.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input tangent value.
doubleAn angle that would result in the given tangent value. On the range -Tau/4 to Tau/4.
public static float Atan(float s);Returns the arc tangent of Color.S in radians.
Use to get the angle of tangent Color.S.
The method cannot know in which quadrant the angle should fall.
See Mathf.Atan2 if you have both y and x.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input tangent value.
floatAn angle that would result in the given tangent value. On the range -Tau/4 to Tau/4.
Atan22 overloads
public static double Atan2(double y, double x);Returns the arc tangent of Basis.Y and Basis.X in radians.
Use to get the angle of the tangent of y/x. To compute the value, the method takes into
account the sign of both arguments in order to determine the quadrant.
Important note: The Y coordinate comes first, by convention.
| Name | Type | Default |
|---|---|---|
y | double | — |
x | double | — |
yThe Y coordinate of the point to find the angle to.
xThe X coordinate of the point to find the angle to.
doubleAn angle that would result in the given tangent value. On the range -Tau/2 to Tau/2.
public static float Atan2(float y, float x);Returns the arc tangent of Basis.Y and Basis.X in radians.
Use to get the angle of the tangent of y/x. To compute the value, the method takes into
account the sign of both arguments in order to determine the quadrant.
Important note: The Y coordinate comes first, by convention.
| Name | Type | Default |
|---|---|---|
y | float | — |
x | float | — |
yThe Y coordinate of the point to find the angle to.
xThe X coordinate of the point to find the angle to.
floatAn angle that would result in the given tangent value. On the range -Tau/2 to Tau/2.
Atanh2 overloads
public static double Atanh(double s);Returns the hyperbolic arc (also called inverse) tangent of Color.S in radians.
Use it to get the angle from an angle's tangent in hyperbolic space if
Color.S is between -1 and 1 (non-inclusive).
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input hyperbolic tangent value.
doubleAn angle that would result in the given hyperbolic tangent value.
public static float Atanh(float s);Returns the hyperbolic arc (also called inverse) tangent of Color.S in radians.
Use it to get the angle from an angle's tangent in hyperbolic space if
Color.S is between -1 and 1 (non-inclusive).
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input hyperbolic tangent value.
floatAn angle that would result in the given hyperbolic tangent value.
BezierDerivative2 overloads
public static double BezierDerivative(double start, double control1, double control2, double end, double t);Returns the derivative at the given t on a one dimensional Bezier curve defined by
the given control1, control2, and Aabb.End points.
| Name | Type | Default |
|---|---|---|
start | double | — |
control1 | double | — |
control2 | double | — |
end | double | — |
t | double | — |
startThe start value for the interpolation.
control1Control point that defines the bezier curve.
control2Control point that defines the bezier curve.
endThe destination value for the interpolation.
tA value on the range of 0.0 to 1.0, representing the amount of interpolation.
doubleThe resulting value of the interpolation.
public static float BezierDerivative(float start, float control1, float control2, float end, float t);Returns the derivative at the given t on a one dimensional Bezier curve defined by
the given control1, control2, and Aabb.End points.
| Name | Type | Default |
|---|---|---|
start | float | — |
control1 | float | — |
control2 | float | — |
end | float | — |
t | float | — |
startThe start value for the interpolation.
control1Control point that defines the bezier curve.
control2Control point that defines the bezier curve.
endThe destination value for the interpolation.
tA value on the range of 0.0 to 1.0, representing the amount of interpolation.
floatThe resulting value of the interpolation.
BezierInterpolate2 overloads
public static double BezierInterpolate(double start, double control1, double control2, double end, double t);Returns the point at the given t on a one-dimensional Bezier curve defined by
the given control1, control2, and Aabb.End points.
| Name | Type | Default |
|---|---|---|
start | double | — |
control1 | double | — |
control2 | double | — |
end | double | — |
t | double | — |
startThe start value for the interpolation.
control1Control point that defines the bezier curve.
control2Control point that defines the bezier curve.
endThe destination value for the interpolation.
tA value on the range of 0.0 to 1.0, representing the amount of interpolation.
doubleThe resulting value of the interpolation.
public static float BezierInterpolate(float start, float control1, float control2, float end, float t);Returns the point at the given t on a one-dimensional Bezier curve defined by
the given control1, control2, and Aabb.End points.
| Name | Type | Default |
|---|---|---|
start | float | — |
control1 | float | — |
control2 | float | — |
end | float | — |
t | float | — |
startThe start value for the interpolation.
control1Control point that defines the bezier curve.
control2Control point that defines the bezier curve.
endThe destination value for the interpolation.
tA value on the range of 0.0 to 1.0, representing the amount of interpolation.
floatThe resulting value of the interpolation.
Ceil2 overloads
public static double Ceil(double s);Rounds Color.S upward (towards positive infinity).
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe number to ceil.
public static float Ceil(float s);Rounds Color.S upward (towards positive infinity).
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe number to ceil.
CeilToInt2 overloads
public static int CeilToInt(double s);Rounds Color.S upward (towards positive infinity).
This is the same as Mathf.Ceil, but returns an int.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe number to ceil.
public static int CeilToInt(float s);Rounds Color.S upward (towards positive infinity).
This is the same as Mathf.Ceil, but returns an int.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe number to ceil.
Clamp3 overloads
public static double Clamp(double value, double min, double max);Clamps a Range.Value so that it is not less than Reckfell.Collections.Array.Min
and not more than Reckfell.Collections.Array.Max.
| Name | Type | Default |
|---|---|---|
value | double | — |
min | double | — |
max | double | — |
valueThe value to clamp.
minThe minimum allowed value.
maxThe maximum allowed value.
doubleThe clamped value.
public static int Clamp(int value, int min, int max);Clamps a Range.Value so that it is not less than Reckfell.Collections.Array.Min
and not more than Reckfell.Collections.Array.Max.
| Name | Type | Default |
|---|---|---|
value | int | — |
min | int | — |
max | int | — |
valueThe value to clamp.
minThe minimum allowed value.
maxThe maximum allowed value.
intThe clamped value.
public static float Clamp(float value, float min, float max);Clamps a Range.Value so that it is not less than Reckfell.Collections.Array.Min
and not more than Reckfell.Collections.Array.Max.
| Name | Type | Default |
|---|---|---|
value | float | — |
min | float | — |
max | float | — |
valueThe value to clamp.
minThe minimum allowed value.
maxThe maximum allowed value.
floatThe clamped value.
Cos2 overloads
public static double Cos(double s);Returns the cosine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe angle in radians.
doubleThe cosine of that angle.
public static float Cos(float s);Returns the cosine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe angle in radians.
floatThe cosine of that angle.
Cosh2 overloads
public static double Cosh(double s);Returns the hyperbolic cosine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe angle in radians.
doubleThe hyperbolic cosine of that angle.
public static float Cosh(float s);Returns the hyperbolic cosine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe angle in radians.
floatThe hyperbolic cosine of that angle.
CubicInterpolate2 overloads
public static double CubicInterpolate(double from, double to, double pre, double post, double weight);Cubic interpolates between two values by the factor defined in weight
with pre and post values.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
pre | double | — |
post | double | — |
weight | double | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
preThe value which before "from" value for interpolation.
postThe value which after "to" value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
doubleThe resulting value of the interpolation.
public static float CubicInterpolate(float from, float to, float pre, float post, float weight);Cubic interpolates between two values by the factor defined in weight
with pre and post values.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
pre | float | — |
post | float | — |
weight | float | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
preThe value which before "from" value for interpolation.
postThe value which after "to" value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
floatThe resulting value of the interpolation.
CubicInterpolateAngle2 overloads
public static double CubicInterpolateAngle(double from, double to, double pre, double post, double weight);Cubic interpolates between two rotation values with shortest path
by the factor defined in weight with pre and post values.
See also Mathf.LerpAngle.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
pre | double | — |
post | double | — |
weight | double | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
preThe value which before "from" value for interpolation.
postThe value which after "to" value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
doubleThe resulting value of the interpolation.
public static float CubicInterpolateAngle(float from, float to, float pre, float post, float weight);Cubic interpolates between two rotation values with shortest path
by the factor defined in weight with pre and post values.
See also Mathf.LerpAngle.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
pre | float | — |
post | float | — |
weight | float | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
preThe value which before "from" value for interpolation.
postThe value which after "to" value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
floatThe resulting value of the interpolation.
CubicInterpolateAngleInTime2 overloads
public static double CubicInterpolateAngleInTime(double from, double to, double pre, double post, double weight, double toT, double preT, double postT);Cubic interpolates between two rotation values with shortest path
by the factor defined in weight with pre and post values.
See also Mathf.LerpAngle.
It can perform smoother interpolation than
Mathf.CubicInterpolateAngle
by the time values.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
pre | double | — |
post | double | — |
weight | double | — |
toT | double | — |
preT | double | — |
postT | double | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
preThe value which before "from" value for interpolation.
postThe value which after "to" value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
doubleThe resulting value of the interpolation.
public static float CubicInterpolateAngleInTime(float from, float to, float pre, float post, float weight, float toT, float preT, float postT);Cubic interpolates between two rotation values with shortest path
by the factor defined in weight with pre and post values.
See also Mathf.LerpAngle.
It can perform smoother interpolation than
Mathf.CubicInterpolateAngle
by the time values.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
pre | float | — |
post | float | — |
weight | float | — |
toT | float | — |
preT | float | — |
postT | float | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
preThe value which before "from" value for interpolation.
postThe value which after "to" value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
floatThe resulting value of the interpolation.
CubicInterpolateInTime2 overloads
public static double CubicInterpolateInTime(double from, double to, double pre, double post, double weight, double toT, double preT, double postT);Cubic interpolates between two values by the factor defined in weight
with pre and post values.
It can perform smoother interpolation than
Mathf.CubicInterpolate
by the time values.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
pre | double | — |
post | double | — |
weight | double | — |
toT | double | — |
preT | double | — |
postT | double | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
preThe value which before "from" value for interpolation.
postThe value which after "to" value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
doubleThe resulting value of the interpolation.
public static float CubicInterpolateInTime(float from, float to, float pre, float post, float weight, float toT, float preT, float postT);Cubic interpolates between two values by the factor defined in weight
with pre and post values.
It can perform smoother interpolation than
Mathf.CubicInterpolate
by the time values.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
pre | float | — |
post | float | — |
weight | float | — |
toT | float | — |
preT | float | — |
postT | float | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
preThe value which before "from" value for interpolation.
postThe value which after "to" value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
floatThe resulting value of the interpolation.
DbToLinear2 overloads
public static double DbToLinear(double db);Converts from decibels to linear energy (audio).
| Name | Type | Default |
|---|---|---|
db | double | — |
dbDecibels to convert.
doubleAudio volume as linear energy.
public static float DbToLinear(float db);Converts from decibels to linear energy (audio).
| Name | Type | Default |
|---|---|---|
db | float | — |
dbDecibels to convert.
floatAudio volume as linear energy.
DecimalCount2 overloads
public static int DecimalCount(decimal s);Returns the amount of digits after the decimal place.
| Name | Type | Default |
|---|---|---|
s | decimal | — |
sThe input decimal value.
intThe amount of digits.
public static int DecimalCount(double s);Returns the amount of digits after the decimal place.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input value.
intThe amount of digits.
DegToRad2 overloads
public static double DegToRad(double deg);Converts an angle expressed in degrees to radians.
| Name | Type | Default |
|---|---|---|
deg | double | — |
degAn angle expressed in degrees.
doubleThe same angle expressed in radians.
public static float DegToRad(float deg);Converts an angle expressed in degrees to radians.
| Name | Type | Default |
|---|---|---|
deg | float | — |
degAn angle expressed in degrees.
floatThe same angle expressed in radians.
Ease2 overloads
public static double Ease(double s, double curve);Returns an eased value of Color.S based on an exponential easing function defined with CurveTexture.Curve.
The CurveTexture.Curve can be any floating-point number, with specific values leading to the following behaviors:
Lower than -1.0 (exclusive)
Ease in-out.
Exactly -1.0
Linear.
Between -1.0 and 0.0 (exclusive)
Ease out-in.
Exactly 0.0
Constant.
Between 0.0 and 1.0 (exclusive)
Ease out.
Exactly 1.0
Linear.
Greater than 1.0 (exclusive)
Ease in.
| Name | Type | Default |
|---|---|---|
s | double | — |
curve | double | — |
sThe value to ease.
curveThe exponent defining the easing curve.
doubleThe eased value.
public static float Ease(float s, float curve);Returns an eased value of Color.S based on an exponential easing function defined with CurveTexture.Curve.
The CurveTexture.Curve can be any floating-point number, with specific values leading to the following behaviors:
Lower than -1.0 (exclusive)
Ease in-out.
Exactly -1.0
Linear.
Between -1.0 and 0.0 (exclusive)
Ease out-in.
Exactly 0.0
Constant.
Between 0.0 and 1.0 (exclusive)
Ease out.
Exactly 1.0
Linear.
Greater than 1.0 (exclusive)
Ease in.
| Name | Type | Default |
|---|---|---|
s | float | — |
curve | float | — |
sThe value to ease.
curveThe exponent defining the easing curve.
floatThe eased value.
Exp2 overloads
public static double Exp(double s);The natural exponential function. It raises the mathematical
constant e to the power of Color.S and returns it.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe exponent to raise e to.
public static float Exp(float s);The natural exponential function. It raises the mathematical
constant e to the power of Color.S and returns it.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe exponent to raise e to.
Floor2 overloads
public static double Floor(double s);Rounds Color.S downward (towards negative infinity).
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe number to floor.
public static float Floor(float s);Rounds Color.S downward (towards negative infinity).
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe number to floor.
FloorToInt2 overloads
public static int FloorToInt(double s);Rounds Color.S downward (towards negative infinity).
This is the same as Mathf.Floor, but returns an int.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe number to floor.
public static int FloorToInt(float s);Rounds Color.S downward (towards negative infinity).
This is the same as Mathf.Floor, but returns an int.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe number to floor.
InverseLerp2 overloads
public static double InverseLerp(double from, double to, double weight);Returns a normalized value considering the given range.
This is the opposite of Mathf.Lerp.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
weight | double | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
weightThe interpolated value.
doubleThe resulting value of the inverse interpolation.
The returned value will be between 0.0 and 1.0 if weight is
between PhysicsRayQueryParameters2D.From and PhysicsRayQueryParameters2D.To (inclusive).
public static float InverseLerp(float from, float to, float weight);Returns a normalized value considering the given range.
This is the opposite of Mathf.Lerp.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
weight | float | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
weightThe interpolated value.
floatThe resulting value of the inverse interpolation.
The returned value will be between 0.0 and 1.0 if weight is
between PhysicsRayQueryParameters2D.From and PhysicsRayQueryParameters2D.To (inclusive).
IsEqualApprox4 overloads
public static bool IsEqualApprox(double a, double b);Returns true if Color.A and Color.B are approximately equal
to each other.
The comparison is done using a tolerance calculation with Mathf.Epsilon.
| Name | Type | Default |
|---|---|---|
a | double | — |
b | double | — |
aOne of the values.
bThe other value.
boolA bool for whether or not the two values are approximately equal.
public static bool IsEqualApprox(double a, double b, double tolerance);Returns true if Color.A and Color.B are approximately
equal to each other.
The comparison is done using the provided tolerance value.
If you want the tolerance to be calculated for you, use Mathf.IsEqualApprox.
| Name | Type | Default |
|---|---|---|
a | double | — |
b | double | — |
tolerance | double | — |
aOne of the values.
bThe other value.
toleranceThe pre-calculated tolerance value.
boolA bool for whether or not the two values are equal.
public static bool IsEqualApprox(float a, float b);Returns true if Color.A and Color.B are approximately equal
to each other.
The comparison is done using a tolerance calculation with Mathf.Epsilon.
| Name | Type | Default |
|---|---|---|
a | float | — |
b | float | — |
aOne of the values.
bThe other value.
boolA bool for whether or not the two values are approximately equal.
public static bool IsEqualApprox(float a, float b, float tolerance);Returns true if Color.A and Color.B are approximately
equal to each other.
The comparison is done using the provided tolerance value.
If you want the tolerance to be calculated for you, use Mathf.IsEqualApprox.
| Name | Type | Default |
|---|---|---|
a | float | — |
b | float | — |
tolerance | float | — |
aOne of the values.
bThe other value.
toleranceThe pre-calculated tolerance value.
boolA bool for whether or not the two values are equal.
IsFinite2 overloads
public static bool IsFinite(double s);Returns whether Color.S is a finite value, i.e. it is not
Mathf.NaN, positive infinite, or negative infinity.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe value to check.
boolA bool for whether or not the value is a finite value.
public static bool IsFinite(float s);Returns whether Color.S is a finite value, i.e. it is not
Mathf.NaN, positive infinite, or negative infinity.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe value to check.
boolA bool for whether or not the value is a finite value.
IsInf2 overloads
public static bool IsInf(double s);Returns whether Color.S is an infinity value (either positive infinity or negative infinity).
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe value to check.
boolA bool for whether or not the value is an infinity value.
public static bool IsInf(float s);Returns whether Color.S is an infinity value (either positive infinity or negative infinity).
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe value to check.
boolA bool for whether or not the value is an infinity value.
IsNaN2 overloads
public static bool IsNaN(double s);Returns whether Color.S is a NaN ("Not a Number" or invalid) value.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe value to check.
boolA bool for whether or not the value is a NaN value.
public static bool IsNaN(float s);Returns whether Color.S is a NaN ("Not a Number" or invalid) value.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe value to check.
boolA bool for whether or not the value is a NaN value.
IsZeroApprox2 overloads
public static bool IsZeroApprox(double s);Returns true if Color.S is zero or almost zero.
The comparison is done using a tolerance calculation with Mathf.Epsilon.
This method is faster than using Mathf.IsEqualApprox with
one value as zero.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe value to check.
boolA bool for whether or not the value is nearly zero.
public static bool IsZeroApprox(float s);Returns true if Color.S is zero or almost zero.
The comparison is done using a tolerance calculation with Mathf.Epsilon.
This method is faster than using Mathf.IsEqualApprox with
one value as zero.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe value to check.
boolA bool for whether or not the value is nearly zero.
Lerp2 overloads
public static double Lerp(double from, double to, double weight);Linearly interpolates between two values by a normalized value.
This is the opposite Mathf.InverseLerp.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
weight | double | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
doubleThe resulting value of the interpolation.
public static float Lerp(float from, float to, float weight);Linearly interpolates between two values by a normalized value.
This is the opposite Mathf.InverseLerp.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
weight | float | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
floatThe resulting value of the interpolation.
LerpAngle2 overloads
public static double LerpAngle(double from, double to, double weight);Linearly interpolates between two angles (in radians) by a normalized value.
Similar to Mathf.Lerp,
but interpolates correctly when the angles wrap around Mathf.Tau.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
weight | double | — |
fromThe start angle for interpolation.
toThe destination angle for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
doubleThe resulting angle of the interpolation.
public static float LerpAngle(float from, float to, float weight);Linearly interpolates between two angles (in radians) by a normalized value.
Similar to Mathf.Lerp,
but interpolates correctly when the angles wrap around Mathf.Tau.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
weight | float | — |
fromThe start angle for interpolation.
toThe destination angle for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
floatThe resulting angle of the interpolation.
LinearToDb2 overloads
public static double LinearToDb(double linear);Converts from linear energy to decibels (audio). This can be used to implement volume sliders that behave as expected (since volume isn't linear).
| Name | Type | Default |
|---|---|---|
linear | double | — |
linearThe linear energy to convert.
doubleAudio as decibels.
public static float LinearToDb(float linear);Converts from linear energy to decibels (audio). This can be used to implement volume sliders that behave as expected (since volume isn't linear).
| Name | Type | Default |
|---|---|---|
linear | float | — |
linearThe linear energy to convert.
floatAudio as decibels.
Log2 overloads
public static double Log(double s);Natural logarithm. The amount of time needed to reach a certain level of continuous growth.
Note: This is not the same as the "log" function on most calculators, which uses a base 10 logarithm.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input value.
public static float Log(float s);Natural logarithm. The amount of time needed to reach a certain level of continuous growth.
Note: This is not the same as the "log" function on most calculators, which uses a base 10 logarithm.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input value.
Max3 overloads
public static double Max(double a, double b);Returns the maximum of two values.
| Name | Type | Default |
|---|---|---|
a | double | — |
b | double | — |
aOne of the values.
bThe other value.
doubleWhichever of the two values is higher.
public static int Max(int a, int b);Returns the maximum of two values.
| Name | Type | Default |
|---|---|---|
a | int | — |
b | int | — |
aOne of the values.
bThe other value.
intWhichever of the two values is higher.
public static float Max(float a, float b);Returns the maximum of two values.
| Name | Type | Default |
|---|---|---|
a | float | — |
b | float | — |
aOne of the values.
bThe other value.
floatWhichever of the two values is higher.
Min3 overloads
public static double Min(double a, double b);Returns the minimum of two values.
| Name | Type | Default |
|---|---|---|
a | double | — |
b | double | — |
aOne of the values.
bThe other value.
doubleWhichever of the two values is lower.
public static int Min(int a, int b);Returns the minimum of two values.
| Name | Type | Default |
|---|---|---|
a | int | — |
b | int | — |
aOne of the values.
bThe other value.
intWhichever of the two values is lower.
public static float Min(float a, float b);Returns the minimum of two values.
| Name | Type | Default |
|---|---|---|
a | float | — |
b | float | — |
aOne of the values.
bThe other value.
floatWhichever of the two values is lower.
MoveToward2 overloads
public static double MoveToward(double from, double to, double delta);Moves PhysicsRayQueryParameters2D.From toward PhysicsRayQueryParameters2D.To by the InputEventPanGesture.Delta value.
Use a negative InputEventPanGesture.Delta value to move away.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
delta | double | — |
fromThe start value.
toThe value to move towards.
deltaThe amount to move by.
doubleThe value after moving.
public static float MoveToward(float from, float to, float delta);Moves PhysicsRayQueryParameters2D.From toward PhysicsRayQueryParameters2D.To by the InputEventPanGesture.Delta value.
Use a negative InputEventPanGesture.Delta value to move away.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
delta | float | — |
fromThe start value.
toThe value to move towards.
deltaThe amount to move by.
floatThe value after moving.
NearestPo2int
public static int NearestPo2(int value);Returns the nearest larger power of 2 for the integer Range.Value.
| Name | Type | Default |
|---|---|---|
value | int | — |
valueThe input value.
intThe nearest larger power of 2.
PingPong2 overloads
public static double PingPong(double value, double length);Returns the Range.Value wrapped between 0 and the Animation.Length.
If the limit is reached, the next value the function returned is decreased to the 0 side
or increased to the Animation.Length side (like a triangle wave).
If Animation.Length is less than zero, it becomes positive.
| Name | Type | Default |
|---|---|---|
value | double | — |
length | double | — |
valueThe value to pingpong.
lengthThe maximum value of the function.
doubleThe ping-ponged value.
public static float PingPong(float value, float length);Returns the Range.Value wrapped between 0 and the Animation.Length.
If the limit is reached, the next value the function returned is decreased to the 0 side
or increased to the Animation.Length side (like a triangle wave).
If Animation.Length is less than zero, it becomes positive.
| Name | Type | Default |
|---|---|---|
value | float | — |
length | float | — |
valueThe value to pingpong.
lengthThe maximum value of the function.
floatThe ping-ponged value.
PosMod3 overloads
public static double PosMod(double a, double b);Returns the floating-point modulus of Color.A divided by Color.B that wraps equally in positive and negative.
| Name | Type | Default |
|---|---|---|
a | double | — |
b | double | — |
aThe dividend, the primary input.
bThe divisor.
doubleThe resulting output.
public static int PosMod(int a, int b);Returns the integer modulus of Color.A divided by Color.B that wraps equally in positive and negative.
| Name | Type | Default |
|---|---|---|
a | int | — |
b | int | — |
aThe dividend, the primary input.
bThe divisor.
intThe resulting output.
public static float PosMod(float a, float b);Returns the floating-point modulus of Color.A divided by Color.B that wraps equally in positive and negative.
| Name | Type | Default |
|---|---|---|
a | float | — |
b | float | — |
aThe dividend, the primary input.
bThe divisor.
floatThe resulting output.
Pow2 overloads
public static double Pow(double x, double y);Returns the result of Basis.X raised to the power of Basis.Y.
| Name | Type | Default |
|---|---|---|
x | double | — |
y | double | — |
xThe base.
yThe exponent.
public static float Pow(float x, float y);Returns the result of Basis.X raised to the power of Basis.Y.
| Name | Type | Default |
|---|---|---|
x | float | — |
y | float | — |
xThe base.
yThe exponent.
RadToDeg2 overloads
public static double RadToDeg(double rad);Converts an angle expressed in radians to degrees.
| Name | Type | Default |
|---|---|---|
rad | double | — |
radAn angle expressed in radians.
doubleThe same angle expressed in degrees.
public static float RadToDeg(float rad);Converts an angle expressed in radians to degrees.
| Name | Type | Default |
|---|---|---|
rad | float | — |
radAn angle expressed in radians.
floatThe same angle expressed in degrees.
Remap2 overloads
public static double Remap(double value, double inFrom, double inTo, double outFrom, double outTo);Maps a Range.Value from [inFrom, inTo]
to [outFrom, outTo].
| Name | Type | Default |
|---|---|---|
value | double | — |
inFrom | double | — |
inTo | double | — |
outFrom | double | — |
outTo | double | — |
valueThe value to map.
inFromThe start value for the input interpolation.
inToThe destination value for the input interpolation.
outFromThe start value for the output interpolation.
outToThe destination value for the output interpolation.
doubleThe resulting mapped value mapped.
public static float Remap(float value, float inFrom, float inTo, float outFrom, float outTo);Maps a Range.Value from [inFrom, inTo]
to [outFrom, outTo].
| Name | Type | Default |
|---|---|---|
value | float | — |
inFrom | float | — |
inTo | float | — |
outFrom | float | — |
outTo | float | — |
valueThe value to map.
inFromThe start value for the input interpolation.
inToThe destination value for the input interpolation.
outFromThe start value for the output interpolation.
outToThe destination value for the output interpolation.
floatThe resulting mapped value mapped.
RotateToward2 overloads
public static double RotateToward(double from, double to, double delta);Rotates PhysicsRayQueryParameters2D.From toward PhysicsRayQueryParameters2D.To by the InputEventPanGesture.Delta amount. Will not go past PhysicsRayQueryParameters2D.To.
Similar to Mathf.MoveToward but interpolates correctly when the angles wrap around Mathf.Tau.
If InputEventPanGesture.Delta is negative, this function will rotate away from PhysicsRayQueryParameters2D.To, toward the opposite angle, and will not go past the opposite angle.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
delta | double | — |
fromThe start angle.
toThe angle to move towards.
deltaThe amount to move by.
doubleThe angle after moving.
public static float RotateToward(float from, float to, float delta);Rotates PhysicsRayQueryParameters2D.From toward PhysicsRayQueryParameters2D.To by the InputEventPanGesture.Delta amount. Will not go past PhysicsRayQueryParameters2D.To.
Similar to Mathf.MoveToward but interpolates correctly when the angles wrap around Mathf.Tau.
If InputEventPanGesture.Delta is negative, this function will rotate away from PhysicsRayQueryParameters2D.To, toward the opposite angle, and will not go past the opposite angle.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
delta | float | — |
fromThe start angle.
toThe angle to move towards.
deltaThe amount to move by.
floatThe angle after moving.
Round2 overloads
public static double Round(double s);Rounds Color.S to the nearest whole number,
with halfway cases rounded towards the nearest multiple of two.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe number to round.
doubleThe rounded number.
public static float Round(float s);Rounds Color.S to the nearest whole number,
with halfway cases rounded towards the nearest multiple of two.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe number to round.
floatThe rounded number.
RoundToInt2 overloads
public static int RoundToInt(double s);Rounds Color.S to the nearest whole number.
This is the same as Mathf.Round, but returns an int.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe number to round.
intThe rounded number.
public static int RoundToInt(float s);Rounds Color.S to the nearest whole number.
This is the same as Mathf.Round, but returns an int.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe number to round.
intThe rounded number.
Sign3 overloads
public static int Sign(double s);Returns the sign of Color.S: -1 or 1.
Returns 0 if Color.S is 0.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input number.
intOne of three possible values: 1, -1, or 0.
public static int Sign(int s);Returns the sign of Color.S: -1 or 1.
Returns 0 if Color.S is 0.
| Name | Type | Default |
|---|---|---|
s | int | — |
sThe input number.
intOne of three possible values: 1, -1, or 0.
public static int Sign(float s);Returns the sign of Color.S: -1 or 1.
Returns 0 if Color.S is 0.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input number.
intOne of three possible values: 1, -1, or 0.
Sin2 overloads
public static double Sin(double s);Returns the sine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe angle in radians.
doubleThe sine of that angle.
public static float Sin(float s);Returns the sine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe angle in radians.
floatThe sine of that angle.
SinCos2 overloads
public static ValueTuple<double, double> SinCos(double s);Returns the sine and cosine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe angle in radians.
ValueTuple<double, double>The sine and cosine of that angle.
public static ValueTuple<float, float> SinCos(float s);Returns the sine and cosine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe angle in radians.
ValueTuple<float, float>The sine and cosine of that angle.
Sinh2 overloads
public static double Sinh(double s);Returns the hyperbolic sine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe angle in radians.
doubleThe hyperbolic sine of that angle.
public static float Sinh(float s);Returns the hyperbolic sine of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe angle in radians.
floatThe hyperbolic sine of that angle.
SmoothStep2 overloads
public static double SmoothStep(double from, double to, double weight);Returns a smooth cubic Hermite interpolation factor between 0.0 and 1.0 based on
weight within the range from PhysicsRayQueryParameters2D.From to PhysicsRayQueryParameters2D.To.
The interpolation is slowest at the beginning and end of the range, and fastest halfway through.
For positive ranges (when PhysicsRayQueryParameters2D.From is less than PhysicsRayQueryParameters2D.To):
Less than or equal to PhysicsRayQueryParameters2D.From
Returns 0.
Between PhysicsRayQueryParameters2D.From and PhysicsRayQueryParameters2D.To (exclusive)
Returns an S-shaped curve that smoothly transitions from 0 to 1.
Greater than or equal to PhysicsRayQueryParameters2D.To
Returns 1.
For negative ranges (when PhysicsRayQueryParameters2D.From is greater than PhysicsRayQueryParameters2D.To):
Less than or equal to PhysicsRayQueryParameters2D.To
Returns 1.
Between PhysicsRayQueryParameters2D.To and PhysicsRayQueryParameters2D.From (exclusive)
Returns a mirrored S-shaped curve that smoothly transitions from 1 to 0.
Greater than or equal to PhysicsRayQueryParameters2D.From
Returns 0.
For empty ranges (when PhysicsRayQueryParameters2D.From equals PhysicsRayQueryParameters2D.To):
Less than or equal to PhysicsRayQueryParameters2D.From
Returns 0.
Greater than PhysicsRayQueryParameters2D.From
Returns 1.
| Name | Type | Default |
|---|---|---|
from | double | — |
to | double | — |
weight | double | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
weightA value representing the amount of interpolation.
doubleThe resulting value of the interpolation.
public static float SmoothStep(float from, float to, float weight);Returns a smooth cubic Hermite interpolation factor between 0.0 and 1.0 based on
weight within the range from PhysicsRayQueryParameters2D.From to PhysicsRayQueryParameters2D.To.
The interpolation is slowest at the beginning and end of the range, and fastest halfway through.
For positive ranges (when PhysicsRayQueryParameters2D.From is less than PhysicsRayQueryParameters2D.To):
Less than or equal to PhysicsRayQueryParameters2D.From
Returns 0.
Between PhysicsRayQueryParameters2D.From and PhysicsRayQueryParameters2D.To (exclusive)
Returns an S-shaped curve that smoothly transitions from 0 to 1.
Greater than or equal to PhysicsRayQueryParameters2D.To
Returns 1.
For negative ranges (when PhysicsRayQueryParameters2D.From is greater than PhysicsRayQueryParameters2D.To):
Less than or equal to PhysicsRayQueryParameters2D.To
Returns 1.
Between PhysicsRayQueryParameters2D.To and PhysicsRayQueryParameters2D.From (exclusive)
Returns a mirrored S-shaped curve that smoothly transitions from 1 to 0.
Greater than or equal to PhysicsRayQueryParameters2D.From
Returns 0.
For empty ranges (when PhysicsRayQueryParameters2D.From equals PhysicsRayQueryParameters2D.To):
Less than or equal to PhysicsRayQueryParameters2D.From
Returns 0.
Greater than PhysicsRayQueryParameters2D.From
Returns 1.
| Name | Type | Default |
|---|---|---|
from | float | — |
to | float | — |
weight | float | — |
fromThe start value for interpolation.
toThe destination value for interpolation.
weightA value representing the amount of interpolation.
floatThe resulting value of the interpolation.
Snapped2 overloads
public static double Snapped(double s, double step);Snaps float value Color.S to a given Animation.Step.
This can also be used to round a floating point number to an arbitrary number of decimals.
| Name | Type | Default |
|---|---|---|
s | double | — |
step | double | — |
sThe value to snap.
stepThe step size to snap to.
doubleThe snapped value.
public static float Snapped(float s, float step);Snaps float value Color.S to a given Animation.Step.
This can also be used to round a floating point number to an arbitrary number of decimals.
| Name | Type | Default |
|---|---|---|
s | float | — |
step | float | — |
sThe value to snap.
stepThe step size to snap to.
floatThe snapped value.
Sqrt2 overloads
public static double Sqrt(double s);Returns the square root of Color.S, where Color.S is a non-negative number.
If you need negative inputs, use System.Numerics.Complex.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe input number. Must not be negative.
public static float Sqrt(float s);Returns the square root of Color.S, where Color.S is a non-negative number.
If you need negative inputs, use System.Numerics.Complex.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe input number. Must not be negative.
StepDecimalsint
public static int StepDecimals(double step);Returns the position of the first non-zero digit, after the decimal point. Note that the maximum return value is 10, which is a design decision in the implementation.
| Name | Type | Default |
|---|---|---|
step | double | — |
stepThe input value.
intThe position of the first non-zero digit.
Tan2 overloads
public static double Tan(double s);Returns the tangent of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe angle in radians.
doubleThe tangent of that angle.
public static float Tan(float s);Returns the tangent of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe angle in radians.
floatThe tangent of that angle.
Tanh2 overloads
public static double Tanh(double s);Returns the hyperbolic tangent of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | double | — |
sThe angle in radians.
doubleThe hyperbolic tangent of that angle.
public static float Tanh(float s);Returns the hyperbolic tangent of angle Color.S in radians.
| Name | Type | Default |
|---|---|---|
s | float | — |
sThe angle in radians.
floatThe hyperbolic tangent of that angle.
Wrap3 overloads
public static double Wrap(double value, double min, double max);Wraps Range.Value between Reckfell.Collections.Array.Min and Reckfell.Collections.Array.Max.
Usable for creating loop-alike behavior or infinite surfaces.
If Reckfell.Collections.Array.Min is 0, this is equivalent
to Mathf.PosMod, so prefer using that instead.
| Name | Type | Default |
|---|---|---|
value | double | — |
min | double | — |
max | double | — |
valueThe value to wrap.
minThe minimum allowed value and lower bound of the range.
maxThe maximum allowed value and upper bound of the range.
doubleThe wrapped value.
public static int Wrap(int value, int min, int max);Wraps Range.Value between Reckfell.Collections.Array.Min and Reckfell.Collections.Array.Max.
Usable for creating loop-alike behavior or infinite surfaces.
If Reckfell.Collections.Array.Min is 0, this is equivalent
to Mathf.PosMod, so prefer using that instead.
| Name | Type | Default |
|---|---|---|
value | int | — |
min | int | — |
max | int | — |
valueThe value to wrap.
minThe minimum allowed value and lower bound of the range.
maxThe maximum allowed value and upper bound of the range.
intThe wrapped value.
public static float Wrap(float value, float min, float max);Wraps Range.Value between Reckfell.Collections.Array.Min and Reckfell.Collections.Array.Max.
Usable for creating loop-alike behavior or infinite surfaces.
If Reckfell.Collections.Array.Min is 0, this is equivalent
to Mathf.PosMod, so prefer using that instead.
| Name | Type | Default |
|---|---|---|
value | float | — |
min | float | — |
max | float | — |
valueThe value to wrap.
minThe minimum allowed value and lower bound of the range.
maxThe maximum allowed value and upper bound of the range.
floatThe wrapped value.
Fields and constants7
EField
public const float E = 2.7182817f;The natural number e.
EpsilonField
public const float Epsilon = 1E-06f;A very small number used for float comparison with error tolerance.
1e-06 with single-precision floats, but 1e-14 if REAL_T_IS_DOUBLE.
InfField
public const float Inf = float.PositiveInfinity;Positive infinity. For negative infinity, use -Mathf.Inf.
NaNField
public const float NaN = float.NaN;"Not a Number", an invalid value. NaN has special properties, including
that it is not equal to itself. It is output by some invalid operations,
such as dividing zero by zero.
PiField
public const float Pi = 3.1415927f;Constant that represents how many times the diameter of a circle
fits around its perimeter. This is equivalent to Mathf.Tau / 2.
Sqrt2Field
public const float Sqrt2 = 1.4142135f;The square root of 2.
TauField
public const float Tau = 6.2831855f;The circle constant, the circumference of the unit circle in radians.