VTK  9.5.2
vtkCamera.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
23#ifndef vtkCamera_h
24#define vtkCamera_h
25
26#include "vtkObject.h"
27#include "vtkRect.h" // for ivar
28#include "vtkRenderingCoreModule.h" // For export macro
29#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
30
31VTK_ABI_NAMESPACE_BEGIN
33class vtkInformation;
34class vtkMatrix4x4;
36class vtkRenderer;
37class vtkTransform;
39class vtkCameraCallbackCommand;
40
41class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkCamera : public vtkObject
42{
43public:
44 vtkTypeMacro(vtkCamera, vtkObject);
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
52 static vtkCamera* New();
53
55
59 void SetPosition(double x, double y, double z);
60 void SetPosition(const double a[3]) { this->SetPosition(a[0], a[1], a[2]); }
61 vtkGetVector3Macro(Position, double);
63
65
69 void SetFocalPoint(double x, double y, double z);
70 void SetFocalPoint(const double a[3]) { this->SetFocalPoint(a[0], a[1], a[2]); }
71 vtkGetVector3Macro(FocalPoint, double);
73
75
79 void SetViewUp(double vx, double vy, double vz);
80 void SetViewUp(const double a[3]) { this->SetViewUp(a[0], a[1], a[2]); }
81 vtkGetVector3Macro(ViewUp, double);
83
90
95 void SetDistance(double);
96
98
102 vtkGetMacro(Distance, double);
104
106
111 vtkGetVector3Macro(DirectionOfProjection, double);
113
120 void Dolly(double value);
121
123
126 void SetRoll(double angle);
127 double GetRoll();
129
134 void Roll(double angle);
135
142 void Azimuth(double angle);
143
151 void Yaw(double angle);
152
159 void Elevation(double angle);
160
166 void Pitch(double angle);
167
169
176 vtkGetMacro(ParallelProjection, vtkTypeBool);
177 vtkBooleanMacro(ParallelProjection, vtkTypeBool);
179
181
192 vtkGetMacro(UseHorizontalViewAngle, vtkTypeBool);
193 vtkBooleanMacro(UseHorizontalViewAngle, vtkTypeBool);
195
197
208 void SetViewAngle(double angle);
209 vtkGetMacro(ViewAngle, double);
211
213
223 vtkGetMacro(ParallelScale, double);
225
233 void Zoom(double factor);
234
236
249 void SetClippingRange(double dNear, double dFar);
250 void SetClippingRange(const double a[2]) { this->SetClippingRange(a[0], a[1]); }
251 vtkGetVector2Macro(ClippingRange, double);
253
255
262 void SetThickness(double);
263 vtkGetMacro(Thickness, double);
265
267
276 void SetWindowCenter(double x, double y);
277 vtkGetVector2Macro(WindowCenter, double);
279
293 void SetObliqueAngles(double alpha, double beta);
294
301
303
308 vtkGetVector3Macro(ViewPlaneNormal, double);
310
312
320 void SetViewShear(double dxdz, double dydz, double center);
321 void SetViewShear(double d[3]);
322 vtkGetVector3Macro(ViewShear, double);
324
326
330 vtkSetMacro(EyeAngle, double);
331 vtkGetMacro(EyeAngle, double);
333
335
341 vtkSetMacro(FocalDisk, double);
342 vtkGetMacro(FocalDisk, double);
344
346
354 vtkSetMacro(FocalDistance, double);
355 vtkGetMacro(FocalDistance, double);
357
359
368 vtkSetMacro(UseOffAxisProjection, vtkTypeBool);
369 vtkGetMacro(UseOffAxisProjection, vtkTypeBool);
370 vtkBooleanMacro(UseOffAxisProjection, vtkTypeBool);
372
374
380
382
387 vtkSetVector3Macro(ScreenBottomLeft, double);
388 vtkGetVector3Macro(ScreenBottomLeft, double);
390
392
397 vtkSetVector3Macro(ScreenBottomRight, double);
398 vtkGetVector3Macro(ScreenBottomRight, double);
400
402
407 vtkSetVector3Macro(ScreenTopRight, double);
408 vtkGetVector3Macro(ScreenTopRight, double);
410
412
417 vtkSetMacro(EyeSeparation, double);
418 vtkGetMacro(EyeSeparation, double);
420
422
428 void SetEyePosition(double eyePosition[3]);
429 void GetEyePosition(double eyePosition[3]);
431
433
441 void GetStereoEyePosition(double eyePosition[3]);
443
448 void GetEyePlaneNormal(double normal[3]);
449
451
458 void SetEyeTransformMatrix(const double elements[16]);
459 vtkGetObjectMacro(EyeTransformMatrix, vtkMatrix4x4);
461
463
469 void SetModelTransformMatrix(const double elements[16]);
470 vtkGetObjectMacro(ModelTransformMatrix, vtkMatrix4x4);
472
477
482
491
502
510 vtkGetObjectMacro(ExplicitProjectionTransformMatrix, vtkMatrix4x4);
518 vtkSetMacro(UseExplicitProjectionTransformMatrix, bool);
519 vtkGetMacro(UseExplicitProjectionTransformMatrix, bool);
520 vtkBooleanMacro(UseExplicitProjectionTransformMatrix, bool);
528 vtkSetMacro(ExplicitAspectRatio, double);
529 vtkGetMacro(ExplicitAspectRatio, double);
538 vtkSetMacro(UseExplicitAspectRatio, bool);
539 vtkGetMacro(UseExplicitAspectRatio, bool);
540 vtkBooleanMacro(UseExplicitAspectRatio, bool);
553 virtual vtkMatrix4x4* GetProjectionTransformMatrix(double aspect, double nearz, double farz);
554
566 double aspect, double nearz, double farz);
567
580 double aspect, double nearz, double farz);
581
590
592
598 vtkGetObjectMacro(UserViewTransform, vtkHomogeneousTransform);
600
602
608 vtkGetObjectMacro(UserTransform, vtkHomogeneousTransform);
610
616 virtual void Render(vtkRenderer*) {}
617
622
628
639 virtual void GetFrustumPlanes(double aspect, double planes[24]);
640
642
652 virtual void UpdateIdealShiftScale(double aspect);
653 vtkGetVector3Macro(FocalPointShift, double);
654 vtkGetMacro(FocalPointScale, double);
655 vtkGetVector3Macro(NearPlaneShift, double);
656 vtkGetMacro(NearPlaneScale, double);
657 vtkSetMacro(ShiftScaleThreshold, double);
658 vtkGetMacro(ShiftScaleThreshold, double);
660
662
666 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
668
673 void ComputeViewPlaneNormal();
674
680 vtkMatrix4x4* GetCameraLightTransformMatrix();
681
685 virtual void UpdateViewport(vtkRenderer* vtkNotUsed(ren)) {}
686
688
691 vtkGetMacro(Stereo, int);
693
695
698 vtkSetMacro(LeftEye, int);
699 vtkGetMacro(LeftEye, int);
701
709
717
719
724 vtkSetMacro(FreezeFocalPoint, bool);
725 vtkGetMacro(FreezeFocalPoint, bool);
727
729
732 vtkSetMacro(UseScissor, bool);
733 vtkGetMacro(UseScissor, bool);
735
737
740 void SetScissorRect(vtkRecti scissorRect);
741 void GetScissorRect(vtkRecti& scissorRect);
743
745
748 vtkGetObjectMacro(Information, vtkInformation);
751
752protected:
754 ~vtkCamera() override;
755
757
761 virtual void ComputeViewTransform();
763
767 virtual void ComputeProjectionTransform(double aspect, double nearz, double farz);
768
772 void ComputeCompositeProjectionTransform(double aspect, double nearz, double farz);
773
775
781
786
791
799
800 double WindowCenter[2];
801 double ObliqueAngles[2];
802 double FocalPoint[3];
803 double Position[3];
804 double ViewUp[3];
805 double ViewAngle;
806 double ClippingRange[2];
807 double EyeAngle;
812 double Thickness;
813 double Distance;
814 double DirectionOfProjection[3];
815 double ViewPlaneNormal[3];
816 double ViewShear[3];
818
820
821 double ScreenBottomLeft[3];
822 double ScreenBottomRight[3];
823 double ScreenTopRight[3];
824 double ScreenCenter[3];
825
828
831
833
836
839
842
847
849
850 double FocalDisk;
852
853 double FocalPointShift[3];
855 double NearPlaneShift[3];
858
859 vtkCameraCallbackCommand* UserViewTransformCallbackCommand;
860 friend class vtkCameraCallbackCommand;
861
862 // ViewingRaysMtime keeps track of camera modifications which will
863 // change the calculation of viewing rays for the camera before it is
864 // transformed to the camera's location and orientation.
868
870
871 // Arbitrary extra information associated with this camera.
873
874private:
875 vtkCamera(const vtkCamera&) = delete;
876 void operator=(const vtkCamera&) = delete;
877};
878
879VTK_ABI_NAMESPACE_END
880#endif
supports function callbacks
a virtual camera for 3D rendering
Definition: vtkCamera.h:42
bool UseExplicitProjectionTransformMatrix
Definition: vtkCamera.h:838
void ComputeOffAxisProjectionFrustum()
Compute and use frustum using offaxis method.
vtkInformation * Information
Definition: vtkCamera.h:872
virtual void SetInformation(vtkInformation *)
Set/Get the information object associated with this camera.
vtkMatrix4x4 * EyeTransformMatrix
Definition: vtkCamera.h:829
void Roll(double angle)
Rotate the camera about the direction of projection.
vtkTypeBool ParallelProjection
Definition: vtkCamera.h:808
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:845
void ComputeCameraLightTransform()
void SetViewUp(const double a[3])
Set/Get the view up direction for the camera.
Definition: vtkCamera.h:80
vtkTransform * ViewTransform
Definition: vtkCamera.h:843
double FocalDistance
Definition: vtkCamera.h:851
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:854
bool FreezeFocalPoint
Definition: vtkCamera.h:866
void GetStereoEyePosition(double eyePosition[3])
Using the LeftEye property to determine whether left or right eye is being requested,...
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:60
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:807
void Azimuth(double angle)
Rotate the camera about the view up vector centered at the focal point.
vtkHomogeneousTransform * UserTransform
Definition: vtkCamera.h:834
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:819
vtkMatrix4x4 * ExplicitProjectionTransformMatrix
Definition: vtkCamera.h:837
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:856
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:811
double EyeSeparation
Definition: vtkCamera.h:827
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 * ProjectionPlaneOrientationMatrix
Definition: vtkCamera.h:830
vtkMatrix4x4 * ModelTransformMatrix
Definition: vtkCamera.h:832
void ShallowCopy(vtkCamera *source)
Copy the properties of ‘source’ into ‘this’.
double FocalDisk
Definition: vtkCamera.h:850
double Distance
Definition: vtkCamera.h:813
bool UseExplicitAspectRatio
Definition: vtkCamera.h:841
void SetModelTransformMatrix(const double elements[16])
Set/Get 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:616
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:70
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/Get eye transformation matrix.
double Thickness
Definition: vtkCamera.h:812
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:869
vtkTransform * CameraLightTransform
Definition: vtkCamera.h:846
bool UseScissor
Definition: vtkCamera.h:867
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:817
void OrthogonalizeViewUp()
Recompute the ViewUp vector to force it to be perpendicular to camera->focalpoint vector.
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.
int Stereo
Definition: vtkCamera.h:810
~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:805
void SetViewShear(double d[3])
Set/get the shear transform of the viewing frustum.
double ParallelScale
Definition: vtkCamera.h:809
void ComputeScreenOrientationMatrix()
Given screen screen top, bottom left and top right calculate screen orientation.
vtkHomogeneousTransform * UserViewTransform
Definition: vtkCamera.h:835
vtkPerspectiveTransform * ProjectionTransform
Definition: vtkCamera.h:844
vtkCameraCallbackCommand * UserViewTransformCallbackCommand
Definition: vtkCamera.h:859
double ShiftScaleThreshold
Definition: vtkCamera.h:857
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.
double GetOffAxisClippingAdjustment()
Get adjustment to clipping thickness, computed by camera based on the physical size of the screen and...
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:848
double OffAxisClippingAdjustment
Definition: vtkCamera.h:826
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:250
vtkTimeStamp ViewingRaysMTime
Definition: vtkCamera.h:865
double ExplicitAspectRatio
Definition: vtkCamera.h:840
superclass for homogeneous transformations
a simple class to control print indentation
Definition: vtkIndent.h:29
Store vtkAlgorithm input/output information.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:32
abstract base class for most VTK objects
Definition: vtkObject.h:53
describes a 4x4 matrix transformation
abstract specification for renderers
Definition: vtkRenderer.h:63
record modification and/or execution time
Definition: vtkTimeStamp.h:25
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:51
@ value
Definition: vtkX3D.h:220
@ scale
Definition: vtkX3D.h:229
@ center
Definition: vtkX3D.h:230
@ alpha
Definition: vtkX3D.h:250
int vtkTypeBool
Definition: vtkABI.h:64
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO