75 lines
1.5 KiB
C++
75 lines
1.5 KiB
C++
#ifndef __EMATH_H
|
|
#define __EMATH_H
|
|
|
|
#include <iostream>
|
|
#include <cmath>
|
|
#include <SDL_opengl.h>
|
|
|
|
class Punkt3D {
|
|
public:
|
|
Punkt3D();
|
|
Punkt3D(float, float, float);
|
|
|
|
float x, y, z;
|
|
|
|
void set(float, float, float);
|
|
float abs();
|
|
Punkt3D kreuzprodukt(const Punkt3D&);
|
|
void normalize();
|
|
Punkt3D getNormalized();
|
|
bool isNormalized();
|
|
float calcAngle(Punkt3D);
|
|
Punkt3D getOrtographic();
|
|
|
|
void print(std::string="");
|
|
|
|
|
|
// Operatoren
|
|
Punkt3D operator+(const Punkt3D&);
|
|
Punkt3D operator-(const Punkt3D&);
|
|
Punkt3D& operator+=(const Punkt3D&);
|
|
Punkt3D& operator-=(const Punkt3D&);
|
|
|
|
Punkt3D operator+(const float&);
|
|
Punkt3D operator-(const float&);
|
|
Punkt3D operator*(const float&);
|
|
Punkt3D operator/(const float&);
|
|
Punkt3D& operator+=(const float&);
|
|
Punkt3D& operator-=(const float&);
|
|
Punkt3D& operator*=(const float&);
|
|
Punkt3D& operator/=(const float&);
|
|
|
|
float operator*(const Punkt3D&);
|
|
|
|
Punkt3D operator-();
|
|
|
|
bool operator==(const Punkt3D&);
|
|
bool operator!=(const Punkt3D&);
|
|
|
|
friend Punkt3D operator+(const float&, const Punkt3D&);
|
|
friend Punkt3D operator-(const float&, const Punkt3D&);
|
|
friend Punkt3D operator*(const float&, const Punkt3D&);
|
|
friend Punkt3D operator/(const float&, const Punkt3D&);
|
|
};
|
|
|
|
float abs(Punkt3D);
|
|
|
|
// OpenGL-Funktionen für Punkt3D
|
|
|
|
void glVertex3f(Punkt3D);
|
|
void glTranslatef(Punkt3D);
|
|
void glNormal3f(Punkt3D);
|
|
|
|
void glRotatef(float, Punkt3D);
|
|
|
|
float deg2rad(float deg);
|
|
float rad2deg(float rad);
|
|
|
|
|
|
|
|
// *grml* scheiss cmath-sinus
|
|
float ssin(float);
|
|
float scos(float);
|
|
|
|
#endif
|