VTK
vtkCamera.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCamera.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
34 #ifndef __vtkCamera_h
35 #define __vtkCamera_h
36 
37 #include "vtkObject.h"
38 
40 class vtkMatrix4x4;
42 class vtkRenderer;
43 class vtkTransform;
44 class vtkCallbackCommand;
45 class vtkCameraCallbackCommand;
46 
48 {
49  public:
50  void PrintSelf(ostream& os, vtkIndent indent);
51  vtkTypeMacro(vtkCamera,vtkObject);
52 
56  static vtkCamera *New();
57 
59 
61  void SetPosition(double x, double y, double z);
62  void SetPosition(const double a[3]) {
63  this->SetPosition(a[0], a[1], a[2]); };
64  vtkGetVector3Macro(Position,double);
66 
68 
70  void SetFocalPoint(double x, double y, double z);
71  void SetFocalPoint(const double a[3]) {
72  this->SetFocalPoint(a[0], a[1], a[2]);};
73  vtkGetVector3Macro(FocalPoint,double);
75 
77 
79  void SetViewUp(double vx, double vy, double vz);
80  void SetViewUp(const double a[3]) {
81  this->SetViewUp(a[0], a[1], a[2]); }
82  vtkGetVector3Macro(ViewUp,double);
84 
88  void OrthogonalizeViewUp();
89 
92  void SetDistance(double);
93 
95 
97  vtkGetMacro(Distance,double);
99 
101 
104  vtkGetVector3Macro(DirectionOfProjection,double);
106 
111  void Dolly(double value);
112 
114 
115  void SetRoll(double angle);
116  double GetRoll();
118 
121  void Roll(double angle);
122 
127  void Azimuth(double angle);
128 
134  void Yaw(double angle);
135 
140  void Elevation(double angle);
141 
145  void Pitch(double angle);
146 
148 
151  void SetParallelProjection(int flag);
152  vtkGetMacro(ParallelProjection,int);
153  vtkBooleanMacro(ParallelProjection,int);
155 
157 
163  void SetUseHorizontalViewAngle(int flag);
164  vtkGetMacro(UseHorizontalViewAngle, int);
165  vtkBooleanMacro(UseHorizontalViewAngle, int);
167 
169 
176  void SetViewAngle(double angle);
177  vtkGetMacro(ViewAngle,double);
179 
181 
186  void SetParallelScale(double scale);
187  vtkGetMacro(ParallelScale,double);
189 
194  void Zoom(double factor);
195 
197 
206  void SetClippingRange(double dNear, double dFar);
207  void SetClippingRange(const double a[2]) {
208  this->SetClippingRange(a[0], a[1]); };
209  vtkGetVector2Macro(ClippingRange,double);
211 
213 
216  void SetThickness(double);
217  vtkGetMacro(Thickness,double);
219 
221 
226  void SetWindowCenter(double x, double y);
227  vtkGetVector2Macro(WindowCenter,double);
229 
238  void SetObliqueAngles(double alpha, double beta);
239 
243  void ApplyTransform(vtkTransform *t);
244 
246 
249  vtkGetVector3Macro(ViewPlaneNormal,double);
251 
253 
257  void SetViewShear(double dxdz, double dydz, double center);
258  void SetViewShear(double d[3]);
259  vtkGetVector3Macro(ViewShear, double);
261 
263 
265  vtkSetMacro(EyeAngle,double);
266  vtkGetMacro(EyeAngle,double);
268 
270 
274  vtkSetMacro(FocalDisk,double);
275  vtkGetMacro(FocalDisk,double);
277 
279 
283  vtkSetMacro(UseOffAxisProjection, int);
284  vtkGetMacro(UseOffAxisProjection, int);
285  vtkBooleanMacro(UseOffAxisProjection, int);
287 
289 
291  vtkSetVector3Macro(ScreenBottomLeft, double);
292  vtkGetVector3Macro(ScreenBottomLeft, double);
294 
296 
298  vtkSetVector3Macro(ScreenBottomRight, double);
299  vtkGetVector3Macro(ScreenBottomRight, double);
301 
303 
305  vtkSetVector3Macro(ScreenTopRight, double);
306  vtkGetVector3Macro(ScreenTopRight, double);
308 
310 
312  vtkSetMacro(EyeSeparation, double);
313  vtkGetMacro(EyeSeparation, double);
315 
317 
321  void SetEyePosition(double eyePosition[3]);
322  void GetEyePosition(double eyePosition[3]);
324 
327  void GetEyePlaneNormal(double normal[3]);
328 
330 
333  void SetEyeTransformMatrix(vtkMatrix4x4* matrix);
334  vtkGetObjectMacro(EyeTransformMatrix, vtkMatrix4x4);
336 
340  void SetEyeTransformMatrix(const double elements[16]);
341 
343 
346  void SetModelTransformMatrix(vtkMatrix4x4 *matrix);
347  vtkGetObjectMacro(ModelTransformMatrix, vtkMatrix4x4);
349 
353  void SetModelTransformMatrix(const double elements[16]);
354 
356  virtual vtkMatrix4x4 *GetModelViewTransformMatrix();
357 
359  virtual vtkTransform *GetModelViewTransformObject();
360 
366  virtual vtkMatrix4x4 *GetViewTransformMatrix();
367 
373  virtual vtkTransform *GetViewTransformObject();
374 
376 
385  VTK_LEGACY(virtual vtkMatrix4x4 *GetPerspectiveTransformMatrix(double aspect,
386  double nearz,
387  double farz));
389 
391 
397  virtual vtkMatrix4x4 *GetProjectionTransformMatrix(double aspect,
398  double nearz,
399  double farz);
401 
403 
409  virtual vtkPerspectiveTransform *GetProjectionTransformObject(double aspect,
410  double nearz,
411  double farz);
413 
414 
416 
426  VTK_LEGACY(virtual vtkMatrix4x4 *GetCompositePerspectiveTransformMatrix(
427  double aspect,
428  double nearz,
429  double farz));
431 
433 
440  virtual vtkMatrix4x4 *GetCompositeProjectionTransformMatrix(double aspect,
441  double nearz,
442  double farz);
444 
445 
447 
451  void SetUserViewTransform(vtkHomogeneousTransform *transform);
452  vtkGetObjectMacro(UserViewTransform,vtkHomogeneousTransform);
454 
456 
460  void SetUserTransform(vtkHomogeneousTransform *transform);
461  vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform);
463 
467  virtual void Render(vtkRenderer *) {}
468 
471  unsigned long GetViewingRaysMTime();
472 
475  void ViewingRaysModified();
476 
484  virtual void GetFrustumPlanes(double aspect, double planes[24]);
485 
487 
488  double *GetOrientation();
489  double *GetOrientationWXYZ();
491 
493 
495  VTK_LEGACY(void SetViewPlaneNormal(double x, double y, double z));
496  VTK_LEGACY(void SetViewPlaneNormal(const double a[3]));
498 
501  void ComputeViewPlaneNormal();
502 
506  vtkMatrix4x4 *GetCameraLightTransformMatrix();
507 
509  virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
510 
512 
513  vtkSetMacro(LeftEye,int);
514  vtkGetMacro(LeftEye,int);
516 
519  void ShallowCopy(vtkCamera *source);
520 
523  void DeepCopy(vtkCamera *source);
524 
525 protected:
526  vtkCamera();
527  ~vtkCamera();
528 
530 
531  void ComputeDistance();
532  void ComputeViewTransform();
534 
535 #ifndef VTK_LEGACY_REMOVE
536 
537 
538  void ComputePerspectiveTransform(double aspect,
539  double nearz,
540  double farz);
542 
544 
546  void ComputeCompositePerspectiveTransform(double aspect,
547  double nearz,
548  double farz);
549 #endif
550 
551 
553 
554  void ComputeProjectionTransform(double aspect,
555  double nearz,
556  double farz);
558 
560 
561  void ComputeCompositeProjectionTransform(double aspect,
562  double nearz,
563  double farz);
565 
566  void ComputeCameraLightTransform();
567 
568 
571  void ComputeWorldToScreenMatrix();
572 
574  void ComputeOffAxisProjectionFrustum();
575 
577  void ComputeModelViewMatrix();
578 
581  void PartialCopy(vtkCamera *source);
582 
583  double WindowCenter[2];
584  double ObliqueAngles[2];
585  double FocalPoint[3];
586  double Position[3];
587  double ViewUp[3];
588  double ViewAngle;
589  double ClippingRange[2];
590  double EyeAngle;
593  int Stereo;
594  int LeftEye;
595  double Thickness;
596  double Distance;
597  double DirectionOfProjection[3];
598  double ViewPlaneNormal[3];
599  double ViewShear[3];
601 
603 
604  double ScreenBottomLeft[3];
605  double ScreenBottomRight[3];
606  double ScreenTopRight[3];
607 
609 
612 
614 
616 
619 
624 
626 
627  double FocalDisk;
628  //BTX
629  vtkCameraCallbackCommand *UserViewTransformCallbackCommand;
630  friend class vtkCameraCallbackCommand;
631  //ETX
632 
633  // ViewingRaysMtime keeps track of camera modifications which will
634  // change the calculation of viewing rays for the camera before it is
635  // transformed to the camera's location and orientation.
637 
638 private:
639  vtkCamera(const vtkCamera&); // Not implemented.
640  void operator=(const vtkCamera&); // Not implemented.
641 };
642 
643 #endif
644