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 =========================================================================*/
35 #ifndef vtkCamera_h
36 #define vtkCamera_h
37 
38 #include "vtkRenderingCoreModule.h" // For export macro
39 #include "vtkObject.h"
40 #include "vtkRect.h" // for ivar
41 
43 class vtkMatrix4x4;
45 class vtkRenderer;
46 class vtkTransform;
47 class vtkCallbackCommand;
48 class vtkCameraCallbackCommand;
49 
50 class VTKRENDERINGCORE_EXPORT vtkCamera : public vtkObject
51 {
52 public:
53  vtkTypeMacro(vtkCamera, vtkObject);
54  void PrintSelf(ostream& os, vtkIndent indent);
55 
61  static vtkCamera *New();
62 
64 
68  void SetPosition(double x, double y, double z);
69  void SetPosition(const double a[3]) {
70  this->SetPosition(a[0], a[1], a[2]); };
71  vtkGetVector3Macro(Position, double);
73 
75 
79  void SetFocalPoint(double x, double y, double z);
80  void SetFocalPoint(const double a[3]) {
81  this->SetFocalPoint(a[0], a[1], a[2]);};
82  vtkGetVector3Macro(FocalPoint, double);
84 
86 
90  void SetViewUp(double vx, double vy, double vz);
91  void SetViewUp(const double a[3]) {
92  this->SetViewUp(a[0], a[1], a[2]); }
93  vtkGetVector3Macro(ViewUp, double);
95 
102 
107  void SetDistance(double);
108 
110 
114  vtkGetMacro(Distance, double);
116 
118 
123  vtkGetVector3Macro(DirectionOfProjection, double);
125 
132  void Dolly(double value);
133 
135 
138  void SetRoll(double angle);
139  double GetRoll();
141 
146  void Roll(double angle);
147 
154  void Azimuth(double angle);
155 
163  void Yaw(double angle);
164 
171  void Elevation(double angle);
172 
178  void Pitch(double angle);
179 
181 
185  void SetParallelProjection(int flag);
186  vtkGetMacro(ParallelProjection, int);
187  vtkBooleanMacro(ParallelProjection, int);
189 
191 
200  vtkGetMacro(UseHorizontalViewAngle, int);
201  vtkBooleanMacro(UseHorizontalViewAngle, int);
203 
205 
214  void SetViewAngle(double angle);
215  vtkGetMacro(ViewAngle, double);
217 
219 
226  void SetParallelScale(double scale);
227  vtkGetMacro(ParallelScale ,double);
229 
235  void Zoom(double factor);
236 
238 
249  void SetClippingRange(double dNear, double dFar);
250  void SetClippingRange(const double a[2])
251  { this->SetClippingRange(a[0], a[1]); }
252  vtkGetVector2Macro(ClippingRange, double);
254 
256 
261  void SetThickness(double);
262  vtkGetMacro(Thickness, double);
264 
266 
273  void SetWindowCenter(double x, double y);
274  vtkGetVector2Macro(WindowCenter, double);
276 
288  void SetObliqueAngles(double alpha, double beta);
289 
296 
298 
303  vtkGetVector3Macro(ViewPlaneNormal, double);
305 
307 
313  void SetViewShear(double dxdz, double dydz, double center);
314  void SetViewShear(double d[3]);
315  vtkGetVector3Macro(ViewShear, double);
317 
319 
323  vtkSetMacro(EyeAngle, double);
324  vtkGetMacro(EyeAngle, double);
326 
328 
334  vtkSetMacro(FocalDisk, double);
335  vtkGetMacro(FocalDisk, double);
337 
339 
346  vtkSetMacro(UseOffAxisProjection, int);
347  vtkGetMacro(UseOffAxisProjection, int);
348  vtkBooleanMacro(UseOffAxisProjection, int);
350 
352 
357  vtkSetVector3Macro(ScreenBottomLeft, double);
358  vtkGetVector3Macro(ScreenBottomLeft, double);
360 
362 
367  vtkSetVector3Macro(ScreenBottomRight, double);
368  vtkGetVector3Macro(ScreenBottomRight, double);
370 
372 
377  vtkSetVector3Macro(ScreenTopRight, double);
378  vtkGetVector3Macro(ScreenTopRight, double);
380 
382 
387  vtkSetMacro(EyeSeparation, double);
388  vtkGetMacro(EyeSeparation, double);
390 
392 
398  void SetEyePosition(double eyePosition[3]);
399  void GetEyePosition(double eyePosition[3]);
401 
406  void GetEyePlaneNormal(double normal[3]);
407 
409 
416  vtkGetObjectMacro(EyeTransformMatrix, vtkMatrix4x4);
418 
425  void SetEyeTransformMatrix(const double elements[16]);
426 
428 
434  vtkGetObjectMacro(ModelTransformMatrix, vtkMatrix4x4);
436 
442  void SetModelTransformMatrix(const double elements[16]);
443 
448 
453 
462 
473 
483  double nearz,
484  double farz);
485 
495  double nearz,
496  double farz);
497 
508  double nearz,
509  double farz);
510 
518 
520 
526  vtkGetObjectMacro(UserViewTransform,vtkHomogeneousTransform);
528 
530 
536  vtkGetObjectMacro(UserTransform,vtkHomogeneousTransform);
538 
544  virtual void Render(vtkRenderer *) {}
545 
550 
556 
566  virtual void GetFrustumPlanes(double aspect, double planes[24]);
567 
569 
572  double *GetOrientation();
575 
581 
588 
592  virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren)) {}
593 
595 
598  vtkSetMacro(LeftEye, int);
599  vtkGetMacro(LeftEye, int);
601 
609 
617 
619 
624  vtkSetMacro(FreezeFocalPoint, bool);
625  vtkGetMacro(FreezeFocalPoint, bool);
627 
629 
632  vtkSetMacro(UseScissor, bool);
633  vtkGetMacro(UseScissor, bool);
635 
637 
640  void SetScissorRect(vtkRecti scissorRect);
641  void GetScissorRect(vtkRecti& scissorRect);
643 
644 protected:
647 
649 
653  virtual void ComputeViewTransform();
655 
659  virtual void ComputeProjectionTransform(double aspect,
660  double nearz,
661  double farz);
662 
667  double nearz,
668  double farz);
669 
671 
672 
678 
683 
688 
696 
697  double WindowCenter[2];
698  double ObliqueAngles[2];
699  double FocalPoint[3];
700  double Position[3];
701  double ViewUp[3];
702  double ViewAngle;
703  double ClippingRange[2];
704  double EyeAngle;
707  int Stereo;
708  int LeftEye;
709  double Thickness;
710  double Distance;
711  double DirectionOfProjection[3];
712  double ViewPlaneNormal[3];
713  double ViewShear[3];
715 
717 
718  double ScreenBottomLeft[3];
719  double ScreenBottomRight[3];
720  double ScreenTopRight[3];
721 
723 
726 
728 
730 
733 
738 
740 
741  double FocalDisk;
742 
743  vtkCameraCallbackCommand *UserViewTransformCallbackCommand;
744  friend class vtkCameraCallbackCommand;
745 
746  // ViewingRaysMtime keeps track of camera modifications which will
747  // change the calculation of viewing rays for the camera before it is
748  // transformed to the camera's location and orientation.
752 
754 
755 
756 private:
757  vtkCamera(const vtkCamera&) VTK_DELETE_FUNCTION;
758  void operator=(const vtkCamera&) VTK_DELETE_FUNCTION;
759 };
760 
761 #endif
supports function callbacks
a virtual camera for 3D rendering
Definition: vtkCamera.h:51
void ComputeOffAxisProjectionFrustum()
Compute and use frustum using offaxis method.
vtkMatrix4x4 * EyeTransformMatrix
Definition: vtkCamera.h:727
void Roll(double angle)
Rotate the camera about the direction of projection.
void ApplyTransform(vtkTransform *t)
Apply a transform to the camera.
void SetModelTransformMatrix(vtkMatrix4x4 *matrix)
Set/Get model transformation matrix.
double GetRoll()
vtkPerspectiveTransform * Transform
Definition: vtkCamera.h:736
void ComputeCameraLightTransform()
void SetViewUp(const double a[3])
Definition: vtkCamera.h:91
vtkTransform * ViewTransform
Definition: vtkCamera.h:734
void SetUserTransform(vtkHomogeneousTransform *transform)
In addition to the instance variables such as position and orientation, you can add an additional tra...
virtual void ComputeViewTransform()
bool FreezeFocalPoint
Definition: vtkCamera.h:750
void SetEyePosition(double eyePosition[3])
Set/Get the eye position (center point between two eyes).
void SetPosition(const double a[3])
Definition: vtkCamera.h:69
virtual vtkMatrix4x4 * GetViewTransformMatrix()
For backward compatibility.
void Yaw(double angle)
Rotate the focal point about the view up vector, using the camera's position as the center of rotatio...
void SetRoll(double angle)
Set the roll angle of the camera about the direction of projection.
void PartialCopy(vtkCamera *source)
Copy the ivars.
void Elevation(double angle)
Rotate the camera about the cross product of the negative of the direction of projection and the view...
double EyeAngle
Definition: vtkCamera.h:704
void Azimuth(double angle)
Rotate the camera about the view up vector centered at the focal point.
vtkHomogeneousTransform * UserTransform
Definition: vtkCamera.h:731
void DeepCopy(vtkCamera *source)
Copy the properties of ‘source’ into ‘this’.
virtual vtkMatrix4x4 * GetProjectionTransformMatrix(double aspect, double nearz, double farz)
Return the projection transform matrix, which converts from camera coordinates to viewport coordinate...
void Pitch(double angle)
Rotate the focal point about the cross product of the view up vector and the direction of projection,...
void SetObliqueAngles(double alpha, double beta)
Get/Set the oblique viewing angles.
void ComputeModelViewMatrix()
Compute model view matrix for the camera.
int LeftEye
Definition: vtkCamera.h:708
double EyeSeparation
Definition: vtkCamera.h:722
virtual void GetFrustumPlanes(double aspect, double planes[24])
Get the plane equations that bound the view frustum.
void Zoom(double factor)
In perspective mode, decrease the view angle by the specified factor.
void SetPosition(double x, double y, double z)
Set/Get the position of the camera in world coordinates.
void SetViewUp(double vx, double vy, double vz)
Set/Get the view up direction for the camera.
double * GetOrientationWXYZ()
double * GetOrientation()
Get the orientation of the camera.
vtkMatrix4x4 * ModelTransformMatrix
Definition: vtkCamera.h:729
void ShallowCopy(vtkCamera *source)
Copy the properties of ‘source’ into ‘this’.
static vtkCamera * New()
Construct camera instance with its focal point at the origin, and position=(0,0,1).
double FocalDisk
Definition: vtkCamera.h:741
void ComputeViewPlaneNormal()
This method is called automatically whenever necessary, it should never be used outside of vtkCamera....
double Distance
Definition: vtkCamera.h:710
void SetModelTransformMatrix(const double elements[16])
Set model transformation matrix.
void SetClippingRange(double dNear, double dFar)
Set/Get the location of the near and far clipping planes along the direction of projection.
void SetThickness(double)
Set the distance between clipping planes.
void GetScissorRect(vtkRecti &scissorRect)
virtual void Render(vtkRenderer *)
This method causes the camera to set up whatever is required for viewing the scene.
Definition: vtkCamera.h:544
void ViewingRaysModified()
Mark that something has changed which requires the view rays to be recomputed.
vtkMatrix4x4 * GetCameraLightTransformMatrix()
Returns a transformation matrix for a coordinate frame attached to the camera, where the camera is lo...
void SetFocalPoint(const double a[3])
Definition: vtkCamera.h:80
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetEyeTransformMatrix(vtkMatrix4x4 *matrix)
Set/Get eye transformation matrix.
int UseHorizontalViewAngle
Definition: vtkCamera.h:714
void GetEyePosition(double eyePosition[3])
void SetDistance(double)
Move the focal point so that it is the specified distance from the camera position.
virtual vtkTransform * GetModelViewTransformObject()
Return the model view transform.
void SetWindowCenter(double x, double y)
Set/Get the center of the window in viewport coordinates.
void SetEyeTransformMatrix(const double elements[16])
Set the eye transform matrix.
double Thickness
Definition: vtkCamera.h:709
void SetScissorRect(vtkRecti scissorRect)
Set/Get the vtkRect value of the scissor.
virtual vtkMatrix4x4 * GetProjectionTransformMatrix(vtkRenderer *ren)
Return the projection transform matrix, which converts from camera coordinates to viewport coordinate...
void ComputeCompositeProjectionTransform(double aspect, double nearz, double farz)
These methods should only be used within vtkCamera.cxx.
vtkRecti ScissorRect
Definition: vtkCamera.h:753
vtkMatrix4x4 * WorldToScreenMatrix
Definition: vtkCamera.h:724
virtual vtkMatrix4x4 * GetModelViewTransformMatrix()
Return the model view matrix of model view transform.
int ParallelProjection
Definition: vtkCamera.h:705
vtkTransform * CameraLightTransform
Definition: vtkCamera.h:737
bool UseScissor
Definition: vtkCamera.h:751
void SetViewAngle(double angle)
Set/Get the camera view angle, which is the angular height of the camera view measured in degrees.
void GetEyePlaneNormal(double normal[3])
Get normal vector from eye to screen rotated by EyeTransformMatrix.
void ComputeWorldToScreenMatrix()
Given screen screen top, bottom left and top right calculate screen rotation.
void OrthogonalizeViewUp()
Recompute the ViewUp vector to force it to be perpendicular to camera->focalpoint vector.
vtkTimeStamp WorldToScreenMatrixMTime
Definition: vtkCamera.h:725
void Dolly(double value)
Divide the camera's distance from the focal point by the given dolly value.
vtkMTimeType GetViewingRaysMTime()
Return the MTime that concerns recomputing the view rays of the camera.
void SetFocalPoint(double x, double y, double z)
Set/Get the focal of the camera in world coordinates.
int Stereo
Definition: vtkCamera.h:707
virtual vtkMatrix4x4 * GetCompositeProjectionTransformMatrix(double aspect, double nearz, double farz)
Return the concatenation of the ViewTransform and the ProjectionTransform.
void SetParallelScale(double scale)
Set/Get the scaling used for a parallel projection, i.e.
double ViewAngle
Definition: vtkCamera.h:702
void SetViewShear(double d[3])
double ParallelScale
Definition: vtkCamera.h:706
vtkHomogeneousTransform * UserViewTransform
Definition: vtkCamera.h:732
int UseOffAxisProjection
Definition: vtkCamera.h:716
vtkPerspectiveTransform * ProjectionTransform
Definition: vtkCamera.h:735
vtkCameraCallbackCommand * UserViewTransformCallbackCommand
Definition: vtkCamera.h:743
virtual void UpdateViewport(vtkRenderer *vtkNotUsed(ren))
Update the viewport.
Definition: vtkCamera.h:592
virtual void ComputeProjectionTransform(double aspect, double nearz, double farz)
These methods should only be used within vtkCamera.cxx.
void SetParallelProjection(int flag)
Set/Get the value of the ParallelProjection instance variable.
void SetUserViewTransform(vtkHomogeneousTransform *transform)
In addition to the instance variables such as position and orientation, you can add an additional tra...
void ComputeDistance()
These methods should only be used within vtkCamera.cxx.
virtual vtkTransform * GetViewTransformObject()
For backward compatibility.
void SetUseHorizontalViewAngle(int flag)
Set/Get the value of the UseHorizontalViewAngle instance variable.
void SetViewShear(double dxdz, double dydz, double center)
Set/get the shear transform of the viewing frustum.
virtual vtkPerspectiveTransform * GetProjectionTransformObject(double aspect, double nearz, double farz)
Return the projection transform matrix, which converts from camera coordinates to viewport coordinate...
vtkTransform * ModelViewTransform
Definition: vtkCamera.h:739
void SetClippingRange(const double a[2])
Definition: vtkCamera.h:250
vtkTimeStamp ViewingRaysMTime
Definition: vtkCamera.h:749
superclass for homogeneous transformations
a simple class to control print indentation
Definition: vtkIndent.h:40
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
abstract base class for most VTK objects
Definition: vtkObject.h:60
describes a 4x4 matrix transformation
abstract specification for renderers
Definition: vtkRenderer.h:64
record modification and/or execution time
Definition: vtkTimeStamp.h:36
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
@ value
Definition: vtkX3D.h:220
@ scale
Definition: vtkX3D.h:229
@ center
Definition: vtkX3D.h:230
@ alpha
Definition: vtkX3D.h:250
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248