GoostMath¶
Inherits: Object
Math functions.
Description¶
The singleton which provides various mathematical functions.
Methods¶
Variant | bezier ( Variant a, Variant ac, Variant bc, Variant b, float weight ) |
Variant | catmull_rom ( Variant ac, Variant a, Variant b, Variant bc, float weight ) |
bool | is_between ( float s, float a, float b ) |
bool | is_equal_approx ( float a, float b, float tolerance=1e-06 ) |
bool | is_in_range ( float s, float min, float max ) |
bool | is_zero_approx ( float s, float tolerance=1e-06 ) |
float | log ( float x, float base=2.71828 ) |
float | log10 ( float x ) |
float | log2 ( float x ) |
Method Descriptions¶
Interpolates a cubic Bézier curve between the four control points a
, ac
, bc
, b
. Points ac
and bc
provide directional information, and the distance between these points determines how fast the curve moves towards ac
before turning towards bc
.
The following types are supported: float, Vector2, Vector3.
Interpolates a centripetal Catmull–Rom spline between the four control points ac
, a
, b
, bc
. Points ac
and bc
provide directional information, and the interpolated values lie between a
and b
points.
The following types are supported: float, Vector2, Vector3.
Returns true
if s
lies between a
and b
values. Here, “between” means that s
lies within the range of [a, b]
or [b, a]
ranges, so a
and b
should not be seen as min and max values, but rather as two extremes of the range. To prevent this, use is_in_range instead.
Values are compared using non-strict inequality. If a
and b
are the same, then s
will still return true
if s
equals to a
and b
.
Returns true
if a
and b
are approximately equal to each other.
Here, approximately equal means that a
and b
are within tolerance
of each other.
Infinity values of the same sign are considered equal.
Returns true
if s
is in the range of min
and max
values. If min > max
, the range is considered invalid and an error is printed. To prevent this, use is_between instead.
Values are compared using non-strict inequality. If min
and max
are the same, then s
will still return true
if s
equals to min
and max
.
Returns true
if s
is zero or almost zero.
This method is faster than using is_equal_approx with one value as zero.
Computes logarithm of x
with arbitrary base. If base
is not specified, returns natural logarithm of x
.
Computes common logarithm of x
.
Computes binary logarithm of x
.