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:
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 
413 
415 
419  void SetUserViewTransform(vtkHomogeneousTransform *transform);
420  vtkGetObjectMacro(UserViewTransform,vtkHomogeneousTransform);
422 
424 
428  void SetUserTransform(vtkHomogeneousTransform *transform);
431 
435  virtual void Render(vtkRenderer *) {}
436 
439  unsigned long GetViewingRaysMTime();
440 
443  void ViewingRaysModified();
444 
452  virtual void GetFrustumPlanes(double aspect, double planes[24]);
453 
455 
456  double *GetOrientation();
457  double *GetOrientationWXYZ();
459 
462  void ComputeViewPlaneNormal();
463 
467  vtkMatrix4x4 *GetCameraLightTransformMatrix();
468 
470  virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
471 
473 
474  vtkSetMacro(LeftEye, int);
475  vtkGetMacro(LeftEye, int);
477 
480  void ShallowCopy(vtkCamera *source);
481 
484  void DeepCopy(vtkCamera *source);
485 
487 
490  vtkSetMacro(FreezeFocalPoint, bool);
491  vtkGetMacro(FreezeFocalPoint, bool);
493 
494 protected:
495  vtkCamera();
496  ~vtkCamera();
497 
499 
500  void ComputeDistance();
501  void ComputeViewTransform();
503 
505 
506  void ComputeProjectionTransform(double aspect,
507  double nearz,
508  double farz);
510 
512 
513  void ComputeCompositeProjectionTransform(double aspect,
514  double nearz,
515  double farz);
517 
518  void ComputeCameraLightTransform();
519 
520 
523  void ComputeWorldToScreenMatrix();
524 
526  void ComputeOffAxisProjectionFrustum();
527 
529  void ComputeModelViewMatrix();
530 
533  void PartialCopy(vtkCamera *source);
534 
535  double WindowCenter[2];
536  double ObliqueAngles[2];
537  double FocalPoint[3];
538  double Position[3];
539  double ViewUp[3];
540  double ViewAngle;
541  double ClippingRange[2];
542  double EyeAngle;
545  int Stereo;
546  int LeftEye;
547  double Thickness;
548  double Distance;
549  double DirectionOfProjection[3];
550  double ViewPlaneNormal[3];
551  double ViewShear[3];
553 
555 
556  double ScreenBottomLeft[3];
557  double ScreenBottomRight[3];
558  double ScreenTopRight[3];
559 
561 
564 
566 
568 
571 
576 
578 
579  double FocalDisk;
580  //BTX
581  vtkCameraCallbackCommand *UserViewTransformCallbackCommand;
582  friend class vtkCameraCallbackCommand;
583  //ETX
584 
585  // ViewingRaysMtime keeps track of camera modifications which will
586  // change the calculation of viewing rays for the camera before it is
587  // transformed to the camera's location and orientation.
590 
591 private:
592  vtkCamera(const vtkCamera&); // Not implemented.
593  void operator=(const vtkCamera&); // Not implemented.
594 };
595 
596 #endif
#define vtkNotUsed(x)
Definition: vtkSetGet.h:547
GLuint GLenum GLenum transform
Definition: vtkgl.h:16451
vtkHomogeneousTransform * UserTransform
Definition: vtkCamera.h:569
double EyeSeparation
Definition: vtkCamera.h:560
int ParallelProjection
Definition: vtkCamera.h:543
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
GLenum GLenum GLenum GLenum GLenum scale
Definition: vtkgl.h:15942
int UseHorizontalViewAngle
Definition: vtkCamera.h:552
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
record modification and/or execution time
Definition: vtkTimeStamp.h:34
double ViewAngle
Definition: vtkCamera.h:540
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
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
GLdouble GLdouble t
Definition: vtkgl.h:11602
void SetPosition(const double a[3])
Definition: vtkCamera.h:63
vtkTransform * ViewTransform
Definition: vtkCamera.h:572
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
double Distance
Definition: vtkCamera.h:548
virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren))
Definition: vtkCamera.h:470
GLuint GLenum matrix
Definition: vtkgl.h:16451
double Thickness
Definition: vtkCamera.h:547
GLdouble GLdouble z
Definition: vtkgl.h:11754
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkMatrix4x4 * ModelTransformMatrix
Definition: vtkCamera.h:567
supports function callbacks
vtkTimeStamp WorldToScreenMatrixMTime
Definition: vtkCamera.h:563
virtual void PrintSelf(ostream &os, vtkIndent indent)
double ParallelScale
Definition: vtkCamera.h:544
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:435
void SetFocalPoint(const double a[3])
Definition: vtkCamera.h:72
vtkMatrix4x4 * WorldToScreenMatrix
Definition: vtkCamera.h:562
#define vtkGetVector3Macro(name, type)
Definition: vtkSetGet.h:294
vtkCameraCallbackCommand * UserViewTransformCallbackCommand
Definition: vtkCamera.h:581
int LeftEye
Definition: vtkCamera.h:546
vtkTransform * CameraLightTransform
Definition: vtkCamera.h:575
void SetClippingRange(const double a[2])
Definition: vtkCamera.h:208
int UseOffAxisProjection
Definition: vtkCamera.h:554
double FocalDisk
Definition: vtkCamera.h:579
vtkTransform * ModelViewTransform
Definition: vtkCamera.h:577
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
vtkPerspectiveTransform * Transform
Definition: vtkCamera.h:574
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
vtkMatrix4x4 * EyeTransformMatrix
Definition: vtkCamera.h:565
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define vtkGetVector2Macro(name, type)
Definition: vtkSetGet.h:260
#define VTKRENDERINGCORE_EXPORT
vtkTimeStamp ViewingRaysMTime
Definition: vtkCamera.h:588
int Stereo
Definition: vtkCamera.h:545
vtkHomogeneousTransform * UserViewTransform
Definition: vtkCamera.h:570
double EyeAngle
Definition: vtkCamera.h:542
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
bool FreezeFocalPoint
Definition: vtkCamera.h:589
GLclampf GLclampf GLclampf alpha
Definition: vtkgl.h:11313
static vtkObject * New()
#define vtkSetVector3Macro(name, type)
Definition: vtkSetGet.h:277
vtkPerspectiveTransform * ProjectionTransform
Definition: vtkCamera.h:573
GLfloat angle
Definition: vtkgl.h:18174
describes a 4x4 matrix transformation
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69