123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- /* 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);
- float abs() const;
- Punkt3D kreuzprodukt(const Punkt3D&) const;
- void normalize();
- Punkt3D getNormalized() const;
- bool isNormalized() const;
- float calcAngle(Punkt3D b) const;
- Punkt3D getOrtographic() const;
- Punkt3D getOrtographic2() const;
-
- void print(std::string="") const;
-
-
- // Operatoren
- Punkt3D operator+(const Punkt3D&) const;
- Punkt3D operator-(const Punkt3D&) const;
- Punkt3D& operator+=(const Punkt3D&);
- Punkt3D& operator-=(const Punkt3D&);
-
- 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&);
-
- float operator*(const Punkt3D&) const;
-
- Punkt3D operator-() const;
-
- 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
-
- float abs(const segl::Punkt3D&);
-
- // OpenGL-Functions for Punkt3D
-
- void glVertex3f(const segl::Punkt3D&);
- void glTranslatef(const segl::Punkt3D&);
- void glNormal3f(const segl::Punkt3D&);
-
- void glRotatef(const float&, const segl::Punkt3D&);
-
- // Funktionen mit richtgen bezeichnern
- void glVertexP3D(const segl::Punkt3D&);
- void glTranslateP3D(const segl::Punkt3D&);
- void glNormalP3D(const segl::Punkt3D&);
-
- void glRotateP3D(const float&, const segl::Punkt3D&);
- void gluLookAt(const segl::Punkt3D &pos, const segl::Punkt3D &viewport, const segl::Punkt3D &normal);
-
- #endif
|