VTK  9.2.6
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=========================================================================*/
44#ifndef vtkCamera_h
45#define vtkCamera_h
46
47#include "vtkObject.h"
48#include "vtkRect.h" // for ivar
49#include "vtkRenderingCoreModule.h" // For export macro
50
52class vtkInformation;
53class vtkMatrix4x4;
55class vtkRenderer;
56class vtkTransform;
58class vtkCameraCallbackCommand;
59
60class VTKRENDERINGCORE_EXPORT vtkCamera : public vtkObject
61{
62public:
63 vtkTypeMacro(vtkCamera, vtkObject);
64 void PrintSelf(ostream& os, vtkIndent indent) override;
65
71 static vtkCamera* New();
72
74
78 void SetPosition(double x, double y, double z);
79 void SetPosition(const double a[3]) { this->SetPosition(a[0], a[1], a[2]); }
80 vtkGetVector3Macro(Position, double);
82
84
88 void SetFocalPoint(double x, double y, double z);
89 void SetFocalPoint(const double a[3]) { this->SetFocalPoint(a[0], a[1], a[2]); }
90 vtkGetVector3Macro(FocalPoint, double);
92
94
98 void SetViewUp(double vx, double vy, double vz);
99 void SetViewUp(const double a[3]) { this->SetViewUp(a[0], a[1], a[2]); }
100 vtkGetVector3Macro(ViewUp, double);
102
109
114 void SetDistance(double);
115
117
121 vtkGetMacro(Distance, double);
123
125
130 vtkGetVector3Macro(DirectionOfProjection, double);
132
139 void Dolly(double value);
140
142
145 void SetRoll(double angle);
146 double GetRoll();
148
153 void Roll(double angle);
154
161 void Azimuth(double angle);
162
170 void Yaw(double angle);
171
178 void Elevation(double angle);
179
185 void Pitch(double angle);
186
188
195 vtkGetMacro(ParallelProjection, vtkTypeBool);
196 vtkBooleanMacro(ParallelProjection, vtkTypeBool);
198
200
211 vtkGetMacro(UseHorizontalViewAngle, vtkTypeBool);
212 vtkBooleanMacro(UseHorizontalViewAngle, vtkTypeBool);
214
216
227 void SetViewAngle(double angle);
228 vtkGetMacro(ViewAngle, double);
230
232
241 void SetParallelScale(double scale);
242 vtkGetMacro(ParallelScale, double);
244
252 void Zoom(double factor);
253
255
268 void SetClippingRange(double dNear, double dFar);
269 void SetClippingRange(const double a[2]) { this->SetClippingRange(a[0], a[1]); }
270 vtkGetVector2Macro(ClippingRange, double);
272
274
281 void SetThickness(double);
282 vtkGetMacro(Thickness, double);
284
286
295 void SetWindowCenter(double x, double y);
296 vtkGetVector2Macro(WindowCenter, double);
298
312 void SetObliqueAngles(double alpha, double beta);
313
320
322
327 vtkGetVector3Macro(ViewPlaneNormal, double);
329
331
339 void SetViewShear(double dxdz, double dydz, double center);
340 void SetViewShear(double d[3]);
341 vtkGetVector3Macro(ViewShear, double);
343
345
349 vtkSetMacro(EyeAngle, double);
350 vtkGetMacro(EyeAngle, double);
352
354
360 vtkSetMacro(FocalDisk, double);
361 vtkGetMacro(FocalDisk, double);
363
365
373 vtkSetMacro(FocalDistance, double);
374 vtkGetMacro(FocalDistance, double);
376
378
387 vtkSetMacro(UseOffAxisProjection, vtkTypeBool);
388 vtkGetMacro(UseOffAxisProjection, vtkTypeBool);
389 vtkBooleanMacro(UseOffAxisProjection, vtkTypeBool);
391
393
398 vtkSetVector3Macro(ScreenBottomLeft, double);
399 vtkGetVector3Macro(ScreenBottomLeft, double);
401
403
408 vtkSetVector3Macro(ScreenBottomRight, double);
409 vtkGetVector3Macro(ScreenBottomRight, double);
411
413
418 vtkSetVector3Macro(ScreenTopRight, double);
419 vtkGetVector3Macro(ScreenTopRight, double);
421
423
428 vtkSetMacro(EyeSeparation, double);
429 vtkGetMacro(EyeSeparation, double);
431
433
439 void SetEyePosition(double eyePosition[3]);
440 void GetEyePosition(double eyePosition[3]);
442
447 void GetEyePlaneNormal(double normal[3]);
448
450
457 vtkGetObjectMacro(EyeTransformMatrix, vtkMatrix4x4);
459
466 void SetEyeTransformMatrix(const double elements[16]);
467
469
475 vtkGetObjectMacro(ModelTransformMatrix, vtkMatrix4x4);
477
483 void SetModelTransformMatrix(const double elements[16]);
484
489
494
503
514
522 vtkGetObjectMacro(ExplicitProjectionTransformMatrix, vtkMatrix4x4);
530 vtkSetMacro(UseExplicitProjectionTransformMatrix, bool);
531 vtkGetMacro(UseExplicitProjectionTransformMatrix, bool);
532 vtkBooleanMacro(UseExplicitProjectionTransformMatrix, bool);
540 vtkSetMacro(ExplicitAspectRatio, double);
541 vtkGetMacro(ExplicitAspectRatio, double);
550 vtkSetMacro(UseExplicitAspectRatio, bool);
551 vtkGetMacro(UseExplicitAspectRatio, bool);
552 vtkBooleanMacro(UseExplicitAspectRatio, bool);
565 virtual vtkMatrix4x4* GetProjectionTransformMatrix(double aspect, double nearz, double farz);
566
578 double aspect, double nearz, double farz);
579
592 double aspect, double nearz, double farz);
593
602
604
610 vtkGetObjectMacro(UserViewTransform, vtkHomogeneousTransform);
612
614
620 vtkGetObjectMacro(UserTransform, vtkHomogeneousTransform);
622
628 virtual void Render(vtkRenderer*) {}
629
634
640
651 virtual void GetFrustumPlanes(double aspect, double planes[24]);
652
654
664 virtual void UpdateIdealShiftScale(double aspect);
665 vtkGetVector3Macro(FocalPointShift, double);
666 vtkGetMacro(FocalPointScale, double);
667 vtkGetVector3Macro(NearPlaneShift, double);
668 vtkGetMacro(NearPlaneScale, double);
669 vtkSetMacro(ShiftScaleThreshold, double);
670 vtkGetMacro(ShiftScaleThreshold, double);
672
674
678 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
680
685 void ComputeViewPlaneNormal();
686
692 vtkMatrix4x4* GetCameraLightTransformMatrix();
693
697 virtual void UpdateViewport(vtkRenderer* vtkNotUsed(ren)) {}
698
700
703 vtkGetMacro(Stereo, int);
705
707
710 vtkSetMacro(LeftEye, int);
711 vtkGetMacro(LeftEye, int);
713
721
729
731
736 vtkSetMacro(FreezeFocalPoint, bool);
737 vtkGetMacro(FreezeFocalPoint, bool);
739
741
744 vtkSetMacro(UseScissor, bool);
745 vtkGetMacro(UseScissor, bool);
747
749
752 void SetScissorRect(vtkRecti scissorRect);
753 void GetScissorRect(vtkRecti& scissorRect);
755
757
760 vtkGetObjectMacro(Information, vtkInformation);
763
764protected:
766 ~vtkCamera() override;
767
769
773 virtual void ComputeViewTransform();
775
779 virtual void ComputeProjectionTransform(double aspect, double nearz, double farz);
780
784 void ComputeCompositeProjectionTransform(double aspect, double nearz, double farz);
785
787
793
798
803
811
812 double WindowCenter[2];
813 double ObliqueAngles[2];
814 double FocalPoint[3];
815 double Position[3];
816 double ViewUp[3];
817 double ViewAngle;
818 double ClippingRange[2];
819 double EyeAngle;
824 double Thickness;
825 double Distance;
826 double DirectionOfProjection[3];
827 double ViewPlaneNormal[3];
828 double ViewShear[3];
830
832
833 double ScreenBottomLeft[3];
834 double ScreenBottomRight[3];
835 double ScreenTopRight[3];
836
838
841
843
845
848
851
854
859
861
862 double FocalDisk;
864
865 double FocalPointShift[3];
867 double NearPlaneShift[3];
870
871 vtkCameraCallbackCommand* UserViewTransformCallbackCommand;
872 friend class vtkCameraCallbackCommand;
873
874 // ViewingRaysMtime keeps track of camera modifications which will
875 // change the calculation of viewing rays for the camera before it is
876 // transformed to the camera's location and orientation.
880
882
883 // Arbitrary extra information associated with this camera.
885
886private:
887 vtkCamera(const vtkCamera&) = delete;
888 void operator=(const vtkCamera&) = delete;
889};
890
891#endif
supports function callbacks
a virtual camera for 3D rendering
Definition vtkCamera.h:61
bool UseExplicitProjectionTransformMatrix
Definition vtkCamera.h:850
void ComputeOffAxisProjectionFrustum()
Compute and use frustum using offaxis method.
vtkInformation * Information
Definition vtkCamera.h:884
virtual void SetInformation(vtkInformation *)
Set/Get the information object associated with this camera.
vtkMatrix4x4 * EyeTransformMatrix
Definition vtkCamera.h:842
void Roll(double angle)
Rotate the camera about the direction of projection.
vtkTypeBool ParallelProjection
Definition vtkCamera.h:820
virtual vtkMatrix4x4 * GetViewTransformMatrix()
For backward compatibility.
void ApplyTransform(vtkTransform *t)
Apply a transform to the camera.
void SetModelTransformMatrix(vtkMatrix4x4 *matrix)
Set/Get model transformation matrix.
double GetRoll()
Set the roll angle of the camera about the direction of projection.
double * GetOrientation()
Get the orientation of the camera.
vtkPerspectiveTransform * Transform
Definition vtkCamera.h:857
void ComputeCameraLightTransform()
void SetViewUp(const double a[3])
Set/Get the view up direction for the camera.
Definition vtkCamera.h:99
vtkTransform * ViewTransform
Definition vtkCamera.h:855
double FocalDistance
Definition vtkCamera.h:863
void SetUserTransform(vtkHomogeneousTransform *transform)
In addition to the instance variables such as position and orientation, you can add an additional tra...
virtual void ComputeViewTransform()
These methods should only be used within vtkCamera.cxx.
double FocalPointScale
Definition vtkCamera.h:866
bool FreezeFocalPoint
Definition vtkCamera.h:878
void SetEyePosition(double eyePosition[3])
Set/Get the eye position (center point between two eyes).
void SetPosition(const double a[3])
Set/Get the position of the camera in world coordinates.
Definition vtkCamera.h:79
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:819
void Azimuth(double angle)
Rotate the camera about the view up vector centered at the focal point.
vtkHomogeneousTransform * UserTransform
Definition vtkCamera.h:846
void DeepCopy(vtkCamera *source)
Copy the properties of ‘source’ into ‘this’.
void Pitch(double angle)
Rotate the focal point about the cross product of the view up vector and the direction of projection,...
vtkTypeBool UseOffAxisProjection
Definition vtkCamera.h:831
vtkMatrix4x4 * ExplicitProjectionTransformMatrix
Definition vtkCamera.h:849
void SetObliqueAngles(double alpha, double beta)
Get/Set the oblique viewing angles.
virtual vtkMatrix4x4 * GetProjectionTransformMatrix(vtkRenderer *ren)
Return the projection transform matrix, which converts from camera coordinates to viewport coordinate...
double NearPlaneScale
Definition vtkCamera.h:868
void SetParallelProjection(vtkTypeBool flag)
Set/Get the value of the ParallelProjection instance variable.
void ComputeModelViewMatrix()
Compute model view matrix for the camera.
int LeftEye
Definition vtkCamera.h:823
double EyeSeparation
Definition vtkCamera.h:837
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.
vtkMatrix4x4 * ModelTransformMatrix
Definition vtkCamera.h:844
void ShallowCopy(vtkCamera *source)
Copy the properties of ‘source’ into ‘this’.
double FocalDisk
Definition vtkCamera.h:862
double Distance
Definition vtkCamera.h:825
bool UseExplicitAspectRatio
Definition vtkCamera.h:853
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.
virtual vtkMatrix4x4 * GetModelViewTransformMatrix()
Return the model view matrix of model view transform.
void SetThickness(double)
Set the distance between clipping planes.
void GetScissorRect(vtkRecti &scissorRect)
Set/Get the vtkRect value of the scissor.
virtual void Render(vtkRenderer *)
This method causes the camera to set up whatever is required for viewing the scene.
Definition vtkCamera.h:628
void ViewingRaysModified()
Mark that something has changed which requires the view rays to be recomputed.
static vtkCamera * New()
Construct camera instance with its focal point at the origin, and position=(0,0,1).
void SetFocalPoint(const double a[3])
Set/Get the focal of the camera in world coordinates.
Definition vtkCamera.h:89
void SetEyeTransformMatrix(vtkMatrix4x4 *matrix)
Set/Get eye transformation matrix.
void GetEyePosition(double eyePosition[3])
Set/Get the eye position (center point between two eyes).
void SetDistance(double)
Move the focal point so that it is the specified distance from the camera position.
virtual vtkPerspectiveTransform * GetProjectionTransformObject(double aspect, double nearz, double farz)
Return the projection transform matrix, which converts from camera coordinates to viewport coordinate...
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:824
void SetScissorRect(vtkRecti scissorRect)
Set/Get the vtkRect value of the scissor.
virtual vtkMatrix4x4 * GetCompositeProjectionTransformMatrix(double aspect, double nearz, double farz)
Return the concatenation of the ViewTransform and the ProjectionTransform.
void ComputeCompositeProjectionTransform(double aspect, double nearz, double farz)
These methods should only be used within vtkCamera.cxx.
vtkRecti ScissorRect
Definition vtkCamera.h:881
vtkMatrix4x4 * WorldToScreenMatrix
Definition vtkCamera.h:839
vtkTransform * CameraLightTransform
Definition vtkCamera.h:858
bool UseScissor
Definition vtkCamera.h:879
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.
vtkTypeBool UseHorizontalViewAngle
Definition vtkCamera.h:829
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:840
void Dolly(double value)
Divide the camera's distance from the focal point by the given dolly value.
virtual void SetExplicitProjectionTransformMatrix(vtkMatrix4x4 *)
Set/get an explicit 4x4 projection matrix to use, rather than computing one from other state variable...
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.
void SetUseHorizontalViewAngle(vtkTypeBool flag)
Set/Get the value of the UseHorizontalViewAngle instance variable.
~vtkCamera() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetParallelScale(double scale)
Set/Get the scaling used for a parallel projection, i.e.
virtual vtkTransform * GetViewTransformObject()
For backward compatibility.
double ViewAngle
Definition vtkCamera.h:817
void SetViewShear(double d[3])
Set/get the shear transform of the viewing frustum.
double ParallelScale
Definition vtkCamera.h:821
vtkHomogeneousTransform * UserViewTransform
Definition vtkCamera.h:847
vtkPerspectiveTransform * ProjectionTransform
Definition vtkCamera.h:856
vtkCameraCallbackCommand * UserViewTransformCallbackCommand
Definition vtkCamera.h:871
double ShiftScaleThreshold
Definition vtkCamera.h:869
virtual vtkTransform * GetModelViewTransformObject()
Return the model view transform.
virtual void ComputeProjectionTransform(double aspect, double nearz, double farz)
These methods should only be used within vtkCamera.cxx.
virtual vtkMatrix4x4 * GetProjectionTransformMatrix(double aspect, double nearz, double farz)
Return the projection transform matrix, which converts from camera coordinates to viewport coordinate...
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.
void SetViewShear(double dxdz, double dydz, double center)
Set/get the shear transform of the viewing frustum.
virtual void UpdateIdealShiftScale(double aspect)
The following methods are used to support view dependent methods for normalizing data (typically poin...
vtkTransform * ModelViewTransform
Definition vtkCamera.h:860
void SetClippingRange(const double a[2])
Set/Get the location of the near and far clipping planes along the direction of projection.
Definition vtkCamera.h:269
vtkTimeStamp ViewingRaysMTime
Definition vtkCamera.h:877
double ExplicitAspectRatio
Definition vtkCamera.h:852
superclass for homogeneous transformations
a simple class to control print indentation
Definition vtkIndent.h:49
Store vtkAlgorithm input/output information.
represent and manipulate 4x4 transformation matrices
abstract base class for most VTK objects
Definition vtkObject.h:72
describes a 4x4 matrix transformation
abstract specification for renderers
Definition vtkRenderer.h:82
record modification and/or execution time
describes linear transformations via a 4x4 matrix
int vtkTypeBool
Definition vtkABI.h:69
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287
#define VTK_SIZEHINT(...)