00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00031 #ifndef __vtkCamera_h
00032 #define __vtkCamera_h
00033
00034 #include "vtkObject.h"
00035
00036 class vtkHomogeneousTransform;
00037 class vtkMatrix4x4;
00038 class vtkPerspectiveTransform;
00039 class vtkRenderer;
00040 class vtkTransform;
00041 class vtkCallbackCommand;
00042 class vtkCameraCallbackCommand;
00043
00044 class VTK_RENDERING_EXPORT vtkCamera : public vtkObject
00045 {
00046 public:
00047 void PrintSelf(ostream& os, vtkIndent indent);
00048 vtkTypeRevisionMacro(vtkCamera,vtkObject);
00049
00053 static vtkCamera *New();
00054
00056
00058 void SetPosition(double x, double y, double z);
00059 void SetPosition(const double a[3]) {
00060 this->SetPosition(a[0], a[1], a[2]); };
00061 vtkGetVector3Macro(Position,double);
00063
00065
00067 void SetFocalPoint(double x, double y, double z);
00068 void SetFocalPoint(const double a[3]) {
00069 this->SetFocalPoint(a[0], a[1], a[2]);};
00070 vtkGetVector3Macro(FocalPoint,double);
00072
00074
00076 void SetViewUp(double vx, double vy, double vz);
00077 void SetViewUp(const double a[3]) {
00078 this->SetViewUp(a[0], a[1], a[2]); }
00079 vtkGetVector3Macro(ViewUp,double);
00081
00085 void OrthogonalizeViewUp();
00086
00089 void SetDistance(double);
00090
00092
00094 vtkGetMacro(Distance,double);
00096
00098
00101 vtkGetVector3Macro(DirectionOfProjection,double);
00103
00108 void Dolly(double value);
00109
00111
00112 void SetRoll(double angle);
00113 double GetRoll();
00115
00118 void Roll(double angle);
00119
00124 void Azimuth(double angle);
00125
00131 void Yaw(double angle);
00132
00137 void Elevation(double angle);
00138
00142 void Pitch(double angle);
00143
00145
00148 void SetParallelProjection(int flag);
00149 vtkGetMacro(ParallelProjection,int);
00150 vtkBooleanMacro(ParallelProjection,int);
00152
00154
00160 void SetUseHorizontalViewAngle(int flag);
00161 vtkGetMacro(UseHorizontalViewAngle, int);
00162 vtkBooleanMacro(UseHorizontalViewAngle, int);
00164
00166
00173 void SetViewAngle(double angle);
00174 vtkGetMacro(ViewAngle,double);
00176
00178
00183 void SetParallelScale(double scale);
00184 vtkGetMacro(ParallelScale,double);
00186
00191 void Zoom(double factor);
00192
00194
00201 void SetClippingRange(double dNear, double dFar);
00202 void SetClippingRange(const double a[2]) {
00203 this->SetClippingRange(a[0], a[1]); };
00204 vtkGetVector2Macro(ClippingRange,double);
00206
00208
00211 void SetThickness(double);
00212 vtkGetMacro(Thickness,double);
00214
00216
00221 void SetWindowCenter(double x, double y);
00222 vtkGetVector2Macro(WindowCenter,double);
00224
00233 void SetObliqueAngles(double alpha, double beta);
00234
00238 void ApplyTransform(vtkTransform *t);
00239
00241
00244 vtkGetVector3Macro(ViewPlaneNormal,double);
00246
00248
00252 void SetViewShear(double dxdz, double dydz, double center);
00253 void SetViewShear(double d[3]);
00254 vtkGetVector3Macro(ViewShear, double);
00256
00258
00260 vtkSetMacro(EyeAngle,double);
00261 vtkGetMacro(EyeAngle,double);
00263
00265
00269 vtkSetMacro(FocalDisk,double);
00270 vtkGetMacro(FocalDisk,double);
00272
00277 virtual vtkMatrix4x4 *GetViewTransformMatrix();
00278
00280
00284 virtual vtkTransform *GetViewTransformObject()
00285 {
00286 return this->ViewTransform;
00287 }
00289
00291
00300 VTK_LEGACY(virtual vtkMatrix4x4 *GetPerspectiveTransformMatrix(double aspect,
00301 double nearz,
00302 double farz));
00304
00306
00312 virtual vtkMatrix4x4 *GetProjectionTransformMatrix(double aspect,
00313 double nearz,
00314 double farz);
00316
00318
00324 virtual vtkPerspectiveTransform *GetProjectionTransformObject(double aspect,
00325 double nearz,
00326 double farz);
00328
00329
00331
00341 VTK_LEGACY(virtual vtkMatrix4x4 *GetCompositePerspectiveTransformMatrix(
00342 double aspect,
00343 double nearz,
00344 double farz));
00346
00348
00355 virtual vtkMatrix4x4 *GetCompositeProjectionTransformMatrix(double aspect,
00356 double nearz,
00357 double farz);
00359
00360
00362
00366 void SetUserViewTransform(vtkHomogeneousTransform *transform);
00367 vtkGetObjectMacro(UserViewTransform,vtkHomogeneousTransform);
00369
00371
00375 void SetUserTransform(vtkHomogeneousTransform *transform);
00376 vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform);
00378
00382 virtual void Render(vtkRenderer *) {}
00383
00386 unsigned long GetViewingRaysMTime();
00387
00390 void ViewingRaysModified();
00391
00399 virtual void GetFrustumPlanes(double aspect, double planes[24]);
00400
00402
00403 double *GetOrientation();
00404 double *GetOrientationWXYZ();
00406
00408
00410 VTK_LEGACY(void SetViewPlaneNormal(double x, double y, double z));
00411 VTK_LEGACY(void SetViewPlaneNormal(const double a[3]));
00413
00416 void ComputeViewPlaneNormal();
00417
00421 vtkMatrix4x4 *GetCameraLightTransformMatrix();
00422
00424 virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
00425
00427
00428 vtkSetMacro(LeftEye,int);
00429 vtkGetMacro(LeftEye,int);
00431
00434 void ShallowCopy(vtkCamera *source);
00435
00438 void DeepCopy(vtkCamera *source);
00439
00440 protected:
00441 vtkCamera();
00442 ~vtkCamera();
00443
00445
00446 void ComputeDistance();
00447 void ComputeViewTransform();
00449
00450 #ifndef VTK_LEGACY_REMOVE
00451
00452
00453 void ComputePerspectiveTransform(double aspect,
00454 double nearz,
00455 double farz);
00457
00459
00461 void ComputeCompositePerspectiveTransform(double aspect,
00462 double nearz,
00463 double farz);
00465 #endif
00466
00468
00469 void ComputeProjectionTransform(double aspect,
00470 double nearz,
00471 double farz);
00473
00475
00476 void ComputeCompositeProjectionTransform(double aspect,
00477 double nearz,
00478 double farz);
00480
00481
00482 void ComputeCameraLightTransform();
00483
00486 void PartialCopy(vtkCamera *source);
00487
00488 double WindowCenter[2];
00489 double ObliqueAngles[2];
00490 double FocalPoint[3];
00491 double Position[3];
00492 double ViewUp[3];
00493 double ViewAngle;
00494 double ClippingRange[2];
00495 double EyeAngle;
00496 int ParallelProjection;
00497 double ParallelScale;
00498 int Stereo;
00499 int LeftEye;
00500 double Thickness;
00501 double Distance;
00502 double DirectionOfProjection[3];
00503 double ViewPlaneNormal[3];
00504 double ViewShear[3];
00505 int UseHorizontalViewAngle;
00506 vtkHomogeneousTransform *UserTransform;
00507 vtkHomogeneousTransform *UserViewTransform;
00508
00509 vtkTransform *ViewTransform;
00510 vtkPerspectiveTransform *ProjectionTransform;
00511 vtkPerspectiveTransform *Transform;
00512 vtkTransform *CameraLightTransform;
00513
00514 double FocalDisk;
00515
00516 vtkCameraCallbackCommand *UserViewTransformCallbackCommand;
00517 friend class vtkCameraCallbackCommand;
00518
00519
00520
00521
00522
00523 vtkTimeStamp ViewingRaysMTime;
00524 private:
00525 vtkCamera(const vtkCamera&);
00526 void operator=(const vtkCamera&);
00527 };
00528
00529 #endif
00530