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

dox/Rendering/vtkCamera.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkCamera.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00038 #ifndef __vtkCamera_h 00039 #define __vtkCamera_h 00040 00041 #include "vtkObject.h" 00042 00043 class vtkMatrix4x4; 00044 class vtkPerspectiveTransform; 00045 class vtkRenderer; 00046 class vtkTransform; 00047 class vtkHomogeneousTransform; 00048 00049 class VTK_RENDERING_EXPORT vtkCamera : public vtkObject 00050 { 00051 public: 00052 void PrintSelf(ostream& os, vtkIndent indent); 00053 vtkTypeRevisionMacro(vtkCamera,vtkObject); 00054 00058 static vtkCamera *New(); 00059 00061 00063 void SetPosition(double x, double y, double z); 00064 void SetPosition(const double a[3]) { 00065 this->SetPosition(a[0], a[1], a[2]); }; 00066 void SetPosition(const float a[3]) { 00067 this->SetPosition(a[0], a[1], a[2]); }; 00068 vtkGetVector3Macro(Position,double); 00069 void GetPosition(float a[3]) { 00070 double tmp[3]; this->GetPosition(tmp); 00071 a[0] = static_cast<float>(tmp[0]); 00072 a[1] = static_cast<float>(tmp[1]); 00073 a[2] = static_cast<float>(tmp[2]); }; 00075 00077 00079 void SetFocalPoint(double x, double y, double z); 00080 void SetFocalPoint(const double a[3]) { 00081 this->SetFocalPoint(a[0], a[1], a[2]);}; 00082 void SetFocalPoint(const float a[3]) { 00083 this->SetFocalPoint(a[0], a[1], a[2]);}; 00084 vtkGetVector3Macro(FocalPoint,double); 00085 void GetFocalPoint(float a[3]) { 00086 double tmp[3]; this->GetFocalPoint(tmp); 00087 a[0] = static_cast<float>(tmp[0]); 00088 a[1] = static_cast<float>(tmp[1]); 00089 a[2] = static_cast<float>(tmp[2]); }; 00091 00093 00095 void SetViewUp(double vx, double vy, double vz); 00096 void SetViewUp(const double a[3]) { 00097 this->SetViewUp(a[0], a[1], a[2]); } 00098 void SetViewUp(const float a[3]) { 00099 this->SetViewUp(a[0], a[1], a[2]); } 00100 vtkGetVector3Macro(ViewUp,double); 00101 void GetViewUp(float a[3]) { 00102 double tmp[3]; this->GetViewUp(tmp); 00103 a[0] = static_cast<float>(tmp[0]); 00104 a[1] = static_cast<float>(tmp[1]); 00105 a[2] = static_cast<float>(tmp[2]); }; 00107 00111 void OrthogonalizeViewUp(); 00112 00114 00116 void SetDistance(double); 00117 vtkGetMacro(Distance,double); 00119 00121 00124 vtkGetVector3Macro(DirectionOfProjection,double); 00125 void GetDirectionOfProjection(float a[3]) { 00126 double tmp[3]; this->GetDirectionOfProjection(tmp); 00127 a[0] = static_cast<float>(tmp[0]); 00128 a[1] = static_cast<float>(tmp[1]); 00129 a[2] = static_cast<float>(tmp[2]); }; 00131 00135 void Dolly(double distance); 00136 00138 00139 void SetRoll(double angle); 00140 double GetRoll(); 00142 00144 void Roll(double angle); 00145 00149 void Azimuth(double angle); 00150 00154 void Yaw(double angle); 00155 00158 void Elevation(double angle); 00159 00162 void Pitch(double angle); 00163 00165 00168 void SetParallelProjection(int flag); 00169 vtkGetMacro(ParallelProjection,int); 00170 vtkBooleanMacro(ParallelProjection,int); 00172 00174 00180 void SetUseHorizontalViewAngle(int flag); 00181 vtkGetMacro(UseHorizontalViewAngle, int); 00182 vtkBooleanMacro(UseHorizontalViewAngle, int); 00184 00186 00193 void SetViewAngle(double angle); 00194 vtkGetMacro(ViewAngle,double); 00196 00198 00203 void SetParallelScale(double scale); 00204 vtkGetMacro(ParallelScale,double); 00206 00211 void Zoom(double factor); 00212 00214 00221 void SetClippingRange(double near, double far); 00222 void SetClippingRange(const double a[2]) { 00223 this->SetClippingRange(a[0], a[1]); }; 00224 void SetClippingRange(const float a[2]) { 00225 this->SetClippingRange(a[0], a[1]); }; 00226 vtkGetVector2Macro(ClippingRange,double); 00227 void GetClippingRange(float a[2]) { 00228 double tmp[2]; this->GetClippingRange(tmp); 00229 a[0] = static_cast<float>(tmp[0]); 00230 a[1] = static_cast<float>(tmp[1]); }; 00232 00234 00237 void SetThickness(double); 00238 vtkGetMacro(Thickness,double); 00240 00242 00247 void SetWindowCenter(double x, double y); 00248 vtkGetVector2Macro(WindowCenter,double); 00250 00259 void SetObliqueAngles(double alpha, double beta); 00260 00264 void ApplyTransform(vtkTransform *t); 00265 00267 00270 vtkGetVector3Macro(ViewPlaneNormal,double); 00271 void GetViewPlaneNormal(float a[3]) { 00272 double tmp[3]; this->GetViewPlaneNormal(tmp); 00273 a[0] = static_cast<float>(tmp[0]); 00274 a[1] = static_cast<float>(tmp[1]); 00275 a[2] = static_cast<float>(tmp[2]); }; 00277 00278 00280 00284 void SetViewShear(double dxdz, double dydz, double center); 00285 void SetViewShear(double d[3]); 00286 vtkGetVector3Macro(ViewShear, double); 00288 00290 00292 vtkSetMacro(EyeAngle,double); 00293 vtkGetMacro(EyeAngle,double); 00295 00297 00301 vtkSetMacro(FocalDisk,double); 00302 vtkGetMacro(FocalDisk,double); 00304 00306 virtual vtkMatrix4x4 *GetViewTransformMatrix(); 00307 00309 00314 virtual vtkMatrix4x4 *GetPerspectiveTransformMatrix(double aspect, 00315 double nearz, 00316 double farz); 00318 00320 00326 virtual vtkMatrix4x4 *GetCompositePerspectiveTransformMatrix(double aspect, 00327 double nearz, 00328 double farz); 00330 00332 00336 void SetUserTransform(vtkHomogeneousTransform *transform); 00337 vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform); 00339 00343 virtual void Render(vtkRenderer *) {}; 00344 00347 unsigned long GetViewingRaysMTime(); 00348 00351 void ViewingRaysModified(); 00352 00358 virtual void GetFrustumPlanes(float aspect, float planes[24]); 00359 00361 00362 float *GetOrientation(); 00363 float *GetOrientationWXYZ(); 00365 00367 00370 void SetViewPlaneNormal(double x, double y, double z); 00371 void SetViewPlaneNormal(const double a[3]) { 00372 this->SetViewPlaneNormal(a[0], a[1], a[2]); }; 00373 void SetViewPlaneNormal(const float a[3]) { 00374 this->SetViewPlaneNormal(a[0], a[1], a[2]); }; 00376 00379 void ComputeViewPlaneNormal(); 00380 00384 vtkMatrix4x4 *GetCameraLightTransformMatrix(); 00385 00387 virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {} 00388 00389 virtual vtkTransform *GetViewTransformObject() {return this->ViewTransform;}; 00390 00392 00393 vtkSetMacro(LeftEye,int); 00395 00396 protected: 00397 vtkCamera(); 00398 ~vtkCamera(); 00399 00401 00402 void ComputeDistance(); 00403 void ComputeViewTransform(); 00404 void ComputePerspectiveTransform(double aspect, double nearz, double farz); 00405 void ComputeCompositePerspectiveTransform(double aspect, 00406 double nearz, double farz); 00407 void ComputeCameraLightTransform(); 00409 00410 double WindowCenter[2]; 00411 double ObliqueAngles[2]; 00412 double FocalPoint[3]; 00413 double Position[3]; 00414 double ViewUp[3]; 00415 double ViewAngle; 00416 double ClippingRange[2]; 00417 double EyeAngle; 00418 int ParallelProjection; 00419 double ParallelScale; 00420 int Stereo; 00421 int LeftEye; 00422 double Thickness; 00423 double Distance; 00424 double DirectionOfProjection[3]; 00425 double ViewPlaneNormal[3]; 00426 double ViewShear[3]; 00427 int UseHorizontalViewAngle; 00428 vtkHomogeneousTransform *UserTransform; 00429 00430 vtkTransform *ViewTransform; 00431 vtkPerspectiveTransform *PerspectiveTransform; 00432 vtkPerspectiveTransform *Transform; 00433 vtkTransform *CameraLightTransform; 00434 00435 double FocalDisk; 00436 00437 // ViewingRaysMtime keeps track of camera modifications which will 00438 // change the calculation of viewing rays for the camera before it is 00439 // transformed to the camera's location and orientation. 00440 vtkTimeStamp ViewingRaysMTime; 00441 private: 00442 vtkCamera(const vtkCamera&); // Not implemented. 00443 void operator=(const vtkCamera&); // Not implemented. 00444 }; 00445 00446 #endif 00447