class Math

Utility class providing common scalar math operations.

Public

Methods

staticCos

static float Cos(float val)

staticCos

static double Cos(double val)

staticSin

static float Sin(float val)

staticSin

static double Sin(double val)

staticTan

static float Tan(float val)

staticTan

static double Tan(double val)

staticCeilToInt

static int32_t CeilToInt(float val)

Returns the nearest integer equal or higher to the provided value.

If you are sure the input is positive use ceilToPosInt() for a slightly faster operation.

staticCeilToPosInt

static uint32_t CeilToPosInt(float val)

Returns the nearest integer equal or higher to the provided value.

Value must be non-negative. Slightly faster than ceilToInt().

staticRoundToI32

static int32_t RoundToI32(float val)

Returns the integer nearest to the provided value.

If you are sure the input is positive use roundToPosInt() for a slightly faster operation.

staticRoundToU32

static uint32_t RoundToU32(float val)

Returns the integer nearest to the provided value.

Value must be non-negative. Slightly faster than roundToInt().

staticRoundToMultiple

static float RoundToMultiple(float x, float multiple)

Rounds to the nearest multiple of .

staticRoundToMultiple

static double RoundToMultiple(double x, double multiple)

Rounds to the nearest multiple of .

staticIsPrime

static bool IsPrime(int n)

Check if the value is a prime number.

staticSmoothStep

static float SmoothStep(float val1, float val2, float t)

Performs smooth Hermite interpolation between values.

staticQuintic

static float Quintic(float val)

Performs quintic interpolation where is the value to map onto a quintic S-curve. should be in [0, 1] range.

staticCubic

static float Cubic(float val1, float val2, float val3, float val4, float f)

Performs cubic interpolation between two values bound between two other values where is the alpha value.

It should range from 0.0f to 1.0f. If it is 0.0f the method returns . If it is 1.0f it returns .

staticApproxEquals

static bool ApproxEquals(float a, float b, float tolerance = std::numeric_limits<float>::epsilon())

Compare two floats, using tolerance for inaccuracies.

staticApproxEquals

static bool ApproxEquals(double a, double b, double tolerance = std::numeric_limits<double>::epsilon())

Compare two doubles, using tolerance for inaccuracies.

staticApproxEquals

static bool ApproxEquals(const Vector2 &a, const Vector2 &b, float tolerance = std::numeric_limits<float>::epsilon())

Compare two 2D vectors, using tolerance for inaccuracies.

staticApproxEquals

static bool ApproxEquals(const Vector3 &a, const Vector3 &b, float tolerance = std::numeric_limits<float>::epsilon())

Compare two 3D vectors, using tolerance for inaccuracies.

staticApproxEquals

static bool ApproxEquals(const Vector4 &a, const Vector4 &b, float tolerance = std::numeric_limits<float>::epsilon())

Compare two 4D vectors, using tolerance for inaccuracies.

staticApproxEquals

static bool ApproxEquals(const Quaternion &a, const Quaternion &b, float tolerance = std::numeric_limits<float>::epsilon())

Compare two quaternions, using tolerance for inaccuracies.

staticCalculateTriTangent

static Vector3 CalculateTriTangent(const Vector3 &position1, const Vector3 &position2, const Vector3 &position3, float u1, float v1, float u2, float v2, float u3, float v3)

Calculates the tangent space vector for a given set of positions / texture coords.

staticFastSin0

static float FastSin0(const Radian &val)

Sine function approximation.

val
Angle in range [0, pi/2].

staticFastSin0

static float FastSin0(float val)

Sine function approximation.

val
Angle in range [0, pi/2].

staticFastSin1

static float FastSin1(const Radian &val)

Sine function approximation.

val
Angle in range [0, pi/2].

staticFastSin1

static float FastSin1(float val)

Sine function approximation.

val
Angle in range [0, pi/2].

staticFastCos0

static float FastCos0(const Radian &val)

Cosine function approximation.

val
Angle in range [0, pi/2].

staticFastCos0

static float FastCos0(float val)

Cosine function approximation.

val
Angle in range [0, pi/2].

staticFastCos1

static float FastCos1(const Radian &val)

Cosine function approximation.

val
Angle in range [0, pi/2].

staticFastCos1

static float FastCos1(float val)

Cosine function approximation.

val
Angle in range [0, pi/2].

staticFastTan0

static float FastTan0(const Radian &val)

Tangent function approximation.

val
Angle in range [0, pi/4].

staticFastTan0

static float FastTan0(float val)

Tangent function approximation.

val
Angle in range [0, pi/4].

staticFastTan1

static float FastTan1(const Radian &val)

Tangent function approximation.

val
Angle in range [0, pi/4].

staticFastTan1

static float FastTan1(float val)

Tangent function approximation.

val
Angle in range [0, pi/4].

staticFastASin0

static float FastASin0(const Radian &val)

Inverse sine function approximation.

val
Angle in range [0, 1].

staticFastASin0

static float FastASin0(float val)

Inverse sine function approximation.

val
Angle in range [0, 1].

staticFastASin1

static float FastASin1(const Radian &val)

Inverse sine function approximation.

val
Angle in range [0, 1].

staticFastASin1

static float FastASin1(float val)

Inverse sine function approximation.

val
Angle in range [0, 1].

staticFastACos0

static float FastACos0(const Radian &val)

Inverse cosine function approximation.

val
Angle in range [0, 1].

staticFastACos0

static float FastACos0(float val)

Inverse cosine function approximation.

val
Angle in range [0, 1].

staticFastACos1

static float FastACos1(const Radian &val)

Inverse cosine function approximation.

val
Angle in range [0, 1].

staticFastACos1

static float FastACos1(float val)

Inverse cosine function approximation.

val
Angle in range [0, 1].

staticFastATan0

static float FastATan0(const Radian &val)

Inverse tangent function approximation.

val
Angle in range [-1, 1].

staticFastATan0

static float FastATan0(float val)

Inverse tangent function approximation.

val
Angle in range [-1, 1].

staticFastATan1

static float FastATan1(const Radian &val)

Inverse tangent function approximation.

val
Angle in range [-1, 1].

staticFastATan1

static float FastATan1(float val)

Inverse tangent function approximation.

val
Angle in range [-1, 1].