00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00034 #ifndef __vtkCamera_h
00035 #define __vtkCamera_h
00036
00037 #include "vtkObject.h"
00038
00039 class vtkMatrix4x4;
00040 class vtkPerspectiveTransform;
00041 class vtkRenderer;
00042 class vtkTransform;
00043 class vtkHomogeneousTransform;
00044
00045 class VTK_RENDERING_EXPORT vtkCamera : public vtkObject
00046 {
00047 public:
00048 void PrintSelf(ostream& os, vtkIndent indent);
00049 vtkTypeRevisionMacro(vtkCamera,vtkObject);
00050
00054 static vtkCamera *New();
00055
00057
00059 void SetPosition(double x, double y, double z);
00060 void SetPosition(const double a[3]) {
00061 this->SetPosition(a[0], a[1], a[2]); };
00062 vtkGetVector3Macro(Position,double);
00064
00066
00068 void SetFocalPoint(double x, double y, double z);
00069 void SetFocalPoint(const double a[3]) {
00070 this->SetFocalPoint(a[0], a[1], a[2]);};
00071 vtkGetVector3Macro(FocalPoint,double);
00073
00075
00077 void SetViewUp(double vx, double vy, double vz);
00078 void SetViewUp(const double a[3]) {
00079 this->SetViewUp(a[0], a[1], a[2]); }
00080 vtkGetVector3Macro(ViewUp,double);
00082
00086 void OrthogonalizeViewUp();
00087
00090 void SetDistance(double);
00091
00093
00095 vtkGetMacro(Distance,double);
00097
00099
00102 vtkGetVector3Macro(DirectionOfProjection,double);
00104
00108 void Dolly(double distance);
00109
00111
00112 void SetRoll(double angle);
00113 double GetRoll();
00115
00117 void Roll(double angle);
00118
00122 void Azimuth(double angle);
00123
00127 void Yaw(double angle);
00128
00131 void Elevation(double angle);
00132
00135 void Pitch(double angle);
00136
00138
00141 void SetParallelProjection(int flag);
00142 vtkGetMacro(ParallelProjection,int);
00143 vtkBooleanMacro(ParallelProjection,int);
00145
00147
00153 void SetUseHorizontalViewAngle(int flag);
00154 vtkGetMacro(UseHorizontalViewAngle, int);
00155 vtkBooleanMacro(UseHorizontalViewAngle, int);
00157
00159
00166 void SetViewAngle(double angle);
00167 vtkGetMacro(ViewAngle,double);
00169
00171
00176 void SetParallelScale(double scale);
00177 vtkGetMacro(ParallelScale,double);
00179
00184 void Zoom(double factor);
00185
00187
00194 void SetClippingRange(double dNear, double dFar);
00195 void SetClippingRange(const double a[2]) {
00196 this->SetClippingRange(a[0], a[1]); };
00197 vtkGetVector2Macro(ClippingRange,double);
00199
00201
00204 void SetThickness(double);
00205 vtkGetMacro(Thickness,double);
00207
00209
00214 void SetWindowCenter(double x, double y);
00215 vtkGetVector2Macro(WindowCenter,double);
00217
00226 void SetObliqueAngles(double alpha, double beta);
00227
00231 void ApplyTransform(vtkTransform *t);
00232
00234
00237 vtkGetVector3Macro(ViewPlaneNormal,double);
00239
00241
00245 void SetViewShear(double dxdz, double dydz, double center);
00246 void SetViewShear(double d[3]);
00247 vtkGetVector3Macro(ViewShear, double);
00249
00251
00253 vtkSetMacro(EyeAngle,double);
00254 vtkGetMacro(EyeAngle,double);
00256
00258
00262 vtkSetMacro(FocalDisk,double);
00263 vtkGetMacro(FocalDisk,double);
00265
00267 virtual vtkMatrix4x4 *GetViewTransformMatrix();
00268
00270
00275 virtual vtkMatrix4x4 *GetPerspectiveTransformMatrix(double aspect,
00276 double nearz,
00277 double farz);
00279
00281
00287 virtual vtkMatrix4x4 *GetCompositePerspectiveTransformMatrix(double aspect,
00288 double nearz,
00289 double farz);
00291
00293
00297 void SetUserTransform(vtkHomogeneousTransform *transform);
00298 vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform);
00300
00304 virtual void Render(vtkRenderer *) {};
00305
00308 unsigned long GetViewingRaysMTime();
00309
00312 void ViewingRaysModified();
00313
00319 virtual void GetFrustumPlanes(double aspect, double planes[24]);
00320
00322
00323 double *GetOrientation();
00324 double *GetOrientationWXYZ();
00326
00328
00331 void SetViewPlaneNormal(double x, double y, double z);
00332 void SetViewPlaneNormal(const double a[3]) {
00333 this->SetViewPlaneNormal(a[0], a[1], a[2]); };
00335
00338 void ComputeViewPlaneNormal();
00339
00343 vtkMatrix4x4 *GetCameraLightTransformMatrix();
00344
00346 virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
00347
00348 virtual vtkTransform *GetViewTransformObject() {return this->ViewTransform;};
00349
00350 protected:
00351 vtkCamera();
00352 ~vtkCamera();
00353
00355
00356 void ComputeDistance();
00357 void ComputeViewTransform();
00358 void ComputePerspectiveTransform(double aspect, double nearz, double farz);
00359 void ComputeCompositePerspectiveTransform(double aspect,
00360 double nearz, double farz);
00361 void ComputeCameraLightTransform();
00363
00364 double WindowCenter[2];
00365 double ObliqueAngles[2];
00366 double FocalPoint[3];
00367 double Position[3];
00368 double ViewUp[3];
00369 double ViewAngle;
00370 double ClippingRange[2];
00371 double EyeAngle;
00372 int ParallelProjection;
00373 double ParallelScale;
00374 int Stereo;
00375 int LeftEye;
00376 double Thickness;
00377 double Distance;
00378 double DirectionOfProjection[3];
00379 double ViewPlaneNormal[3];
00380 double ViewShear[3];
00381 int UseHorizontalViewAngle;
00382 vtkHomogeneousTransform *UserTransform;
00383
00384 vtkTransform *ViewTransform;
00385 vtkPerspectiveTransform *PerspectiveTransform;
00386 vtkPerspectiveTransform *Transform;
00387 vtkTransform *CameraLightTransform;
00388
00389 double FocalDisk;
00390
00391
00392
00393
00394 vtkTimeStamp ViewingRaysMTime;
00395 private:
00396 vtkCamera(const vtkCamera&);
00397 void operator=(const vtkCamera&);
00398 };
00399
00400 #endif
00401