00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00074 #ifndef __vtkPerspectiveTransform_h
00075 #define __vtkPerspectiveTransform_h
00076 
00077 #include "vtkHomogeneousTransform.h"
00078 
00079 class VTK_EXPORT vtkPerspectiveTransform : public vtkHomogeneousTransform
00080 {
00081  public:
00082   static vtkPerspectiveTransform *New();
00083   vtkTypeMacro(vtkPerspectiveTransform,vtkHomogeneousTransform);
00084   void PrintSelf(ostream& os, vtkIndent indent);
00085 
00089   void Identity() { this->Concatenation->Identity(); this->Modified(); };
00090 
00094   void Inverse() { this->Concatenation->Inverse(); this->Modified(); };
00095 
00102   void AdjustViewport(double oldXMin, double oldXMax, 
00103             double oldYMin, double oldYMax,
00104             double newXMin, double newXMax, 
00105             double newYMin, double newYMax);
00106 
00112   void AdjustZBuffer(double oldNearZ, double oldFarZ,
00113            double newNearZ, double newFarZ);
00114 
00118   void Ortho(double xmin, double xmax, double ymin, double ymax, 
00119         double znear, double zfar);
00120 
00125   void Frustum(double xmin, double xmax, double ymin, double ymax, 
00126           double znear, double zfar);
00127 
00132   void Perspective(double angle, double aspect, double znear, double zfar);
00133 
00144   void Shear(double dxdz, double dydz, double zplane);
00145 
00153   void Stereo(double angle, double focaldistance);
00154 
00158   void SetupCamera(const double position[3], const double focalpoint[3],
00159          const double viewup[3]);
00160 
00163   void Translate(double x, double y, double z) {
00164     this->Concatenation->Translate(x,y,z); };
00165   void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
00166   void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
00167 
00172   void RotateWXYZ(double angle, double x, double y, double z) {
00173     this->Concatenation->Rotate(angle,x,y,z); };
00174   void RotateWXYZ(double angle, const double axis[3]) {
00175     this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00176   void RotateWXYZ(double angle, const float axis[3]) {
00177     this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00178 
00182   void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
00183   void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
00184   void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
00185 
00189   void Scale(double x, double y, double z) {
00190     this->Concatenation->Scale(x,y,z); };
00191   void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
00192   void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
00193 
00196   void SetMatrix(vtkMatrix4x4 *matrix) { 
00197     this->SetMatrix(*matrix->Element); };
00198   void SetMatrix(const double elements[16]) { 
00199     this->Identity(); this->Concatenate(elements); };
00200 
00203   void Concatenate(vtkMatrix4x4 *matrix) { 
00204     this->Concatenate(*matrix->Element); };
00205   void Concatenate(const double elements[16]) {
00206     this->Concatenation->Concatenate(elements); };
00207 
00213   void Concatenate(vtkHomogeneousTransform *transform);
00214 
00220   void PreMultiply() { 
00221     if (this->Concatenation->GetPreMultiplyFlag()) { return; }
00222     this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
00223 
00229   void PostMultiply()  { 
00230     if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
00231     this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
00232 
00234   void Push() { if (this->Stack == NULL) { 
00235                     this->Stack = vtkTransformConcatenationStack::New(); }
00236                 this->Stack->Push(&this->Concatenation); 
00237                 this->Modified(); };
00238 
00241   void Pop() { if (this->Stack == NULL) { return; }
00242                this->Stack->Pop(&this->Concatenation);
00243                this->Modified(); };
00244 
00249   void SetInput(vtkHomogeneousTransform *input);
00250   vtkHomogeneousTransform *GetInput() { return this->Input; };
00251 
00252 
00255   vtkAbstractTransform *MakeTransform();
00256 
00263   int CircuitCheck(vtkAbstractTransform *transform);
00264 
00266   unsigned long GetMTime();
00267 
00268 protected:
00269   vtkPerspectiveTransform();
00270   ~vtkPerspectiveTransform();
00271   vtkPerspectiveTransform(const vtkPerspectiveTransform& t);
00272   void operator=(const vtkPerspectiveTransform&) {};
00273 
00274   void InternalDeepCopy(vtkAbstractTransform *t);
00275   void InternalUpdate();
00276 
00277   vtkHomogeneousTransform *Input;
00278   vtkTransformConcatenation *Concatenation;
00279   vtkTransformConcatenationStack *Stack;
00280 };
00281 
00282 
00283 #endif