25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

103 satır
3.0 KiB

/* 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