2008-02-09 13:43:23 +01:00
|
|
|
#ifndef __QUATERNION_H
|
|
|
|
#define __QUATERNION_H
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <cmath>
|
|
|
|
#include <SDL_opengl.h>
|
2008-06-17 02:46:39 +02:00
|
|
|
// #include "rotationsmatrix.h"
|
|
|
|
#include "punkt3d.h"
|
2008-02-09 13:43:23 +01:00
|
|
|
#include "emath.h"
|
|
|
|
|
|
|
|
class Quaternion {
|
|
|
|
private:
|
2008-06-17 02:46:39 +02:00
|
|
|
float x, y, z, w;
|
|
|
|
|
2008-02-09 13:43:23 +01:00
|
|
|
public:
|
|
|
|
Quaternion();
|
2008-06-17 02:46:39 +02:00
|
|
|
Quaternion(float _x, float _y, float _z, float _w);
|
|
|
|
Quaternion(float deg, Punkt3D p);
|
|
|
|
Quaternion(float _x, float _y, float _z);
|
2008-02-09 13:43:23 +01:00
|
|
|
|
2008-06-17 02:46:39 +02:00
|
|
|
void set(float rotx, float roty, float rotz);
|
|
|
|
void set(float deg, Punkt3D axis);
|
|
|
|
void normalize();
|
|
|
|
Quaternion getConjugate();
|
|
|
|
// Rotationsmatrix getRotMat();
|
|
|
|
Punkt3D rotP3D(const Punkt3D &p);
|
2008-02-09 13:43:23 +01:00
|
|
|
|
|
|
|
Quaternion operator*(const Quaternion&);
|
|
|
|
};
|
|
|
|
|
2008-06-17 02:46:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// class Quaternion {
|
|
|
|
// private:
|
|
|
|
// float w;
|
|
|
|
// float x,y,z;
|
|
|
|
// public:
|
|
|
|
// Quaternion();
|
|
|
|
// void createFromRotation(float, float, float, float);
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// void createGlMatrix(GLfloat*);
|
|
|
|
// Punkt3D getDirectionVector();
|
|
|
|
// Punkt3D getDirectionVector(GLfloat*);
|
|
|
|
//
|
|
|
|
// Quaternion operator*(const Quaternion&);
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// };
|
|
|
|
//
|
|
|
|
// void glMultMatrixf(Quaternion);
|
2008-02-09 13:43:23 +01:00
|
|
|
|
|
|
|
#endif
|