Maratis Engine
Classes | Defines | Functions

MCore/Includes/MMaths.h File Reference

#include <math.h>
#include "MVector2.h"
#include "MVector3.h"
#include "MVector4.h"
#include "MColor.h"
#include "MMatrix4x4.h"
#include "MQuaternion.h"

Classes

struct  MRange

Defines

#define M_PI   3.14159265358979323846
#define DEG_TO_RAD   ((M_PI * 2) / 360.0f)
#define RAD_TO_DEG   (1.0f / DEG_TO_RAD)
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
#define CLAMP(x, low, high)   (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#define ABS(a)   (((a) < 0) ? -(a) : (a))
#define isPowerOfTwo(x)   (((x&(x - 1)) == 0) && (x != 0))

Functions

M_CORE_EXPORT unsigned int getNextPowerOfTwo (unsigned int x)
M_CORE_EXPORT void sortFloatList (int indexList[], float floatList[], int start, int end)
M_CORE_EXPORT void sortFloatList (float floatList[], int start, int end)
M_CORE_EXPORT bool isBoxToBoxCollision (const MVector3 &minA, const MVector3 &maxA, const MVector3 &minB, const MVector3 &maxB)
M_CORE_EXPORT bool isBoxToBox2dCollision (const MVector2 &minA, const MVector2 &maxA, const MVector2 &minB, const MVector2 &maxB)
M_CORE_EXPORT bool isPointInBox (const MVector3 &point, const MVector3 &min, const MVector3 &max)
M_CORE_EXPORT bool isPointInBox2d (const MVector2 &point, const MVector2 &min, const MVector2 &max)
M_CORE_EXPORT bool isEdgeToBoxCollision (const MVector3 &origin, const MVector3 &dest, const MVector3 &min, const MVector3 &max)
M_CORE_EXPORT bool isEdgeToEdge2dIntersection (const MVector2 &A, const MVector2 &B, const MVector2 &C, const MVector2 &D, MVector2 *I)
M_CORE_EXPORT bool isPointInTriangle (const MVector3 &point, const MVector3 &a, const MVector3 &b, const MVector3 &c, const MVector3 &normal)
M_CORE_EXPORT bool isLineCircleIntersection (const MVector2 &origin, const MVector2 &dest, const MVector2 &circleCenter, float circleRadius)
M_CORE_EXPORT bool isRaySphereIntersection (const MVector3 &origin, const MVector3 &direction, const MVector3 &sphereCenter, float sphereRadius, MVector3 *point)
M_CORE_EXPORT bool isRayPlaneIntersection (const MVector3 &origin, const MVector3 &direction, const MVector3 &planePoint, const MVector3 &planeNormal, MVector3 *point)
M_CORE_EXPORT bool isEdgePlaneIntersection (const MVector3 &origin, const MVector3 &dest, const MVector3 &planePoint, const MVector3 &normal, MVector3 *point)
M_CORE_EXPORT bool isEdgeTriangleIntersection (const MVector3 &origin, const MVector3 &dest, const MVector3 &a, const MVector3 &b, const MVector3 &c, const MVector3 &normal, MVector3 *point)
M_CORE_EXPORT MVector3 getTriangleNormal (const MVector3 &a, const MVector3 &b, const MVector3 &c)

Define Documentation

#define ABS (   a)    (((a) < 0) ? -(a) : (a))
#define CLAMP (   x,
  low,
  high 
)    (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#define DEG_TO_RAD   ((M_PI * 2) / 360.0f)
#define isPowerOfTwo (   x)    (((x&(x - 1)) == 0) && (x != 0))
#define M_PI   3.14159265358979323846
#define MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))
#define MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))
#define RAD_TO_DEG   (1.0f / DEG_TO_RAD)

Function Documentation

M_CORE_EXPORT unsigned int getNextPowerOfTwo ( unsigned int  x)
M_CORE_EXPORT MVector3 getTriangleNormal ( const MVector3 a,
const MVector3 b,
const MVector3 c 
)
M_CORE_EXPORT bool isBoxToBox2dCollision ( const MVector2 minA,
const MVector2 maxA,
const MVector2 minB,
const MVector2 maxB 
)
M_CORE_EXPORT bool isBoxToBoxCollision ( const MVector3 minA,
const MVector3 maxA,
const MVector3 minB,
const MVector3 maxB 
)
M_CORE_EXPORT bool isEdgePlaneIntersection ( const MVector3 origin,
const MVector3 dest,
const MVector3 planePoint,
const MVector3 normal,
MVector3 point 
)
M_CORE_EXPORT bool isEdgeToBoxCollision ( const MVector3 origin,
const MVector3 dest,
const MVector3 min,
const MVector3 max 
)
M_CORE_EXPORT bool isEdgeToEdge2dIntersection ( const MVector2 A,
const MVector2 B,
const MVector2 C,
const MVector2 D,
MVector2 I 
)
M_CORE_EXPORT bool isEdgeTriangleIntersection ( const MVector3 origin,
const MVector3 dest,
const MVector3 a,
const MVector3 b,
const MVector3 c,
const MVector3 normal,
MVector3 point 
)
M_CORE_EXPORT bool isLineCircleIntersection ( const MVector2 origin,
const MVector2 dest,
const MVector2 circleCenter,
float  circleRadius 
)
M_CORE_EXPORT bool isPointInBox ( const MVector3 point,
const MVector3 min,
const MVector3 max 
)
M_CORE_EXPORT bool isPointInBox2d ( const MVector2 point,
const MVector2 min,
const MVector2 max 
)
M_CORE_EXPORT bool isPointInTriangle ( const MVector3 point,
const MVector3 a,
const MVector3 b,
const MVector3 c,
const MVector3 normal 
)
M_CORE_EXPORT bool isRayPlaneIntersection ( const MVector3 origin,
const MVector3 direction,
const MVector3 planePoint,
const MVector3 planeNormal,
MVector3 point 
)
M_CORE_EXPORT bool isRaySphereIntersection ( const MVector3 origin,
const MVector3 direction,
const MVector3 sphereCenter,
float  sphereRadius,
MVector3 point 
)
M_CORE_EXPORT void sortFloatList ( float  floatList[],
int  start,
int  end 
)
M_CORE_EXPORT void sortFloatList ( int  indexList[],
float  floatList[],
int  start,
int  end 
)
 All Classes Files Functions Variables Enumerations Enumerator Friends Defines