Slippers Engine
 
Loading...
Searching...
No Matches
MathTools Class Reference

Collection of Math Tools. More...

#include <MathTools.h>

Static Public Member Functions

static float FastSqrt (float x)
 Calculate Sqrt without std::sqrt.
 
static float RandFloat (float lower, float upper)
 Generates Random Floating Point Number using std::random_device.
 
static void PointTowards (Matrix &world, Vect target)
 Points object towards target.
 
static float DegToRad (float a)
 Converts angle in degrees to angle in radians.
 
static float RadToDeg (float a)
 Converts angle in radians to angle in degrees.
 
static std::vector< Vect > ScreenToWorldPersp (float x, float y)
 Takes a screen position and returns the world position at the near and far clip plane.
 
Translations
static void ChangePos (Matrix &world, float x, float y, float z)
 Changes world position based on current position.
 
static void SetPos (Matrix &world, float x, float y, float z)
 Sets world position to exact XYZ coordinates.
 
static float GetXPos (const Matrix &world)
 Returns objects X Position.
 
static float GetYPos (const Matrix &world)
 Returns objects Y Position.
 
static float GetZPos (const Matrix &world)
 Returns objects Z Position.
 
Scaling
static void ChangeScale (Matrix &world, float scaleFactor)
 Uniformly scales object, based on the objects current size * ScaleFactor.
 
static void SetScale (Matrix &world, float scaleFactor)
 Sets object scaling uniformly to ScaleFactor.
 
static float GetScaleFactor (const Matrix &world)
 Returns objects ScaleFactor assuming uniform scaling.
 
static float GetScaleFactorImprecise (const Matrix &world)
 Returns objects ScaleFactor assuming uniform scaling using FastSqrt.
 
Rotations
static void ChangeRotRad (Matrix &world, float x, float y, float z)
 Gets the angle of an object towards a point in radians.
 
static void ChangeRotRadRev (Matrix &world, float x, float y, float z)
 Changes rotation in radians of object relative to current object: World * Rot.
 
static void ChangeRotDeg (Matrix &world, float x, float y, float z)
 Changes rotation in degrees of object relative to current object: Rot * World.
 
static void ChangeRotDegRev (Matrix &world, float x, float y, float z)
 Changes rotation in degrees of object relative to current object: World * Rot.
 
static void SetRotRad (Matrix &world, float x, float y, float z)
 Sets rotation to an exact angle in radians based on XYZ.
 
static void SetRotDeg (Matrix &world, float x, float y, float z)
 Sets rotation to an exact angle in degrees based on XYZ.
 
static float GetRotXRad (const Matrix &world)
 Returns rotation of X in radians.
 
static float GetRotYRad (const Matrix &world)
 Returns rotation of Y in radians.
 
static float GetRotZRad (const Matrix &world)
 Returns rotation of Z in radians.
 
static float GetRotXDeg (const Matrix &world)
 Returns rotation of X in degrees.
 
static float GetRotYDeg (const Matrix &world)
 Returns rotation of Y in degrees.
 
static float GetRotZDeg (const Matrix &world)
 Returns rotation of Z in degrees.
 

Detailed Description

Collection of Math Tools.