This is old C++ code originally intended to be a playground for 3D math.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

118 lines
4.1 KiB

/**
* \file polyeder.h
*
* \brief Ein Polyeder (eine gruppe von Polygonen)
*
* Ein Polyeder organisier die Vertexliste und Anordnung von Polygonen
* die zu einem Körper gehören.
*
* \author Georg Steffers <georg@steffers.org> [gs]
*
* \date 19.12.2003
*
* \version ..2002 [gs]: erste Implementation
* \version 19.12.2003 [gs]: <ul><li>
* Vergleichsoperator hinzugef&uuml;gt
* </li><li>
* polyeder_movable von gra_app nach hier hin
* &uuml;bertragen
* </li><li>
* Member world_coordinate rausgesmissen, vielleicht
* bau ich den noch mal wieder ein, aber er darf nie
* implizit benutzt werden, ich denke es ist besser
* Alle Positionen und Ausrichtungen von Objekten in
* einer Weltklasse zu speichern.
* </li></ul>
*/
/*
* Copyright (C)2003 Georg Steffers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __polyeder_h__
#define __polyeder_h__
#include "../helper/container.h"
#include "../math/Mmn.h"
#include "polygon.h"
#include "vertex.h"
#include "movable.h"
class polyeder : public container<polygon> {
public:
vertex_list vl;
public:
polyeder() : container<polygon>() {}
polyeder(const polygon&, const vertex_list&);
polyeder(const polygon*, unsigned, const vertex_list&);
polyeder(const polyeder&);
~polyeder() {}
const polyeder& operator=(const polyeder&);
const polygon& operator[](unsigned index) const {
return content[index];
}
polygon& operator[](unsigned index) {
return content[index];
}
virtual void transform(const Mmn<double>&, int=0);
virtual void transform_normals(const Mmn<double>&, int=0);
void trans_poly(unsigned, const Mmn<double>&, int=0);
virtual void reset(void);
/**
* \param lcx (lens coverage(x)) = Sichtfeld(x)
* \param sw (screen width) = Breite des Projektionsfensters
* \param sh (screen height) = Hoehe des Projektionsfensters
* \param ph_ar (physical aspect ratio) = Seitenverhaeltnis des
* Anzeigegeraets
* \param sy (scale y) = Wenn Anzeigegeraet und Projektionfenster die
* selbe Groesse haben 1, ansonsten der Wert um y proportional
* zu x zu projezieren.
* \param p Transformationsstufe
*/
void project_2d(double lcx, double sw, double sh,
double ph_ar, double sy=1, int p=0);
};
class polyeder_movable : public polyeder, public movable {
public:
polyeder_movable() : polyeder(), movable() {}
polyeder_movable(const polygon& p, const vertex_list& vl) :
polyeder(p, vl) {}
polyeder_movable(const polygon* p, unsigned c, const vertex_list& vl) :
polyeder(p, c, vl) {}
polyeder_movable(const polyeder& p) :
polyeder(p) {}
void transform(int transstage) {
polyeder::transform(t_mat, transstage);
movable::transform(transstage);
}
void transform_normals(int p) {
polyeder::transform_normals(t_mat, p);
}
void reset(void) {
polyeder::reset();
movable::reset();
}
};
#endif