|
bool | IsEqual (float a, float b, float tolerance=Math::TOLERANCE) |
| Compares a and b within tolerance. More...
|
|
bool | IsZero (float a, float tolerance=Math::TOLERANCE) |
| Compares a to zero within tolerance. More...
|
|
float | Min (float a, float b) |
| Minimum. More...
|
|
float | Min (float a, float b, float c) |
|
float | Min (float a, float b, float c, float d) |
|
float | Min (float a, float b, float c, float d, float e) |
|
float | Max (float a, float b) |
| Maximum. More...
|
|
float | Max (float a, float b, float c) |
|
float | Max (float a, float b, float c, float d) |
|
float | Max (float a, float b, float c, float d, float e) |
|
template<typename T > |
T | Clamp (T value, T min, T max) |
| Clamps the value to a range specified by min and max. More...
|
|
float | Norm (float a) |
| Returns the normalized value (0 .. 1) More...
|
|
void | Swap (int &a, int &b) |
| Swaps two integers. More...
|
|
void | Swap (float &a, float &b) |
| Swaps two real numbers. More...
|
|
float | Mod (float a, float m) |
| Returns the modulo of a floating point number. More...
|
|
float | Rand () |
| Returns a random value between 0 and 1. More...
|
|
bool | IsPowerOfTwo (unsigned int x) |
| Returns whether x is an even power of 2. More...
|
|
int | NextPowerOfTwo (int x) |
| Returns the next nearest power of two to x. More...
|
|
float | NormAngle (float angle) |
| Returns a normalized angle, that is in other words between 0 and 2 * PI. More...
|
|
bool | TestAngle (float angle, float min, float max) |
| Test if a angle is between two terminals. More...
|
|
float | PropAngle (float a, float b, float p) |
| Calculates a value (radians) proportional between a and b (degrees) More...
|
|
float | Direction (float a, float g) |
| Calculates the angle to rotate the angle a to the angle g. More...
|
|
float | Neutral (float value, float dead) |
| Managing the dead zone of a joystick. More...
|
|
float | Smooth (float actual, float hope, float time) |
| Gently advances a desired value from its current value. More...
|
|
float | Bounce (float progress, float middle=0.3f, float bounce=0.4f) |
| Bounces any movement. More...
|
|
float | MidPoint (const Math::Point &a, const Math::Point &b, float px) |
| Returns py up on the line a - b. More...
|
|
bool | IsInsideTriangle (Math::Point a, Math::Point b, Math::Point c, Math::Point p) |
| Tests whether the point p is inside the triangle (a,b,c) More...
|
|
Math::Point | RotatePoint (const Math::Point ¢er, float angle, const Math::Point &p) |
| Rotates a point around a center. More...
|
|
Math::Point | RotatePoint (float angle, const Math::Point &p) |
| Rotates a point around the origin (0,0) More...
|
|
Math::Point | RotatePoint (float angle, float dist) |
| Rotates a vector (dist, 0) More...
|
|
void | RotatePoint (float cx, float cy, float angle, float &px, float &py) |
| Rotates a point around a center on 2D plane. More...
|
|
void | RotatePoint (const Math::Vector ¢er, float angleH, float angleV, Math::Vector &p) |
| Rotates a point around a center in space. More...
|
|
void | RotatePoint2 (const Math::Vector center, float angleH, float angleV, Math::Vector &p) |
| Rotates a point around a center in space. More...
|
|
float | RotateAngle (float x, float y) |
| Returns the angle between point (x,y) and (0,0) More...
|
|
float | RotateAngle (const Math::Point ¢er, const Math::Point &p1, const Math::Point &p2) |
| Calculates the angle between two points and a center. More...
|
|
void | LoadViewMatrix (Math::Matrix &mat, const Math::Vector &from, const Math::Vector &at, const Math::Vector &worldUp) |
| Loads view matrix from the given vectors. More...
|
|
void | LoadProjectionMatrix (Math::Matrix &mat, float fov=Math::PI/2.0f, float aspect=1.0f, float nearPlane=1.0f, float farPlane=1000.0f) |
| Loads a perspective projection matrix. More...
|
|
void | LoadOrthoProjectionMatrix (Math::Matrix &mat, float left, float right, float bottom, float top, float zNear=-1.0f, float zFar=1.0f) |
| Loads an othogonal projection matrix. More...
|
|
void | LoadTranslationMatrix (Math::Matrix &mat, const Math::Vector &trans) |
| Loads a translation matrix from given vector. More...
|
|
void | LoadScaleMatrix (Math::Matrix &mat, const Math::Vector &scale) |
| Loads a scaling matrix fom given vector. More...
|
|
void | LoadRotationXMatrix (Math::Matrix &mat, float angle) |
| Loads a rotation matrix along the X axis. More...
|
|
void | LoadRotationYMatrix (Math::Matrix &mat, float angle) |
| Loads a rotation matrix along the Y axis. More...
|
|
void | LoadRotationZMatrix (Math::Matrix &mat, float angle) |
| Loads a rotation matrix along the Z axis. More...
|
|
void | LoadRotationMatrix (Math::Matrix &mat, const Math::Vector &dir, float angle) |
| Loads a rotation matrix along the given axis. More...
|
|
void | LoadRotationXZYMatrix (Math::Matrix &mat, const Math::Vector &angles) |
| Calculates the matrix to make three rotations in the order X, Z and Y. More...
|
|
void | LoadRotationZXYMatrix (Math::Matrix &mat, const Math::Vector &angles) |
| Calculates the matrix to make three rotations in the order Z, X and Y. More...
|
|
float | DistanceProjected (const Math::Vector &a, const Math::Vector &b) |
| Returns the distance between projections on XZ plane of two vectors. More...
|
|
Math::Vector | NormalToPlane (const Math::Vector &p1, const Math::Vector &p2, const Math::Vector &p3) |
| Returns the normal vector to a plane. More...
|
|
Math::Vector | SegmentPoint (const Math::Vector &p1, const Math::Vector &p2, float dist) |
| Returns a point on the line p1 - p2, in dist distance from p1. More...
|
|
float | DistanceToPlane (const Math::Vector &a, const Math::Vector &b, const Math::Vector &c, const Math::Vector &p) |
| Returns the distance between given point and a plane. More...
|
|
bool | IsSamePlane (const Math::Vector(&plane1)[3], const Math::Vector(&plane2)[3]) |
| Checks if two planes defined by three points are the same. More...
|
|
bool | Intersect (const Math::Vector &a, const Math::Vector &b, const Math::Vector &c, const Math::Vector &d, const Math::Vector &e, Math::Vector &i) |
| Calculates the intersection "i" right "of" the plane "abc" (TODO: ?) More...
|
|
bool | IntersectY (const Math::Vector &a, const Math::Vector &b, const Math::Vector &c, Math::Vector &p) |
| Calculates the intersection of the straight line passing through p (x, z) More...
|
|
Math::Vector | LookatPoint (const Math::Vector &eye, float angleH, float angleV, float length) |
| Calculates the end point. More...
|
|
Math::Vector | Transform (const Math::Matrix &m, const Math::Vector &p) |
| Transforms the point p by matrix m. More...
|
|
Math::Vector | Projection (const Math::Vector &a, const Math::Vector &b, const Math::Vector &p) |
| Calculates the projection of the point p on a straight line a to b. More...
|
|
Math::Vector | RotateView (Math::Vector center, float angleH, float angleV, float dist) |
| Calculates point of view to look at a center two angles and a distance. More...
|
|
uint16_t | FloatToHalf (float value) |
| Converts float to half-float. More...
|
|
float | HaltToFloat (uint16_t value) |
| Converts half-float to float. More...
|
|
bool | MatricesEqual (const Matrix &m1, const Matrix &m2, float tolerance=TOLERANCE) |
| Checks if two matrices are equal within given tolerance. More...
|
|
Math::Matrix | Transpose (const Math::Matrix &m) |
| Convenience function for getting transposed matrix. More...
|
|
Math::Matrix | MultiplyMatrices (const Math::Matrix &left, const Math::Matrix &right) |
| Convenience function for multiplying a matrix. More...
|
|
Math::Vector | MatrixVectorMultiply (const Math::Matrix &m, const Math::Vector &v, bool wDivide=false) |
| Calculates the result of multiplying m * v. More...
|
|
bool | PointsEqual (const Point &a, const Point &b, float tolerance=TOLERANCE) |
| Checks if two vectors are equal within given tolerance. More...
|
|
void | Swap (Point &a, Point &b) |
| Permutes two points. More...
|
|
float | Distance (const Point &a, const Point &b) |
| Returns the distance between two points. More...
|
|
float | DistanceToSphere (const Vector &point, const Sphere &sphere) |
| Compute distance between given point and sphere. More...
|
|
float | DistanceBetweenSpheres (const Sphere &sphere1, const Sphere &sphere2) |
|
Sphere | BoundingSphereForBox (Vector mins, Vector maxs) |
|
bool | VectorsEqual (const Math::Vector &a, const Math::Vector &b, float tolerance=TOLERANCE) |
| Checks if two vectors are equal within given tolerance. More...
|
|
Vector | Normalize (const Math::Vector &v) |
| Convenience function for getting normalized vector. More...
|
|
float | DotProduct (const Math::Vector &left, const Math::Vector &right) |
| Convenience function for calculating dot product. More...
|
|
Vector | CrossProduct (const Math::Vector &left, const Math::Vector &right) |
| Convenience function for calculating cross product. More...
|
|
float | Angle (const Math::Vector &a, const Math::Vector &b) |
| Convenience function for calculating angle (in radians) between two vectors. More...
|
|
float | Distance (const Math::Vector &a, const Math::Vector &b) |
| Returns the distance between the ends of two vectors. More...
|
|
float | DistanceSquared (const Math::Vector &a, const Math::Vector &b) |
| Returns the squared distance between the ends of two vectors. More...
|
|
Vector | Clamp (const Vector &vec, const Vector &min, const Vector &max) |
| Clamps the vector vec to range between min and max. More...
|
|
Namespace for (new) math code.
This namespace was created to avoid clashing with old code, but now it still serves, defining a border between math and non-math-related code.