VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/Core/vtkCamera.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkCamera.h
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 =========================================================================*/
00034 #ifndef vtkCamera_h
00035 #define vtkCamera_h
00036 
00037 #include "vtkRenderingCoreModule.h" // For export macro
00038 #include "vtkObject.h"
00039 
00040 class vtkHomogeneousTransform;
00041 class vtkMatrix4x4;
00042 class vtkPerspectiveTransform;
00043 class vtkRenderer;
00044 class vtkTransform;
00045 class vtkCallbackCommand;
00046 class vtkCameraCallbackCommand;
00047 
00048 class VTKRENDERINGCORE_EXPORT vtkCamera : public vtkObject
00049 {
00050 public:
00051   vtkTypeMacro(vtkCamera, vtkObject);
00052   void PrintSelf(ostream& os, vtkIndent indent);
00053 
00057   static vtkCamera *New();
00058 
00060 
00062   void SetPosition(double x, double y, double z);
00063   void SetPosition(const double a[3]) {
00064     this->SetPosition(a[0], a[1], a[2]); };
00065   vtkGetVector3Macro(Position, double);
00067 
00069 
00071   void SetFocalPoint(double x, double y, double z);
00072   void SetFocalPoint(const double a[3]) {
00073     this->SetFocalPoint(a[0], a[1], a[2]);};
00074   vtkGetVector3Macro(FocalPoint, double);
00076 
00078 
00080   void SetViewUp(double vx, double vy, double vz);
00081   void SetViewUp(const double a[3]) {
00082     this->SetViewUp(a[0], a[1], a[2]); }
00083   vtkGetVector3Macro(ViewUp, double);
00085 
00089   void OrthogonalizeViewUp();
00090 
00093   void SetDistance(double);
00094 
00096 
00098   vtkGetMacro(Distance, double);
00100 
00102 
00105   vtkGetVector3Macro(DirectionOfProjection, double);
00107 
00112   void Dolly(double value);
00113 
00115 
00116   void SetRoll(double angle);
00117   double GetRoll();
00119 
00122   void Roll(double angle);
00123 
00128   void Azimuth(double angle);
00129 
00135   void Yaw(double angle);
00136 
00141   void Elevation(double angle);
00142 
00146   void Pitch(double angle);
00147 
00149 
00152   void SetParallelProjection(int flag);
00153   vtkGetMacro(ParallelProjection, int);
00154   vtkBooleanMacro(ParallelProjection, int);
00156 
00158 
00164   void SetUseHorizontalViewAngle(int flag);
00165   vtkGetMacro(UseHorizontalViewAngle, int);
00166   vtkBooleanMacro(UseHorizontalViewAngle, int);
00168 
00170 
00177   void SetViewAngle(double angle);
00178   vtkGetMacro(ViewAngle, double);
00180 
00182 
00187   void SetParallelScale(double scale);
00188   vtkGetMacro(ParallelScale ,double);
00190 
00195   void Zoom(double factor);
00196 
00198 
00207   void SetClippingRange(double dNear, double dFar);
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 
00284   vtkSetMacro(UseOffAxisProjection, int);
00285   vtkGetMacro(UseOffAxisProjection, int);
00286   vtkBooleanMacro(UseOffAxisProjection, int);
00288 
00290 
00292   vtkSetVector3Macro(ScreenBottomLeft, double);
00293   vtkGetVector3Macro(ScreenBottomLeft, double);
00295 
00297 
00299   vtkSetVector3Macro(ScreenBottomRight, double);
00300   vtkGetVector3Macro(ScreenBottomRight, double);
00302 
00304 
00306   vtkSetVector3Macro(ScreenTopRight, double);
00307   vtkGetVector3Macro(ScreenTopRight, double);
00309 
00311 
00313   vtkSetMacro(EyeSeparation, double);
00314   vtkGetMacro(EyeSeparation, double);
00316 
00318 
00322   void SetEyePosition(double eyePosition[3]);
00323   void GetEyePosition(double eyePosition[3]);
00325 
00328   void GetEyePlaneNormal(double normal[3]);
00329 
00331 
00334   void SetEyeTransformMatrix(vtkMatrix4x4* matrix);
00335   vtkGetObjectMacro(EyeTransformMatrix, vtkMatrix4x4);
00337 
00341   void SetEyeTransformMatrix(const double elements[16]);
00342 
00344 
00347   void SetModelTransformMatrix(vtkMatrix4x4 *matrix);
00348   vtkGetObjectMacro(ModelTransformMatrix, vtkMatrix4x4);
00350 
00354   void SetModelTransformMatrix(const double elements[16]);
00355 
00357   virtual vtkMatrix4x4 *GetModelViewTransformMatrix();
00358 
00360   virtual vtkTransform *GetModelViewTransformObject();
00361 
00367   virtual vtkMatrix4x4 *GetViewTransformMatrix();
00368 
00374   virtual vtkTransform *GetViewTransformObject();
00375 
00377 
00383    virtual vtkMatrix4x4 *GetProjectionTransformMatrix(double aspect,
00384                                                       double nearz,
00385                                                       double farz);
00387 
00389 
00395   virtual vtkPerspectiveTransform *GetProjectionTransformObject(double aspect,
00396                                                                 double nearz,
00397                                                                 double farz);
00399 
00401 
00408   virtual vtkMatrix4x4 *GetCompositeProjectionTransformMatrix(double aspect,
00409                                                               double nearz,
00410                                                               double farz);
00412 
00417   virtual vtkMatrix4x4 *GetProjectionTransformMatrix(vtkRenderer *ren);
00418 
00420 
00424   void SetUserViewTransform(vtkHomogeneousTransform *transform);
00425   vtkGetObjectMacro(UserViewTransform,vtkHomogeneousTransform);
00427 
00429 
00433   void SetUserTransform(vtkHomogeneousTransform *transform);
00434   vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform);
00436 
00440   virtual void Render(vtkRenderer *) {}
00441 
00444   unsigned long GetViewingRaysMTime();
00445 
00448   void ViewingRaysModified();
00449 
00457   virtual void GetFrustumPlanes(double aspect, double planes[24]);
00458 
00460 
00461   double *GetOrientation();
00462   double *GetOrientationWXYZ();
00464 
00467   void ComputeViewPlaneNormal();
00468 
00472   vtkMatrix4x4 *GetCameraLightTransformMatrix();
00473 
00475   virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
00476 
00478 
00479   vtkSetMacro(LeftEye, int);
00480   vtkGetMacro(LeftEye, int);
00482 
00485   void ShallowCopy(vtkCamera *source);
00486 
00489   void DeepCopy(vtkCamera *source);
00490 
00492 
00495   vtkSetMacro(FreezeFocalPoint, bool);
00496   vtkGetMacro(FreezeFocalPoint, bool);
00498 
00499 protected:
00500   vtkCamera();
00501   ~vtkCamera();
00502 
00504 
00505   void ComputeDistance();
00506   virtual void ComputeViewTransform();
00508 
00510 
00511   virtual void ComputeProjectionTransform(double aspect,
00512                                           double nearz,
00513                                           double farz);
00515 
00517 
00518   void ComputeCompositeProjectionTransform(double aspect,
00519                                            double nearz,
00520                                            double farz);
00522 
00523   void ComputeCameraLightTransform();
00524 
00525 
00528   void ComputeWorldToScreenMatrix();
00529 
00531   void ComputeOffAxisProjectionFrustum();
00532 
00534   void ComputeModelViewMatrix();
00535 
00538   void PartialCopy(vtkCamera *source);
00539 
00540   double WindowCenter[2];
00541   double ObliqueAngles[2];
00542   double FocalPoint[3];
00543   double Position[3];
00544   double ViewUp[3];
00545   double ViewAngle;
00546   double ClippingRange[2];
00547   double EyeAngle;
00548   int    ParallelProjection;
00549   double ParallelScale;
00550   int    Stereo;
00551   int    LeftEye;
00552   double Thickness;
00553   double Distance;
00554   double DirectionOfProjection[3];
00555   double ViewPlaneNormal[3];
00556   double ViewShear[3];
00557   int    UseHorizontalViewAngle;
00558 
00559   int    UseOffAxisProjection;
00560 
00561   double ScreenBottomLeft[3];
00562   double ScreenBottomRight[3];
00563   double ScreenTopRight[3];
00564 
00565   double EyeSeparation;
00566 
00567   vtkMatrix4x4 *WorldToScreenMatrix;
00568   vtkTimeStamp  WorldToScreenMatrixMTime;
00569 
00570   vtkMatrix4x4 *EyeTransformMatrix;
00571 
00572   vtkMatrix4x4 *ModelTransformMatrix;
00573 
00574   vtkHomogeneousTransform *UserTransform;
00575   vtkHomogeneousTransform *UserViewTransform;
00576 
00577   vtkTransform *ViewTransform;
00578   vtkPerspectiveTransform *ProjectionTransform;
00579   vtkPerspectiveTransform *Transform;
00580   vtkTransform *CameraLightTransform;
00581 
00582   vtkTransform *ModelViewTransform;
00583 
00584   double FocalDisk;
00585   //BTX
00586   vtkCameraCallbackCommand *UserViewTransformCallbackCommand;
00587   friend class vtkCameraCallbackCommand;
00588   //ETX
00589 
00590   // ViewingRaysMtime keeps track of camera modifications which will
00591   // change the calculation of viewing rays for the camera before it is
00592   // transformed to the camera's location and orientation.
00593   vtkTimeStamp ViewingRaysMTime;
00594   bool FreezeFocalPoint;
00595 
00596 private:
00597   vtkCamera(const vtkCamera&);  // Not implemented.
00598   void operator=(const vtkCamera&);  // Not implemented.
00599 };
00600 
00601 #endif