libsegl/punkt3d.h

103 lines
3.0 KiB
C
Raw Normal View History

2009-01-21 01:00:31 +01:00
/* libsegl - Sebas Extended GL Library
* Collection of Opengl/3D-Math helpers
*
* Copyright (c) 2008 by Sebastian Lohff, seba@seba-geek.de
* http://www.seba-geek.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __PUNKT3D_h
#define __PUNKT3D_h
#include <iostream>
#include <cmath>
#include "emath.h"
namespace segl {
class Punkt3D {
public:
Punkt3D();
Punkt3D(float, float, float);
~Punkt3D() { };
float x, y, z;
void set(float, float, float);
2008-09-19 17:34:01 +02:00
float abs() const;
Punkt3D kreuzprodukt(const Punkt3D&) const;
void normalize();
2008-09-19 17:34:01 +02:00
Punkt3D getNormalized() const;
bool isNormalized() const;
float calcAngle(Punkt3D b) const;
Punkt3D getOrtographic() const;
Punkt3D getOrtographic2() const;
2008-09-19 17:34:01 +02:00
void print(std::string="") const;
// Operatoren
2008-09-19 17:34:01 +02:00
Punkt3D operator+(const Punkt3D&) const;
Punkt3D operator-(const Punkt3D&) const;
Punkt3D& operator+=(const Punkt3D&);
Punkt3D& operator-=(const Punkt3D&);
2008-09-19 17:34:01 +02:00
Punkt3D operator+(const float&) const;
Punkt3D operator-(const float&) const;
Punkt3D operator*(const float&) const;
Punkt3D operator/(const float&) const;
Punkt3D& operator+=(const float&);
Punkt3D& operator-=(const float&);
Punkt3D& operator*=(const float&);
Punkt3D& operator/=(const float&);
2008-09-19 17:34:01 +02:00
float operator*(const Punkt3D&) const;
2008-09-19 17:34:01 +02:00
Punkt3D operator-() const;
2008-09-19 17:34:01 +02:00
bool operator==(const Punkt3D&) const;
bool operator!=(const Punkt3D&) const;
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);
};
} // namespace segl
2008-09-19 17:34:01 +02:00
float abs(const segl::Punkt3D&);
// OpenGL-Functions for Punkt3D
2009-01-21 01:00:31 +01:00
2008-09-19 17:34:01 +02:00
void glVertex3f(const segl::Punkt3D&);
void glTranslatef(const segl::Punkt3D&);
void glNormal3f(const segl::Punkt3D&);
2008-09-19 17:34:01 +02:00
void glRotatef(const float&, const segl::Punkt3D&);
// Funktionen mit richtgen bezeichnern
2008-09-19 17:34:01 +02:00
void glVertexP3D(const segl::Punkt3D&);
void glTranslateP3D(const segl::Punkt3D&);
void glNormalP3D(const segl::Punkt3D&);
2008-09-19 17:34:01 +02:00
void glRotateP3D(const float&, const segl::Punkt3D&);
void gluLookAt(const segl::Punkt3D &pos, const segl::Punkt3D &viewport, const segl::Punkt3D &normal);
2009-01-21 01:00:31 +01:00
#endif