2015-07-26 21:39:49 +00:00
|
|
|
#ifndef MATH
|
|
|
|
#define MATH
|
|
|
|
|
|
|
|
#include "CAABox.h"
|
|
|
|
#include "CRay.h"
|
2015-08-20 01:01:58 +00:00
|
|
|
#include "CPlane.h"
|
2015-07-26 21:39:49 +00:00
|
|
|
#include "CVector3f.h"
|
|
|
|
#include "SRayIntersection.h"
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
namespace Math
|
|
|
|
{
|
|
|
|
|
2015-08-20 01:01:58 +00:00
|
|
|
float Abs(float v);
|
|
|
|
|
2015-07-26 21:39:49 +00:00
|
|
|
float Pow(float Base, float Exponent);
|
|
|
|
|
|
|
|
float Distance(const CVector3f& A, const CVector3f& B);
|
|
|
|
|
2015-08-21 02:18:13 +00:00
|
|
|
float DegreesToRadians(float deg);
|
|
|
|
|
|
|
|
float RadiansToDegrees(float rad);
|
|
|
|
|
2015-08-20 01:01:58 +00:00
|
|
|
std::pair<bool,float> RayPlaneIntersecton(const CRay& ray, const CPlane& plane);
|
|
|
|
|
2015-07-26 21:39:49 +00:00
|
|
|
std::pair<bool,float> RayBoxIntersection(const CRay& Ray, const CAABox& Box);
|
|
|
|
|
2015-08-17 18:10:42 +00:00
|
|
|
std::pair<bool,float> RayLineIntersection(const CRay& ray, const CVector3f& pointA,
|
|
|
|
const CVector3f& pointB, float threshold = 0.02f);
|
|
|
|
|
2015-07-26 21:39:49 +00:00
|
|
|
std::pair<bool,float> RayTriangleIntersection(const CRay& Ray, const CVector3f& PointA,
|
|
|
|
const CVector3f& PointB, const CVector3f& PointC,
|
|
|
|
bool AllowBackfaces = false);
|
2015-08-21 02:18:13 +00:00
|
|
|
|
|
|
|
// Constants
|
|
|
|
static const float skPi = 3.14159265358979323846f;
|
|
|
|
static const float skHalfPi = skPi / 2.f;
|
2015-07-26 21:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // MATH
|
|
|
|
|