// Computergraphik I // Prof. Dr. Juergen Doellner // Sommersemester 2001 // // Rahmenprogramm fuer Aufgabenzettel 8 #ifndef TRANSFORMATION_H #define TRANSFORMATION_H #include "attribute.h" #include "Vector.h" // // Transformation // class Transformation : public Attribute { public: // Transformationen sind spezielle Attribute. virtual void set() = 0; virtual void unset() = 0; }; // // Camera // class Camera : public Transformation { public: Camera(const Vector& from = Vector(0,0,3), const Vector& to = Vector(0,0,0), const Vector& up = Vector(0,1,0)); // erzeugt eine Kamera virtual void set(); virtual void unset(); // Zugriff auf Kameraeigenschaften Vector getFrom() const; Vector getTo () const; Vector getUp () const; void setFrom(const Vector& from); void setTo (const Vector& to); void setUp (const Vector& up); private: Vector from_, to_, up_; }; // // Translation // class Translation : public Transformation { public: Translation(const Vector& trans = Vector(0, 0, 0)); // Verschiebt das Koordinatensystem um den Vektor trans. // Mit diesen Methoden kann man die Translation // auslesen und setzen. const Vector& getTranslation() const; void setTranslation(const Vector& trans); virtual void set(); virtual void unset(); private: Vector trans_; }; // // Scaling // class Scaling : public Transformation { public: Scaling(const Vector& scale = Vector(1, 1, 1)); // Skaliert das Koordinatensystem um die in scale // angegebenen Faktoren. // Mit diesen Methoden kann man die Skalierung // auslesen und setzen. const Vector& getScaling() const; void setScaling(const Vector& scale); virtual void set(); virtual void unset(); private: Vector scale_; }; // // Rotation // class Rotation : public Transformation { public: Rotation(double angle, const Vector& axis = Vector(0, 0, 1)); // Rotiert das Koordinatensystem um angle Grad um die // angegebene Rotationsachse. // Mit diesen Methoden kann man den Rotationswinkel // auslesen und setzen. double getAngle() const; void setAngle(double angle); // Mit diesen Methoden kann man die Rotationsachse // auslesen und setzen. const Vector& getAxis() const; void setAxis(const Vector& axis); virtual void set(); virtual void unset(); private: double angle_; Vector axis_; }; #endif // TRANSFORMATION_H