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=========================================================================*/
35#ifndef vtkCamera_h
36#define vtkCamera_h
37
38#include "vtkObject.h"
39#include "vtkRect.h" // for ivar
40#include "vtkRenderingCoreModule.h" // For export macro
41
43class vtkInformation;
44class vtkMatrix4x4;
46class vtkRenderer;
47class vtkTransform;
49class vtkCameraCallbackCommand;
50
51class VTKRENDERINGCORE_EXPORT vtkCamera : public vtkObject
52{
53public:
54 vtkTypeMacro(vtkCamera, vtkObject);
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
62 static vtkCamera* New();
63
65
69 void SetPosition(double x, double y, double z);
70 void SetPosition(const double a[3]) { 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]) { this->SetFocalPoint(a[0], a[1], a[2]); }
81 vtkGetVector3Macro(FocalPoint, double);
83
85
89 void SetViewUp(double vx, double vy, double vz);
90 void SetViewUp(const double a[3]) { this->SetViewUp(a[0], a[1], a[2]); }
91 vtkGetVector3Macro(ViewUp, double);
93
100
105 void SetDistance(double);
106
108
112 vtkGetMacro(Distance, double);
114
116
121 vtkGetVector3Macro(DirectionOfProjection, double);
123
130 void Dolly(double value);
131
133
136 void SetRoll(double angle);
137 double GetRoll();
139
144 void Roll(double angle);
145
152 void Azimuth(double angle);
153
161 void Yaw(double angle);
162
169 void Elevation(double angle);
170
176 void Pitch(double angle);
177
179
186 vtkGetMacro(ParallelProjection, vtkTypeBool);
187 vtkBooleanMacro(ParallelProjection, vtkTypeBool);
189
191
202 vtkGetMacro(UseHorizontalViewAngle, vtkTypeBool);
203 vtkBooleanMacro(UseHorizontalViewAngle, vtkTypeBool);
205
207
218 void SetViewAngle(double angle);
219 vtkGetMacro(ViewAngle, double);
221
223
232 void SetParallelScale(double scale);
233 vtkGetMacro(ParallelScale, double);
235
243 void Zoom(double factor);
244
246
259 void SetClippingRange(double dNear, double dFar);
260 void SetClippingRange(const double a[2]) { this->SetClippingRange(a[0], a[1]); }
261 vtkGetVector2Macro(ClippingRange, double);
263
265
272 void SetThickness(double);
273 vtkGetMacro(Thickness, double);
275
277
286 void SetWindowCenter(double x, double y);
287 vtkGetVector2Macro(WindowCenter, double);
289
303 void SetObliqueAngles(double alpha, double beta);
304
311
313
318 vtkGetVector3Macro(ViewPlaneNormal, double);
320
322
330 void SetViewShear(double dxdz, double dydz, double center);
331 void SetViewShear(double d[3]);
332 vtkGetVector3Macro(ViewShear, double);
334
336
340 vtkSetMacro(EyeAngle, double);
341 vtkGetMacro(EyeAngle, double);
343
345
351 vtkSetMacro(FocalDisk, double);
352 vtkGetMacro(FocalDisk, double);
354
356
364 vtkSetMacro(FocalDistance, double);
365 vtkGetMacro(FocalDistance, double);
367
369
378 vtkSetMacro(UseOffAxisProjection, vtkTypeBool);
379 vtkGetMacro(UseOffAxisProjection, vtkTypeBool);
380 vtkBooleanMacro(UseOffAxisProjection, vtkTypeBool);
382
384
389 vtkSetVector3Macro(ScreenBottomLeft, double);
390 vtkGetVector3Macro(ScreenBottomLeft, double);
392
394
399 vtkSetVector3Macro(ScreenBottomRight, double);
400 vtkGetVector3Macro(ScreenBottomRight, double);
402
404
409 vtkSetVector3Macro(ScreenTopRight, double);
410 vtkGetVector3Macro(ScreenTopRight, double);
412
414
419 vtkSetMacro(EyeSeparation, double);
420 vtkGetMacro(EyeSeparation, double);
422
424
430 void SetEyePosition(double eyePosition[3]);
431 void GetEyePosition(double eyePosition[3]);
433
438 void GetEyePlaneNormal(double normal[3]);
439
441
448 vtkGetObjectMacro(EyeTransformMatrix, vtkMatrix4x4);
450
457 void SetEyeTransformMatrix(const double elements[16]);
458
460
466 vtkGetObjectMacro(ModelTransformMatrix, vtkMatrix4x4);
468
474 void SetModelTransformMatrix(const double elements[16]);
475
480
485
494
505
513 vtkGetObjectMacro(ExplicitProjectionTransformMatrix, vtkMatrix4x4);
521 vtkSetMacro(UseExplicitProjectionTransformMatrix, bool);
522 vtkGetMacro(UseExplicitProjectionTransformMatrix, bool);
523 vtkBooleanMacro(UseExplicitProjectionTransformMatrix, bool);
531 vtkSetMacro(ExplicitAspectRatio, double);
532 vtkGetMacro(ExplicitAspectRatio, double);
541 vtkSetMacro(UseExplicitAspectRatio, bool);
542 vtkGetMacro(UseExplicitAspectRatio, bool);
543 vtkBooleanMacro(UseExplicitAspectRatio, bool);
556 virtual vtkMatrix4x4* GetProjectionTransformMatrix(double aspect, double nearz, double farz);
557
569 double aspect, double nearz, double farz);
570
583 double aspect, double nearz, double farz);
584
593
595
601 vtkGetObjectMacro(UserViewTransform, vtkHomogeneousTransform);
603
605
611 vtkGetObjectMacro(UserTransform, vtkHomogeneousTransform);
613
619 virtual void Render(vtkRenderer*) {}
620
625
631
642 virtual void GetFrustumPlanes(double aspect, double planes[24]);
643
645
655 virtual void UpdateIdealShiftScale(double aspect);
656 vtkGetVector3Macro(FocalPointShift, double);
657 vtkGetMacro(FocalPointScale, double);
658 vtkGetVector3Macro(NearPlaneShift, double);
659 vtkGetMacro(NearPlaneScale, double);
660 vtkSetMacro(ShiftScaleThreshold, double);
661 vtkGetMacro(ShiftScaleThreshold, double);
663
665
669 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
671
676 void ComputeViewPlaneNormal();
677
683 vtkMatrix4x4* GetCameraLightTransformMatrix();
684
688 virtual void UpdateViewport(vtkRenderer* vtkNotUsed(ren)) {}
689
691
694 vtkGetMacro(Stereo, int);
696
698
701 vtkSetMacro(LeftEye, int);
702 vtkGetMacro(LeftEye, int);
704
712
720
722
727 vtkSetMacro(FreezeFocalPoint, bool);
728 vtkGetMacro(FreezeFocalPoint, bool);
730
732
735 vtkSetMacro(UseScissor, bool);
736 vtkGetMacro(UseScissor, bool);
738
740
743 void SetScissorRect(vtkRecti scissorRect);
744 void GetScissorRect(vtkRecti& scissorRect);
746
748
751 vtkGetObjectMacro(Information, vtkInformation);
754
755protected:
757 ~vtkCamera() override;
758
760
764 virtual void ComputeViewTransform();
766
770 virtual void ComputeProjectionTransform(double aspect, double nearz, double farz);
771
775 void ComputeCompositeProjectionTransform(double aspect, double nearz, double farz);
776
778
784
789
794
802
803 double WindowCenter[2];
804 double ObliqueAngles[2];
805 double FocalPoint[3];
806 double Position[3];
807 double ViewUp[3];
808 double ViewAngle;
809 double ClippingRange[2];
810 double EyeAngle;
815 double Thickness;
816 double Distance;
817 double DirectionOfProjection[3];
818 double ViewPlaneNormal[3];
819 double ViewShear[3];
821
823
824 double ScreenBottomLeft[3];
825 double ScreenBottomRight[3];
826 double ScreenTopRight[3];
827
829
832
834
836
839
842
845
850
852
853 double FocalDisk;
855
856 double FocalPointShift[3];
858 double NearPlaneShift[3];
861
862 vtkCameraCallbackCommand* UserViewTransformCallbackCommand;
863 friend class vtkCameraCallbackCommand;
864
865 // ViewingRaysMtime keeps track of camera modifications which will
866 // change the calculation of viewing rays for the camera before it is
867 // transformed to the camera's location and orientation.
871
873
874 // Arbitrary extra information associated with this camera.
876
877private:
878 vtkCamera(const vtkCamera&) = delete;
879 void operator=(const vtkCamera&) = delete;
880};
881
882#endif
supports function callbacks
a virtual camera for 3D rendering
Definition vtkCamera.h:52
bool UseExplicitProjectionTransformMatrix
Definition vtkCamera.h:841
void ComputeOffAxisProjectionFrustum()
Compute and use frustum using offaxis method.
vtkInformation * Information
Definition vtkCamera.h:875
virtual void SetInformation(vtkInformation *)
Set/Get the information object associated with this camera.
vtkMatrix4x4 * EyeTransformMatrix
Definition vtkCamera.h:833
void Roll(double angle)
Rotate the camera about the direction of projection.
vtkTypeBool ParallelProjection
Definition vtkCamera.h:811
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:848
void ComputeCameraLightTransform()
void SetViewUp(const double a[3])
Set/Get the view up direction for the camera.
Definition vtkCamera.h:90
vtkTransform * ViewTransform
Definition vtkCamera.h:846
double FocalDistance
Definition vtkCamera.h:854
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:857
bool FreezeFocalPoint
Definition vtkCamera.h:869
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:70
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:810
void Azimuth(double angle)
Rotate the camera about the view up vector centered at the focal point.
vtkHomogeneousTransform * UserTransform
Definition vtkCamera.h:837
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:822
vtkMatrix4x4 * ExplicitProjectionTransformMatrix
Definition vtkCamera.h:840
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:859
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:814
double EyeSeparation
Definition vtkCamera.h:828
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:835
void ShallowCopy(vtkCamera *source)
Copy the properties of ‘source’ into ‘this’.
double FocalDisk
Definition vtkCamera.h:853
double Distance
Definition vtkCamera.h:816
bool UseExplicitAspectRatio
Definition vtkCamera.h:844
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:619
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:80
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:815
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:872
vtkMatrix4x4 * WorldToScreenMatrix
Definition vtkCamera.h:830
vtkTransform * CameraLightTransform
Definition vtkCamera.h:849
bool UseScissor
Definition vtkCamera.h:870
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:820
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:831
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:808
void SetViewShear(double d[3])
Set/get the shear transform of the viewing frustum.
double ParallelScale
Definition vtkCamera.h:812
vtkHomogeneousTransform * UserViewTransform
Definition vtkCamera.h:838
vtkPerspectiveTransform * ProjectionTransform
Definition vtkCamera.h:847
vtkCameraCallbackCommand * UserViewTransformCallbackCommand
Definition vtkCamera.h:862
double ShiftScaleThreshold
Definition vtkCamera.h:860
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:851
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:260
vtkTimeStamp ViewingRaysMTime
Definition vtkCamera.h:868
double ExplicitAspectRatio
Definition vtkCamera.h:843
superclass for homogeneous transformations
a simple class to control print indentation
Definition vtkIndent.h:40
Store vtkAlgorithm input/output information.
represent and manipulate 4x4 transformation matrices
abstract base class for most VTK objects
Definition vtkObject.h:63
describes a 4x4 matrix transformation
abstract specification for renderers
Definition vtkRenderer.h:73
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(...)