Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Common/vtkPerspectiveTransform.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkPerspectiveTransform.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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);  // Not implemented.
00350   void operator=(const vtkPerspectiveTransform&);  // Not implemented.
00351 };
00352 
00353 
00354 #endif

Generated on Thu Mar 28 14:19:16 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001