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
00075 #ifndef __vtkPerspectiveTransform_h
00076 #define __vtkPerspectiveTransform_h
00077
00078 #include "vtkHomogeneousTransform.h"
00079
00080 class VTK_COMMON_EXPORT vtkPerspectiveTransform : public vtkHomogeneousTransform
00081 {
00082 public:
00083 static vtkPerspectiveTransform *New();
00084 vtkTypeMacro(vtkPerspectiveTransform,vtkHomogeneousTransform);
00085 void PrintSelf(ostream& os, vtkIndent indent);
00086
00090 void Identity() { this->Concatenation->Identity(); this->Modified(); };
00091
00095 void Inverse() { this->Concatenation->Inverse(); this->Modified(); };
00096
00098
00104 void AdjustViewport(double oldXMin, double oldXMax,
00105 double oldYMin, double oldYMax,
00106 double newXMin, double newXMax,
00107 double newYMin, double newYMax);
00109
00111
00116 void AdjustZBuffer(double oldNearZ, double oldFarZ,
00117 double newNearZ, double newFarZ);
00119
00121
00124 void Ortho(double xmin, double xmax, double ymin, double ymax,
00125 double znear, double zfar);
00127
00129
00133 void Frustum(double xmin, double xmax, double ymin, double ymax,
00134 double znear, double zfar);
00136
00141 void Perspective(double angle, double aspect, double znear, double zfar);
00142
00153 void Shear(double dxdz, double dydz, double zplane);
00154
00162 void Stereo(double angle, double focaldistance);
00163
00165
00168 void SetupCamera(const double position[3], const double focalpoint[3],
00169 const double viewup[3]);
00171
00173
00175 void Translate(double x, double y, double z) {
00176 this->Concatenation->Translate(x,y,z); };
00177 void Translate(const double x[3]) { this->Translate(x[0], x[1], x[2]); };
00178 void Translate(const float x[3]) { this->Translate(x[0], x[1], x[2]); };
00180
00182
00186 void RotateWXYZ(double angle, double x, double y, double z) {
00187 this->Concatenation->Rotate(angle,x,y,z); };
00188 void RotateWXYZ(double angle, const double axis[3]) {
00189 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00190 void RotateWXYZ(double angle, const float axis[3]) {
00191 this->RotateWXYZ(angle, axis[0], axis[1], axis[2]); };
00193
00195
00198 void RotateX(double angle) { this->RotateWXYZ(angle, 1, 0, 0); };
00199 void RotateY(double angle) { this->RotateWXYZ(angle, 0, 1, 0); };
00200 void RotateZ(double angle) { this->RotateWXYZ(angle, 0, 0, 1); };
00202
00204
00207 void Scale(double x, double y, double z) {
00208 this->Concatenation->Scale(x,y,z); };
00209 void Scale(const double s[3]) { this->Scale(s[0], s[1], s[2]); };
00210 void Scale(const float s[3]) { this->Scale(s[0], s[1], s[2]); };
00212
00214
00216 void SetMatrix(vtkMatrix4x4 *matrix) {
00217 this->SetMatrix(*matrix->Element); };
00218 void SetMatrix(const double elements[16]) {
00219 this->Identity(); this->Concatenate(elements); };
00221
00223
00225 void Concatenate(vtkMatrix4x4 *matrix) {
00226 this->Concatenate(*matrix->Element); };
00227 void Concatenate(const double elements[16]) {
00228 this->Concatenation->Concatenate(elements); };
00230
00236 void Concatenate(vtkHomogeneousTransform *transform);
00237
00239
00244 void PreMultiply() {
00245 if (this->Concatenation->GetPreMultiplyFlag()) { return; }
00246 this->Concatenation->SetPreMultiplyFlag(1); this->Modified(); };
00248
00250
00255 void PostMultiply() {
00256 if (!this->Concatenation->GetPreMultiplyFlag()) { return; }
00257 this->Concatenation->SetPreMultiplyFlag(0); this->Modified(); };
00259
00261
00263 int GetNumberOfConcatenatedTransforms() {
00264 return this->Concatenation->GetNumberOfTransforms() +
00265 (this->Input == NULL ? 0 : 1); };
00267
00269
00274 vtkHomogeneousTransform *GetConcatenatedTransform(int i) {
00275 if (this->Input == NULL) {
00276 return (vtkHomogeneousTransform *)this->Concatenation->GetTransform(i); }
00277 else if (i < this->Concatenation->GetNumberOfPreTransforms()) {
00278 return (vtkHomogeneousTransform *)this->Concatenation->GetTransform(i); }
00279 else if (i > this->Concatenation->GetNumberOfPreTransforms()) {
00280 return (vtkHomogeneousTransform*)this->Concatenation->GetTransform(i-1);}
00281 else if (this->GetInverseFlag()) {
00282 return (vtkHomogeneousTransform *)this->Input->GetInverse(); }
00283 else {
00284 return (vtkHomogeneousTransform *)this->Input; } };
00286
00288
00294 void SetInput(vtkHomogeneousTransform *input);
00295 vtkHomogeneousTransform *GetInput() { return this->Input; };
00297
00299
00303 int GetInverseFlag() {
00304 return this->Concatenation->GetInverseFlag(); };
00306
00308
00309 void Push() { if (this->Stack == NULL) {
00310 this->Stack = vtkTransformConcatenationStack::New(); }
00311 this->Stack->Push(&this->Concatenation);
00312 this->Modified(); };
00314
00316
00318 void Pop() { if (this->Stack == NULL) { return; }
00319 this->Stack->Pop(&this->Concatenation);
00320 this->Modified(); };
00322
00325 vtkAbstractTransform *MakeTransform();
00326
00333 int CircuitCheck(vtkAbstractTransform *transform);
00334
00336 unsigned long GetMTime();
00337
00338 protected:
00339 vtkPerspectiveTransform();
00340 ~vtkPerspectiveTransform();
00341
00342 void InternalDeepCopy(vtkAbstractTransform *t);
00343 void InternalUpdate();
00344
00345 vtkHomogeneousTransform *Input;
00346 vtkTransformConcatenation *Concatenation;
00347 vtkTransformConcatenationStack *Stack;
00348 private:
00349 vtkPerspectiveTransform(const vtkPerspectiveTransform& t);
00350 void operator=(const vtkPerspectiveTransform&);
00351 };
00352
00353
00354 #endif