77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
#ifndef __PUNKT3D_h
|
|
#define __PUNKT3D_h
|
|
|
|
#include <iostream>
|
|
#include <cmath>
|
|
#include "emath.h"
|
|
|
|
class Punkt3D {
|
|
public:
|
|
Punkt3D();
|
|
Punkt3D(float, float, float);
|
|
~Punkt3D() { };
|
|
|
|
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();
|
|
Punkt3D getOrtographic2();
|
|
|
|
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&);
|
|
friend std::ostream &operator<<(std::ostream &ostr, const Punkt3D &r);
|
|
};
|
|
|
|
float abs(Punkt3D);
|
|
|
|
// OpenGL-Functions for Punkt3D
|
|
|
|
void glVertex3f(Punkt3D);
|
|
void glTranslatef(Punkt3D);
|
|
void glNormal3f(Punkt3D);
|
|
|
|
void glRotatef(float, Punkt3D);
|
|
|
|
// Funktionen mit richtgen bezeichnern
|
|
void glVertexP3D(Punkt3D);
|
|
void glTranslateP3D(Punkt3D);
|
|
void glNormalP3D(Punkt3D);
|
|
|
|
void glRotateP3D(float, Punkt3D);
|
|
void gluLookAt(Punkt3D pos, Punkt3D viewport, Punkt3D normal);
|
|
|
|
#endif
|