Math Class Reference

#include <Math.h>

Description

Utility providing some additional math operations.

Static Functions

static float Step (float &f, float dest, float stepSize)
 
static float GetHypotenuse (float a, float b)
 
static float Pi ()
 
static bool IsVectorWithinBounds (const Dynacoe::Vector &src, const Dynacoe::Vector &boundPos, float boundW, float boundH)
 
static bool IsVectorWithinRange (const Dynacoe::Vector &p1, const Dynacoe::Vector &p2, float range)
 
Clamp functions

Clamping bounds the first argument, i, to be within min and max. If i is less than min, it is set to min. If it is greater than max, i is set to max.

static void Clamp (double &i, double min, double max)
 
static void Clamp (int &, int min, int max)
 
static void Clamp (float &i, float min, float max)
 
Snapping functions

Snapping binds a value, i, to the nearest multiple of a value, subdiv.

static void SnapToNearest (int &i, int subdiv)
 
static void SnapToNearest (float &i, float subdiv)
 
static void SnapToNearest (double &i, double subdiv)
 
Radian <-> degree conversion.
static float RadsToDegrees (float rads)
 
static float DegreesToRads (float degrees)
 

Member Function Documentation

static float Step ( float &  f,
float  dest,
float  stepSize 
)
static

Makes a value approach another.

Parameters
fThe value to modify.
destThe value to approach.
stepSizeThe rate at which to approach dest.
static float GetHypotenuse ( float  a,
float  b 
)
static

Returns sqrt((pow(a, 2) + pow(b, 2)).

static float Pi ( )
static

Returns a standard pi value.

static bool IsVectorWithinBounds ( const Dynacoe::Vector src,
const Dynacoe::Vector boundPos,
float  boundW,
float  boundH 
)
static

Returns whether or not a point is within a rectangle bounding box. The edge of the bounding box is considered within bounds.

Parameters
srcThe point to test.
boundPosThe topleft corner of the box.
boundWThe width of the bounding box.
boundHThe height of the bounding box.
static bool IsVectorWithinRange ( const Dynacoe::Vector p1,
const Dynacoe::Vector p2,
float  range 
)
static

Checks to see if a point is within a certain distance.


The documentation for this class was generated from the following file:
  • /home/jc/git/Dynacoe/DynacoeSrc/includes/Dynacoe/Util/Math.h