class MAGES::Utilities::MathUtilities

Overview

Mathematics Utilities. More…

class MathUtilities
{
public:
    // methods

    static bool Approximately(Pose a, Pose b);
    static bool Approximately(Vector3 a, Vector3 b);
    static bool Approximately(Quaternion a, Quaternion b);

    static float Remap(
        float val,
        float minFrom,
        float maxFrom,
        float minTo,
        float maxTo
    );

    static Pose Lerp(Pose a, Pose b, float t);
    static Vector3 ArbitraryPerpendicularVector(in Vector3 v);
};

Detailed Documentation

Mathematics Utilities.

Methods

static bool Approximately(Pose a, Pose b)

Checks if two poses are approximately equal.

Parameters:

a

Pose 1.

b

Pose 2.

Returns:

true if the two poses are approximately equals.

static bool Approximately(Vector3 a, Vector3 b)

Checks if two vectors are approximately equal.

Parameters:

a

Vector 1.

b

Vector 2.

Returns:

true if the two vectors are approximately equals.

static bool Approximately(Quaternion a, Quaternion b)

Checks if two quaternions are approximately equal.

Parameters:

a

Quaternion 1.

b

Quaternion 2.

Returns:

true if the two quaternions are approximately equals.

static float Remap(
    float val,
    float minFrom,
    float maxFrom,
    float minTo,
    float maxTo
)

Remaps a value in the range of [minFrom, maxFrom] to the range of [minTo, maxTo].

Parameters:

val

The value to remap.

minFrom

The lower end of the range for val.

maxFrom

The higher end of the range for val.

minTo

The lower end of the new range.

maxTo

The higher end of the new range.

Returns:

The remapped value.

static Pose Lerp(Pose a, Pose b, float t)

Linearly interpolates between two poses.

Parameters:

a

Pose A.

b

Pose B.

t

Interpolation factor.

Returns:

The interpolated pose.

static Vector3 ArbitraryPerpendicularVector(in Vector3 v)

Finds a vector perpendicular to v.

Parameters:

v

The input vector.

Returns:

Returns one of the perpendicular vectors to the input vector