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 "vtkRenderingCoreModule.h" // For export macro
38 #include "vtkObject.h"
39 
41 class vtkMatrix4x4;
43 class vtkRenderer;
44 class vtkTransform;
45 class vtkCallbackCommand;
46 class vtkCameraCallbackCommand;
47 
49 {
50 public:
51  vtkTypeMacro(vtkCamera, vtkObject);
52  void PrintSelf(ostream& os, vtkIndent indent);
53 
57  static vtkCamera *New();
58 
60 
62  void SetPosition(double x, double y, double z);
63  void SetPosition(const double a[3]) {
64  this->SetPosition(a[0], a[1], a[2]); };
65  vtkGetVector3Macro(Position, double);
67 
69 
71  void SetFocalPoint(double x, double y, double z);
72  void SetFocalPoint(const double a[3]) {
73  this->SetFocalPoint(a[0], a[1], a[2]);};
74  vtkGetVector3Macro(FocalPoint, double);
76 
78 
80  void SetViewUp(double vx, double vy, double vz);
81  void SetViewUp(const double a[3]) {
82  this->SetViewUp(a[0], a[1], a[2]); }
83  vtkGetVector3Macro(ViewUp, double);
85 
89  void OrthogonalizeViewUp();
90 
93  void SetDistance(double);
94 
96 
98  vtkGetMacro(Distance, double);
100 
102 
105  vtkGetVector3Macro(DirectionOfProjection, double);
107 
112  void Dolly(double value);
113 
115 
116  void SetRoll(double angle);
117  double GetRoll();
119 
122  void Roll(double angle);
123 
128  void Azimuth(double angle);
129 
135  void Yaw(double angle);
136 
141  void Elevation(double angle);
142 
146  void Pitch(double angle);
147 
149 
152  void SetParallelProjection(int flag);
153  vtkGetMacro(ParallelProjection, int);
154  vtkBooleanMacro(ParallelProjection, int);
156 
158 
164  void SetUseHorizontalViewAngle(int flag);
165  vtkGetMacro(UseHorizontalViewAngle, int);
166  vtkBooleanMacro(UseHorizontalViewAngle, int);
168 
170 
177  void SetViewAngle(double angle);
178  vtkGetMacro(ViewAngle, double);
180 
182 
187  void SetParallelScale(double scale);
188  vtkGetMacro(ParallelScale ,double);
190 
195  void Zoom(double factor);
196 
198 
207  void SetClippingRange(double dNear, double dFar);
208  void SetClippingRange(const double a[2])
209  { this->SetClippingRange(a[0], a[1]); }
210  vtkGetVector2Macro(ClippingRange, double);
212 
214 
217  void SetThickness(double);
218  vtkGetMacro(Thickness, double);
220 
222 
227  void SetWindowCenter(double x, double y);
228  vtkGetVector2Macro(WindowCenter, double);
230 
239  void SetObliqueAngles(double alpha, double beta);
240 
244  void ApplyTransform(vtkTransform *t);
245 
247 
250  vtkGetVector3Macro(ViewPlaneNormal, double);
252 
254 
258  void SetViewShear(double dxdz, double dydz, double center);
259  void SetViewShear(double d[3]);
260  vtkGetVector3Macro(ViewShear, double);
262 
264 
266  vtkSetMacro(EyeAngle, double);
267  vtkGetMacro(EyeAngle, double);
269 
271 
275  vtkSetMacro(FocalDisk, double);
276  vtkGetMacro(FocalDisk, double);
278 
280 
284  vtkSetMacro(UseOffAxisProjection, int);
285  vtkGetMacro(UseOffAxisProjection, int);
286  vtkBooleanMacro(UseOffAxisProjection, int);
288 
290 
292  vtkSetVector3Macro(ScreenBottomLeft, double);
293  vtkGetVector3Macro(ScreenBottomLeft, double);
295 
297 
299  vtkSetVector3Macro(ScreenBottomRight, double);
300  vtkGetVector3Macro(ScreenBottomRight, double);
302 
304 
306  vtkSetVector3Macro(ScreenTopRight, double);
307  vtkGetVector3Macro(ScreenTopRight, double);
309 
311 
313  vtkSetMacro(EyeSeparation, double);
314  vtkGetMacro(EyeSeparation, double);
316 
318 
322  void SetEyePosition(double eyePosition[3]);
323  void GetEyePosition(double eyePosition[3]);
325 
328  void GetEyePlaneNormal(double normal[3]);
329 
331 
334  void SetEyeTransformMatrix(vtkMatrix4x4* matrix);
335  vtkGetObjectMacro(EyeTransformMatrix, vtkMatrix4x4);
337 
341  void SetEyeTransformMatrix(const double elements[16]);
342 
344 
347  void SetModelTransformMatrix(vtkMatrix4x4 *matrix);
348  vtkGetObjectMacro(ModelTransformMatrix, vtkMatrix4x4);
350 
354  void SetModelTransformMatrix(const double elements[16]);
355 
357  virtual vtkMatrix4x4 *GetModelViewTransformMatrix();
358 
360  virtual vtkTransform *GetModelViewTransformObject();
361 
367  virtual vtkMatrix4x4 *GetViewTransformMatrix();
368 
374  virtual vtkTransform *GetViewTransformObject();
375 
377 
383  virtual vtkMatrix4x4 *GetProjectionTransformMatrix(double aspect,
384  double nearz,
385  double farz);
387 
389 
395  virtual vtkPerspectiveTransform *GetProjectionTransformObject(double aspect,
396  double nearz,
397  double farz);
399 
401 
408  virtual vtkMatrix4x4 *GetCompositeProjectionTransformMatrix(double aspect,
409  double nearz,
410  double farz);
412 
417  virtual vtkMatrix4x4 *GetProjectionTransformMatrix(vtkRenderer *ren);
418 
420 
424  void SetUserViewTransform(vtkHomogeneousTransform *transform);
425  vtkGetObjectMacro(UserViewTransform,vtkHomogeneousTransform);
427 
429 
433  void SetUserTransform(vtkHomogeneousTransform *transform);
434  vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform);
436 
440  virtual void Render(vtkRenderer *) {}
441 
444  unsigned long GetViewingRaysMTime();
445 
448  void ViewingRaysModified();
449 
457  virtual void GetFrustumPlanes(double aspect, double planes[24]);
458 
460 
461  double *GetOrientation();
462  double *GetOrientationWXYZ();
464 
467  void ComputeViewPlaneNormal();
468 
472  vtkMatrix4x4 *GetCameraLightTransformMatrix();
473 
475  virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
476 
478 
479  vtkSetMacro(LeftEye, int);
480  vtkGetMacro(LeftEye, int);
482 
485  void ShallowCopy(vtkCamera *source);
486 
489  void DeepCopy(vtkCamera *source);
490 
492 
495  vtkSetMacro(FreezeFocalPoint, bool);
496  vtkGetMacro(FreezeFocalPoint, bool);
498 
499 protected:
500  vtkCamera();
501  ~vtkCamera();
502 
504 
505  void ComputeDistance();
506  virtual void ComputeViewTransform();
508 
510 
511  virtual void ComputeProjectionTransform(double aspect,
512  double nearz,
513  double farz);
515 
517 
518  void ComputeCompositeProjectionTransform(double aspect,
519  double nearz,
520  double farz);
522 
523  void ComputeCameraLightTransform();
524 
525 
528  void ComputeWorldToScreenMatrix();
529 
531  void ComputeOffAxisProjectionFrustum();
532 
534  void ComputeModelViewMatrix();
535 
538  void PartialCopy(vtkCamera *source);
539 
540  double WindowCenter[2];
541  double ObliqueAngles[2];
542  double FocalPoint[3];
543  double Position[3];
544  double ViewUp[3];
545  double ViewAngle;
546  double ClippingRange[2];
547  double EyeAngle;
550  int Stereo;
551  int LeftEye;
552  double Thickness;
553  double Distance;
554  double DirectionOfProjection[3];
555  double ViewPlaneNormal[3];
556  double ViewShear[3];
558 
560 
561  double ScreenBottomLeft[3];
562  double ScreenBottomRight[3];
563  double ScreenTopRight[3];
564 
566 
569 
571 
573 
576 
581 
583 
584  double FocalDisk;
585  //BTX
586  vtkCameraCallbackCommand *UserViewTransformCallbackCommand;
587  friend class vtkCameraCallbackCommand;
588  //ETX
589 
590  // ViewingRaysMtime keeps track of camera modifications which will
591  // change the calculation of viewing rays for the camera before it is
592  // transformed to the camera's location and orientation.
595 
596 private:
597  vtkCamera(const vtkCamera&); // Not implemented.
598  void operator=(const vtkCamera&); // Not implemented.
599 };
600 
601 #endif
vtkHomogeneousTransform * UserTransform
Definition: vtkCamera.h:574
double EyeSeparation
Definition: vtkCamera.h:565
int ParallelProjection
Definition: vtkCamera.h:548
abstract base class for most VTK objects
Definition: vtkObject.h:61
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
void SetViewUp(const double a[3])
Definition: vtkCamera.h:81
superclass for homogeneous transformations
int UseHorizontalViewAngle
Definition: vtkCamera.h:557
record modification and/or execution time
Definition: vtkTimeStamp.h:34
double ViewAngle
Definition: vtkCamera.h:545
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
void SetPosition(const double a[3])
Definition: vtkCamera.h:63
vtkTransform * ViewTransform
Definition: vtkCamera.h:577
double Distance
Definition: vtkCamera.h:553
virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren))
Definition: vtkCamera.h:475
double Thickness
Definition: vtkCamera.h:552
vtkMatrix4x4 * ModelTransformMatrix
Definition: vtkCamera.h:572
supports function callbacks
vtkTimeStamp WorldToScreenMatrixMTime
Definition: vtkCamera.h:568
virtual void PrintSelf(ostream &os, vtkIndent indent)
double ParallelScale
Definition: vtkCamera.h:549
a simple class to control print indentation
Definition: vtkIndent.h:38
a virtual camera for 3D rendering
Definition: vtkCamera.h:48
virtual void Render(vtkRenderer *)
Definition: vtkCamera.h:440
void SetFocalPoint(const double a[3])
Definition: vtkCamera.h:72
vtkMatrix4x4 * WorldToScreenMatrix
Definition: vtkCamera.h:567
vtkCameraCallbackCommand * UserViewTransformCallbackCommand
Definition: vtkCamera.h:586
int LeftEye
Definition: vtkCamera.h:551
vtkTransform * CameraLightTransform
Definition: vtkCamera.h:580
void SetClippingRange(const double a[2])
Definition: vtkCamera.h:208
int UseOffAxisProjection
Definition: vtkCamera.h:559
double FocalDisk
Definition: vtkCamera.h:584
vtkTransform * ModelViewTransform
Definition: vtkCamera.h:582
vtkPerspectiveTransform * Transform
Definition: vtkCamera.h:579
vtkMatrix4x4 * EyeTransformMatrix
Definition: vtkCamera.h:570
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTKRENDERINGCORE_EXPORT
vtkTimeStamp ViewingRaysMTime
Definition: vtkCamera.h:593
int Stereo
Definition: vtkCamera.h:550
vtkHomogeneousTransform * UserViewTransform
Definition: vtkCamera.h:575
double EyeAngle
Definition: vtkCamera.h:547
bool FreezeFocalPoint
Definition: vtkCamera.h:594
static vtkObject * New()
vtkPerspectiveTransform * ProjectionTransform
Definition: vtkCamera.h:578
describes a 4x4 matrix transformation