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=========================================================================*/
144#ifndef vtkCamera_h
145#define vtkCamera_h
146
147#include "vtkObject.h"
148#include "vtkRect.h" // for ivar
149#include "vtkRenderingCoreModule.h" // For export macro
150
152class vtkInformation;
153class vtkMatrix4x4;
155class vtkRenderer;
156class vtkTransform;
158class vtkCameraCallbackCommand;
159
160class VTKRENDERINGCORE_EXPORT vtkCamera : public vtkObject
161{
162public:
163 vtkTypeMacro(vtkCamera, vtkObject);
164 void PrintSelf(ostream& os, vtkIndent indent) override;
165
171 static vtkCamera* New();
172
174
178 void SetPosition(double x, double y, double z);
179 void SetPosition(const double a[3]) { this->SetPosition(a[0], a[1], a[2]); }
180 vtkGetVector3Macro(Position, double);
182
184
188 void SetFocalPoint(double x, double y, double z);
189 void SetFocalPoint(const double a[3]) { this->SetFocalPoint(a[0], a[1], a[2]); }
190 vtkGetVector3Macro(FocalPoint, double);
192
194
198 void SetViewUp(double vx, double vy, double vz);
199 void SetViewUp(const double a[3]) { this->SetViewUp(a[0], a[1], a[2]); }
200 vtkGetVector3Macro(ViewUp, double);
202
209
214 void SetDistance(double);
215
217
221 vtkGetMacro(Distance, double);
223
225
230 vtkGetVector3Macro(DirectionOfProjection, double);
232
239 void Dolly(double value);
240
242
245 void SetRoll(double angle);
246 double GetRoll();
248
253 void Roll(double angle);
254
261 void Azimuth(double angle);
262
270 void Yaw(double angle);
271
278 void Elevation(double angle);
279
285 void Pitch(double angle);
286
288
295 vtkGetMacro(ParallelProjection, vtkTypeBool);
296 vtkBooleanMacro(ParallelProjection, vtkTypeBool);
298
300
311 vtkGetMacro(UseHorizontalViewAngle, vtkTypeBool);
312 vtkBooleanMacro(UseHorizontalViewAngle, vtkTypeBool);
314
316
327 void SetViewAngle(double angle);
328 vtkGetMacro(ViewAngle, double);
330
332
342 vtkGetMacro(ParallelScale, double);
344
352 void Zoom(double factor);
353
355
368 void SetClippingRange(double dNear, double dFar);
369 void SetClippingRange(const double a[2]) { this->SetClippingRange(a[0], a[1]); }
370 vtkGetVector2Macro(ClippingRange, double);
372
374
381 void SetThickness(double);
382 vtkGetMacro(Thickness, double);
384
386
395 void SetWindowCenter(double x, double y);
396 vtkGetVector2Macro(WindowCenter, double);
398
412 void SetObliqueAngles(double alpha, double beta);
413
420
422
427 vtkGetVector3Macro(ViewPlaneNormal, double);
429
431
439 void SetViewShear(double dxdz, double dydz, double center);
440 void SetViewShear(double d[3]);
441 vtkGetVector3Macro(ViewShear, double);
443
445
449 vtkSetMacro(EyeAngle, double);
450 vtkGetMacro(EyeAngle, double);
452
454
460 vtkSetMacro(FocalDisk, double);
461 vtkGetMacro(FocalDisk, double);
463
465
473 vtkSetMacro(FocalDistance, double);
474 vtkGetMacro(FocalDistance, double);
476
478
487 vtkSetMacro(UseOffAxisProjection, vtkTypeBool);
488 vtkGetMacro(UseOffAxisProjection, vtkTypeBool);
489 vtkBooleanMacro(UseOffAxisProjection, vtkTypeBool);
491
493
498 vtkSetVector3Macro(ScreenBottomLeft, double);
499 vtkGetVector3Macro(ScreenBottomLeft, double);
501
503
508 vtkSetVector3Macro(ScreenBottomRight, double);
509 vtkGetVector3Macro(ScreenBottomRight, double);
511
513
518 vtkSetVector3Macro(ScreenTopRight, double);
519 vtkGetVector3Macro(ScreenTopRight, double);
521
523
528 vtkSetMacro(EyeSeparation, double);
529 vtkGetMacro(EyeSeparation, double);
531
533
539 void SetEyePosition(double eyePosition[3]);
540 void GetEyePosition(double eyePosition[3]);
542
547 void GetEyePlaneNormal(double normal[3]);
548
550
557 vtkGetObjectMacro(EyeTransformMatrix, vtkMatrix4x4);
559
566 void SetEyeTransformMatrix(const double elements[16]);
567
569
575 vtkGetObjectMacro(ModelTransformMatrix, vtkMatrix4x4);
577
583 void SetModelTransformMatrix(const double elements[16]);
584
589
594
603
614
622 vtkGetObjectMacro(ExplicitProjectionTransformMatrix, vtkMatrix4x4);
630 vtkSetMacro(UseExplicitProjectionTransformMatrix, bool);
631 vtkGetMacro(UseExplicitProjectionTransformMatrix, bool);
632 vtkBooleanMacro(UseExplicitProjectionTransformMatrix, bool);
640 vtkSetMacro(ExplicitAspectRatio, double);
641 vtkGetMacro(ExplicitAspectRatio, double);
650 vtkSetMacro(UseExplicitAspectRatio, bool);
651 vtkGetMacro(UseExplicitAspectRatio, bool);
652 vtkBooleanMacro(UseExplicitAspectRatio, bool);
665 virtual vtkMatrix4x4* GetProjectionTransformMatrix(double aspect, double nearz, double farz);
666
678 double aspect, double nearz, double farz);
679
692 double aspect, double nearz, double farz);
693
702
704
710 vtkGetObjectMacro(UserViewTransform, vtkHomogeneousTransform);
712
714
720 vtkGetObjectMacro(UserTransform, vtkHomogeneousTransform);
722
728 virtual void Render(vtkRenderer*) {}
729
734
740
751 virtual void GetFrustumPlanes(double aspect, double planes[24]);
752
754
764 virtual void UpdateIdealShiftScale(double aspect);
765 vtkGetVector3Macro(FocalPointShift, double);
766 vtkGetMacro(FocalPointScale, double);
767 vtkGetVector3Macro(NearPlaneShift, double);
768 vtkGetMacro(NearPlaneScale, double);
769 vtkSetMacro(ShiftScaleThreshold, double);
770 vtkGetMacro(ShiftScaleThreshold, double);
772
774
778 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
780
785 void ComputeViewPlaneNormal();
786
792 vtkMatrix4x4* GetCameraLightTransformMatrix();
793
797 virtual void UpdateViewport(vtkRenderer* vtkNotUsed(ren)) {}
798
800
803 vtkGetMacro(Stereo, int);
805
807
810 vtkSetMacro(LeftEye, int);
811 vtkGetMacro(LeftEye, int);
813
821
829
831
836 vtkSetMacro(FreezeFocalPoint, bool);
837 vtkGetMacro(FreezeFocalPoint, bool);
839
841
844 vtkSetMacro(UseScissor, bool);
845 vtkGetMacro(UseScissor, bool);
847
849
852 void SetScissorRect(vtkRecti scissorRect);
853 void GetScissorRect(vtkRecti& scissorRect);
855
857
860 vtkGetObjectMacro(Information, vtkInformation);
863
864protected:
866 ~vtkCamera() override;
867
869
873 virtual void ComputeViewTransform();
875
879 virtual void ComputeProjectionTransform(double aspect, double nearz, double farz);
880
884 void ComputeCompositeProjectionTransform(double aspect, double nearz, double farz);
885
887
893
898
903
911
912 double WindowCenter[2];
913 double ObliqueAngles[2];
914 double FocalPoint[3];
915 double Position[3];
916 double ViewUp[3];
917 double ViewAngle;
918 double ClippingRange[2];
919 double EyeAngle;
924 double Thickness;
925 double Distance;
926 double DirectionOfProjection[3];
927 double ViewPlaneNormal[3];
928 double ViewShear[3];
930
932
933 double ScreenBottomLeft[3];
934 double ScreenBottomRight[3];
935 double ScreenTopRight[3];
936
938
941
943
945
948
951
954
959
961
962 double FocalDisk;
964
965 double FocalPointShift[3];
967 double NearPlaneShift[3];
970
971 vtkCameraCallbackCommand* UserViewTransformCallbackCommand;
972 friend class vtkCameraCallbackCommand;
973
974 // ViewingRaysMtime keeps track of camera modifications which will
975 // change the calculation of viewing rays for the camera before it is
976 // transformed to the camera's location and orientation.
980
982
983 // Arbitrary extra information associated with this camera.
985
986private:
987 vtkCamera(const vtkCamera&) = delete;
988 void operator=(const vtkCamera&) = delete;
989};
990
991#endif
supports function callbacks
a virtual camera for 3D rendering
Definition: vtkCamera.h:161
bool UseExplicitProjectionTransformMatrix
Definition: vtkCamera.h:950
void ComputeOffAxisProjectionFrustum()
Compute and use frustum using offaxis method.
vtkInformation * Information
Definition: vtkCamera.h:984
virtual void SetInformation(vtkInformation *)
Set/Get the information object associated with this camera.
vtkMatrix4x4 * EyeTransformMatrix
Definition: vtkCamera.h:942
void Roll(double angle)
Rotate the camera about the direction of projection.
vtkTypeBool ParallelProjection
Definition: vtkCamera.h:920
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:957
void ComputeCameraLightTransform()
void SetViewUp(const double a[3])
Set/Get the view up direction for the camera.
Definition: vtkCamera.h:199
vtkTransform * ViewTransform
Definition: vtkCamera.h:955
double FocalDistance
Definition: vtkCamera.h:963
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:966
bool FreezeFocalPoint
Definition: vtkCamera.h:978
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:179
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:919
void Azimuth(double angle)
Rotate the camera about the view up vector centered at the focal point.
vtkHomogeneousTransform * UserTransform
Definition: vtkCamera.h:946
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:931
vtkMatrix4x4 * ExplicitProjectionTransformMatrix
Definition: vtkCamera.h:949
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:968
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:923
double EyeSeparation
Definition: vtkCamera.h:937
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:944
void ShallowCopy(vtkCamera *source)
Copy the properties of ‘source’ into ‘this’.
double FocalDisk
Definition: vtkCamera.h:962
double Distance
Definition: vtkCamera.h:925
bool UseExplicitAspectRatio
Definition: vtkCamera.h:953
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:728
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:189
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:924
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:981
vtkMatrix4x4 * WorldToScreenMatrix
Definition: vtkCamera.h:939
vtkTransform * CameraLightTransform
Definition: vtkCamera.h:958
bool UseScissor
Definition: vtkCamera.h:979
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:929
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:940
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:922
~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:917
void SetViewShear(double d[3])
Set/get the shear transform of the viewing frustum.
double ParallelScale
Definition: vtkCamera.h:921
vtkHomogeneousTransform * UserViewTransform
Definition: vtkCamera.h:947
vtkPerspectiveTransform * ProjectionTransform
Definition: vtkCamera.h:956
vtkCameraCallbackCommand * UserViewTransformCallbackCommand
Definition: vtkCamera.h:971
double ShiftScaleThreshold
Definition: vtkCamera.h:969
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:960
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:369
vtkTimeStamp ViewingRaysMTime
Definition: vtkCamera.h:977
double ExplicitAspectRatio
Definition: vtkCamera.h:952
superclass for homogeneous transformations
a simple class to control print indentation
Definition: vtkIndent.h:119
Store vtkAlgorithm input/output information.
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
abstract base class for most VTK objects
Definition: vtkObject.h:82
describes a 4x4 matrix transformation
abstract specification for renderers
Definition: vtkRenderer.h:182
record modification and/or execution time
Definition: vtkTimeStamp.h:55
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
@ value
Definition: vtkX3D.h:226
@ scale
Definition: vtkX3D.h:235
@ center
Definition: vtkX3D.h:236
@ alpha
Definition: vtkX3D.h:256
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(...)