00001
00002
00003
00004
00005
00006 #ifndef __VPTRANSFORM_H
00007 #define __VPTRANSFORM_H
00008
00009 #include "vppoint4d.h"
00010 #include "vpscenenode.h"
00011 #include <iostream>
00012 #include <iomanip>
00013 #include <cmath>
00014
00017
00021 class VPTransform : public VPSceneNode
00022 {
00024 friend std::ostream& operator<<(std::ostream& output, const VPTransform& t);
00025 public:
00027 VPTransform();
00028
00031 VPTransform(const VPTransform& trans);
00032
00034 void MakeIdentity();
00035
00039 VPPoint4D operator*(const VPPoint4D& point) const;
00040
00044 VPTransform operator*(const VPTransform& t) const;
00045
00046 VPTransform& operator=(const VPTransform& t);
00047
00050 void ApplyTo(VPPoint4D* ptPoint) const;
00051
00053
00056 void MakeTranslation(const VPPoint4D& translationVector);
00057
00062 void MakeTranslation(double tx, double ty, double tz)
00063 { MakeTranslation(VPPoint4D(tx,ty,tz,0)); }
00064
00067 void MakeXRotation(double radians);
00068
00071 void MakeYRotation(double radians);
00072
00075 void MakeZRotation(double radians);
00076
00080 void MakeRotation(const VPPoint4D& refVec, const float radians);
00081
00086 void MakeRotation(const VPPoint4D& refPoint, const VPPoint4D& refVec, const float radians);
00087
00089 void MakeScale(double sX, double sY, double sZ);
00090
00092 void MakeShear(double shX, double shY);
00093
00095
00098 const double* GetData() const { return matrix; }
00099
00101
00105 void GetVectorX(VPPoint4D* result) const;
00106
00108
00112 void GetVectorY(VPPoint4D* result) const;
00113
00115
00119 void GetVectorZ(VPPoint4D* result) const;
00121 void GetTranslation(VPPoint4D* result) const;
00124 virtual bool DrawOGL() const;
00125 private:
00126
00127 bool Zero(const double& n) { return (fabs(n) < 0.0000001); }
00128
00129 double matrix[16];
00130 };
00131
00132 #endif