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
00270 virtual vtkMatrix4x4 *GetViewTransformMatrix();
00271
00273
00277 virtual vtkTransform *GetViewTransformObject()
00278 {
00279 return this->ViewTransform;
00280 }
00282
00284
00290 virtual vtkMatrix4x4 *GetPerspectiveTransformMatrix(double aspect,
00291 double nearz,
00292 double farz);
00294
00296
00303 virtual vtkMatrix4x4 *GetCompositePerspectiveTransformMatrix(double aspect,
00304 double nearz,
00305 double farz);
00307
00309
00313 void SetUserTransform(vtkHomogeneousTransform *transform);
00314 vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform);
00316
00320 virtual void Render(vtkRenderer *) {};
00321
00324 unsigned long GetViewingRaysMTime();
00325
00328 void ViewingRaysModified();
00329
00335 virtual void GetFrustumPlanes(double aspect, double planes[24]);
00336
00338
00339 double *GetOrientation();
00340 double *GetOrientationWXYZ();
00342
00344
00347 VTK_LEGACY(void SetViewPlaneNormal(double x, double y, double z));
00348 VTK_LEGACY(void SetViewPlaneNormal(const double a[3]));
00350
00353 void ComputeViewPlaneNormal();
00354
00358 vtkMatrix4x4 *GetCameraLightTransformMatrix();
00359
00361 virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
00362
00364
00365 vtkSetMacro(LeftEye,int);
00366 vtkGetMacro(LeftEye,int);
00368
00369 protected:
00370 vtkCamera();
00371 ~vtkCamera();
00372
00374
00375 void ComputeDistance();
00376 void ComputeViewTransform();
00377 void ComputePerspectiveTransform(double aspect, double nearz, double farz);
00378 void ComputeCompositePerspectiveTransform(double aspect,
00379 double nearz, double farz);
00380 void ComputeCameraLightTransform();
00382
00383 double WindowCenter[2];
00384 double ObliqueAngles[2];
00385 double FocalPoint[3];
00386 double Position[3];
00387 double ViewUp[3];
00388 double ViewAngle;
00389 double ClippingRange[2];
00390 double EyeAngle;
00391 int ParallelProjection;
00392 double ParallelScale;
00393 int Stereo;
00394 int LeftEye;
00395 double Thickness;
00396 double Distance;
00397 double DirectionOfProjection[3];
00398 double ViewPlaneNormal[3];
00399 double ViewShear[3];
00400 int UseHorizontalViewAngle;
00401 vtkHomogeneousTransform *UserTransform;
00402
00403 vtkTransform *ViewTransform;
00404 vtkPerspectiveTransform *PerspectiveTransform;
00405 vtkPerspectiveTransform *Transform;
00406 vtkTransform *CameraLightTransform;
00407
00408 double FocalDisk;
00409
00410
00411
00412
00413 vtkTimeStamp ViewingRaysMTime;
00414 private:
00415 vtkCamera(const vtkCamera&);
00416 void operator=(const vtkCamera&);
00417 };
00418
00419 #endif
00420