Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkCamera.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkCamera.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00047 #ifndef __vtkCamera_h
00048 #define __vtkCamera_h
00049 
00050 #include "vtkObject.h"
00051 
00052 class vtkMatrix4x4;
00053 class vtkPerspectiveTransform;
00054 class vtkRenderer;
00055 class vtkTransform;
00056 class vtkHomogeneousTransform;
00057 
00058 class VTK_RENDERING_EXPORT vtkCamera : public vtkObject
00059 {
00060  public:
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062   vtkTypeRevisionMacro(vtkCamera,vtkObject);
00063 
00067   static vtkCamera *New();
00068 
00070 
00072   void SetPosition(double x, double y, double z);
00073   void SetPosition(const double a[3]) {
00074     this->SetPosition(a[0], a[1], a[2]); };
00075   vtkGetVector3Macro(Position,double);
00077 
00079 
00081   void SetFocalPoint(double x, double y, double z);
00082   void SetFocalPoint(const double a[3]) {
00083     this->SetFocalPoint(a[0], a[1], a[2]);};
00084   vtkGetVector3Macro(FocalPoint,double);
00086   
00088 
00090   void SetViewUp(double vx, double vy, double vz);
00091   void SetViewUp(const double a[3]) {
00092     this->SetViewUp(a[0], a[1], a[2]); }
00093   vtkGetVector3Macro(ViewUp,double);
00095 
00099   void OrthogonalizeViewUp();
00100 
00103   void SetDistance(double);
00104 
00106 
00108   vtkGetMacro(Distance,double);
00110 
00112 
00115   vtkGetVector3Macro(DirectionOfProjection,double);
00117 
00121   void Dolly(double distance);
00122 
00124 
00125   void SetRoll(double angle);
00126   double GetRoll();
00128 
00130   void Roll(double angle);
00131 
00135   void Azimuth(double angle);
00136 
00140   void Yaw(double angle);
00141 
00144   void Elevation(double angle);
00145 
00148   void Pitch(double angle);
00149 
00151 
00154   void SetParallelProjection(int flag);
00155   vtkGetMacro(ParallelProjection,int);
00156   vtkBooleanMacro(ParallelProjection,int);
00158 
00160 
00166   void SetUseHorizontalViewAngle(int flag);
00167   vtkGetMacro(UseHorizontalViewAngle, int);
00168   vtkBooleanMacro(UseHorizontalViewAngle, int);
00170 
00172 
00179   void SetViewAngle(double angle);
00180   vtkGetMacro(ViewAngle,double);
00182 
00184 
00189   void SetParallelScale(double scale);
00190   vtkGetMacro(ParallelScale,double);
00192 
00197   void Zoom(double factor);
00198 
00200 
00207   void SetClippingRange(double near, double far);
00208   void SetClippingRange(const double a[2]) {
00209     this->SetClippingRange(a[0], a[1]); };
00210   vtkGetVector2Macro(ClippingRange,double);
00212 
00214 
00217   void SetThickness(double);
00218   vtkGetMacro(Thickness,double);
00220 
00222 
00227   void SetWindowCenter(double x, double y);
00228   vtkGetVector2Macro(WindowCenter,double);
00230 
00239   void SetObliqueAngles(double alpha, double beta);
00240 
00244   void ApplyTransform(vtkTransform *t);
00245 
00247 
00250   vtkGetVector3Macro(ViewPlaneNormal,double);
00252 
00254 
00258   void SetViewShear(double dxdz, double dydz, double center);
00259   void SetViewShear(double d[3]);
00260   vtkGetVector3Macro(ViewShear, double);
00262 
00264 
00266   vtkSetMacro(EyeAngle,double);
00267   vtkGetMacro(EyeAngle,double);
00269 
00271 
00275   vtkSetMacro(FocalDisk,double);
00276   vtkGetMacro(FocalDisk,double);
00278 
00280   virtual vtkMatrix4x4 *GetViewTransformMatrix();
00281   
00283 
00288   virtual vtkMatrix4x4 *GetPerspectiveTransformMatrix(double aspect,
00289                                                       double nearz, 
00290                                                       double farz);
00292   
00294 
00300   virtual vtkMatrix4x4 *GetCompositePerspectiveTransformMatrix(double aspect, 
00301                                                                double nearz, 
00302                                                                double farz);
00304 
00306 
00310   void SetUserTransform(vtkHomogeneousTransform *transform);
00311   vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform);
00313 
00317   virtual void Render(vtkRenderer *) {};
00318 
00321   unsigned long GetViewingRaysMTime();
00322 
00325   void ViewingRaysModified();
00326 
00332   virtual void GetFrustumPlanes(double aspect, double planes[24]);
00333 
00335 
00336   double *GetOrientation();
00337   double *GetOrientationWXYZ();
00339 
00341 
00344   void SetViewPlaneNormal(double x, double y, double z);
00345   void SetViewPlaneNormal(const double a[3]) {
00346     this->SetViewPlaneNormal(a[0], a[1], a[2]); };
00348 
00351   void ComputeViewPlaneNormal();
00352 
00356   vtkMatrix4x4 *GetCameraLightTransformMatrix();
00357   
00359   virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
00360   
00361   virtual vtkTransform *GetViewTransformObject() {return this->ViewTransform;};
00362   
00363 protected:
00364   vtkCamera();
00365   ~vtkCamera();
00366 
00368 
00369   void ComputeDistance();
00370   void ComputeViewTransform();
00371   void ComputePerspectiveTransform(double aspect, double nearz, double farz);
00372   void ComputeCompositePerspectiveTransform(double aspect, 
00373                                             double nearz, double farz);
00374   void ComputeCameraLightTransform();
00376 
00377   double WindowCenter[2];
00378   double ObliqueAngles[2];
00379   double FocalPoint[3];
00380   double Position[3];
00381   double ViewUp[3];
00382   double ViewAngle;
00383   double ClippingRange[2];
00384   double EyeAngle;
00385   int    ParallelProjection;
00386   double ParallelScale;
00387   int    Stereo;
00388   int    LeftEye;
00389   double Thickness;
00390   double Distance;
00391   double DirectionOfProjection[3];
00392   double ViewPlaneNormal[3];
00393   double ViewShear[3];
00394   int    UseHorizontalViewAngle;
00395   vtkHomogeneousTransform *UserTransform;
00396 
00397   vtkTransform *ViewTransform;
00398   vtkPerspectiveTransform *PerspectiveTransform;
00399   vtkPerspectiveTransform *Transform;
00400   vtkTransform *CameraLightTransform;
00401 
00402   double FocalDisk;
00403 
00404   // ViewingRaysMtime keeps track of camera modifications which will 
00405   // change the calculation of viewing rays for the camera before it is 
00406   // transformed to the camera's location and orientation. 
00407   vtkTimeStamp ViewingRaysMTime;
00408 private:
00409   vtkCamera(const vtkCamera&);  // Not implemented.
00410   void operator=(const vtkCamera&);  // Not implemented.
00411 };
00412 
00413 #endif
00414