diff options
Diffstat (limited to 'src/Quaternions.h')
-rw-r--r-- | src/Quaternions.h | 48 |
1 files changed, 2 insertions, 46 deletions
diff --git a/src/Quaternions.h b/src/Quaternions.h index 1c4fc95..c41dfe8 100644 --- a/src/Quaternions.h +++ b/src/Quaternions.h @@ -1,30 +1,7 @@ - #ifndef _QUATERNIONS_H_ #define _QUATERNIONS_H_ -#include <GL/gl.h> -#include "PhysicsMath.h" - -/**> Quaternion Structures <**/ -#define PI 3.14159265355555897932384626 -#define RADIANS 0 -#define DEGREES 1 -#define deg2rad .0174532925 - using namespace std; -typedef float Matrix_t [4][4]; -struct euler -{ - float x, y, z; -}; -struct angle_axis -{ - float x, y, z, angle; -}; -struct quaternion -{ - float x, y, z, w; -}; class XYZ{ public: @@ -42,42 +19,21 @@ class XYZ{ void operator*=(XYZ add); void operator/=(float add); void operator=(float add); - void vec(Vector add); bool operator==(XYZ add); }; -/*********************> Quaternion Function definition <********/ -quaternion To_Quat(int Degree_Flag, euler Euler); -quaternion To_Quat(angle_axis Ang_Ax); -quaternion To_Quat(Matrix_t m); -angle_axis Quat_2_AA(quaternion Quat); -void Quat_2_Matrix(quaternion Quat, Matrix_t m); -quaternion Normalize(quaternion Quat); -quaternion Quat_Mult(quaternion q1, quaternion q2); -quaternion QNormalize(quaternion Quat); -XYZ Quat2Vector(quaternion Quat); - void CrossProduct(XYZ P, XYZ Q, XYZ *V); void Normalise(XYZ *vectory); -float normaldotproduct(XYZ point1, XYZ point2); bool PointInTriangle(XYZ *p, XYZ normal, XYZ *p1, XYZ *p2, XYZ *p3); -bool LineFacet(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc,XYZ *p); -float LineFacetd(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc,XYZ *p); float LineFacetd(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc,XYZ n, XYZ *p); float LineFacetd(XYZ *p1,XYZ *p2,XYZ *pa,XYZ *pb,XYZ *pc,XYZ *n, XYZ *p); -bool PointInTriangle(Vector *p, Vector normal, float p11, float p12, float p13, float p21, float p22, float p23, float p31, float p32, float p33); -bool LineFacet(Vector p1,Vector p2,Vector pa,Vector pb,Vector pc,Vector *p); void ReflectVector(XYZ *vel, XYZ *n); XYZ DoRotation(XYZ thePoint, float xang, float yang, float zang); -XYZ DoRotationRadian(XYZ thePoint, float xang, float yang, float zang); float findDistance(XYZ point1, XYZ point2); -float findLength(XYZ point1); float findLengthfast(XYZ point1); float findDistancefast(XYZ point1, XYZ point2); float dotproduct(XYZ point1, XYZ point2); -bool sphere_line_intersection ( - float x1, float y1 , float z1, - float x2, float y2 , float z2, - float x3, float y3 , float z3, float r ); +bool sphere_line_intersection(float x1, float y1, float z1, + float x2, float y2, float z2, float x3, float y3, float z3, float r); #endif |