sources:
attribute.cpp (1.1k)
attribute.h (1.5k)
cgapplication.cpp (4.1k)
cgapplication.h (4.8k)
cgrobot.cpp (7.9k)
cgrobot.h (716 bytes)
node.cpp (2.4k)
node.h (2.3k)
shape.cpp (3.2k)
shape.h (966 bytes)
transformation.cpp (2.9k)
transformation.h (2.4k)
vector.cpp (1.4k)
vector.h (5.3k)


website:
more info here


screenshot:
studies/grafik/Computergrafik-Code8/transformation.h
download file

  1 // Computergraphik I
  2 // Prof. Dr. Juergen Doellner
  3 // Sommersemester 2001
  4 //
  5 // Rahmenprogramm fuer Aufgabenzettel 8
  6
  7 #ifndef TRANSFORMATION_H
  8 #define TRANSFORMATION_H
  9
 10 #include "attribute.h"
 11 #include "Vector.h"
 12
 13 //
 14 // Transformation
 15 //
 16
 17 class Transformation : public Attribute {
 18 public:
 19     // Transformationen sind spezielle Attribute.
 20
 21     virtual void set() = 0;
 22     virtual void unset() = 0;
 23 };
 24
 25 //
 26 // Camera
 27 //
 28
 29 class Camera : public Transformation {
 30 public:
 31     Camera(const Vector& from = Vector(0,0,3),
 32            const Vector& to   = Vector(0,0,0),
 33            const Vector& up   = Vector(0,1,0))
;
 34     // erzeugt eine Kamera
 35
 36     virtual void set();
 37     virtual void unset();
 38
 39     // Zugriff auf Kameraeigenschaften
 40     Vector getFrom() const;
 41     Vector getTo  () const;
 42     Vector getUp  () const;
 43     void   setFrom(const Vector& from);
 44     void   setTo  (const Vector& to);
 45     void   setUp  (const Vector& up);
 46
 47 private:
 48     Vector from_, to_, up_;
 49 };
 50
 51 //
 52 // Translation
 53 //
 54
 55 class Translation : public Transformation {
 56 public:
 57     Translation(const Vector& trans = Vector(0, 0, 0));
 58     // Verschiebt das Koordinatensystem um den Vektor trans.
 59
 60     // Mit diesen Methoden kann man die Translation
 61     // auslesen und setzen.
 62     const Vector& getTranslation() const;
 63     void setTranslation(const Vector& trans);
 64
 65     virtual void set();
 66     virtual void unset();
 67
 68 private:
 69     Vector trans_;
 70 };
 71
 72 //
 73 // Scaling
 74 //
 75
 76 class Scaling : public Transformation {
 77 public:
 78     Scaling(const Vector& scale = Vector(1, 1, 1));
 79     // Skaliert das Koordinatensystem um die in scale
 80     // angegebenen Faktoren.
 81
 82     // Mit diesen Methoden kann man die Skalierung
 83     // auslesen und setzen.
 84     const Vector& getScaling() const;
 85     void setScaling(const Vector& scale);
 86
 87     virtual void set();
 88     virtual void unset();
 89
 90 private:
 91     Vector scale_;
 92 };
 93
 94 //
 95 // Rotation
 96 //
 97
 98 class Rotation : public Transformation {
 99 public:
100     Rotation(double angle, const Vector& axis = Vector(0, 0, 1));
101     // Rotiert das Koordinatensystem um angle Grad um die
102     // angegebene Rotationsachse.
103
104     // Mit diesen Methoden kann man den Rotationswinkel
105     // auslesen und setzen.
106     double getAngle() const;
107     void setAngle(double angle);
108
109     // Mit diesen Methoden kann man die Rotationsachse
110     // auslesen und setzen.
111     const Vector& getAxis() const;
112     void setAxis(const Vector& axis);
113
114     virtual void set();
115     virtual void unset();
116
117 private:
118     double angle_;
119     Vector axis_;
120 };
121
122 #endif // TRANSFORMATION_H
123
124