VTK  9.3.20240419
vtkProp3DAxisFollower.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
17 #ifndef vtkProp3DAxisFollower_h
18 #define vtkProp3DAxisFollower_h
19 
20 #include "vtkProp3DFollower.h"
21 #include "vtkRenderingAnnotationModule.h" // For export macro
22 #include "vtkWeakPointer.h" // For vtkWeakPointer
23 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkAxisActor;
27 class vtkViewport;
28 
29 class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkProp3DAxisFollower : public vtkProp3DFollower
30 {
31 public:
36 
38 
42  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
49  virtual void SetAxis(vtkAxisActor*);
50  virtual vtkAxisActor* GetAxis();
52 
54 
59  vtkSetMacro(AutoCenter, vtkTypeBool);
60  vtkGetMacro(AutoCenter, vtkTypeBool);
61  vtkBooleanMacro(AutoCenter, vtkTypeBool);
63 
65 
70  vtkSetMacro(EnableDistanceLOD, int);
71  vtkGetMacro(EnableDistanceLOD, int);
73 
75 
80  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
81  vtkGetMacro(DistanceLODThreshold, double);
83 
85 
90  vtkSetMacro(EnableViewAngleLOD, int);
91  vtkGetMacro(EnableViewAngleLOD, int);
93 
95 
100  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
101  vtkGetMacro(ViewAngleLODThreshold, double);
103 
105 
109  double GetScreenOffset();
110  void SetScreenOffset(double offset);
112 
114 
117  vtkSetVector2Macro(ScreenOffsetVector, double);
118  vtkGetVector2Macro(ScreenOffsetVector, double);
120 
125  void ComputeMatrix() override;
126 
130  void ShallowCopy(vtkProp* prop) override;
131 
136  static double AutoScale(
137  vtkViewport* viewport, vtkCamera* camera, double screenSize, double position[3]);
138 
140 
145  int RenderOpaqueGeometry(vtkViewport* viewport) override;
147  int RenderVolumetricGeometry(vtkViewport* viewport) override;
149 
150  virtual void SetViewport(vtkViewport* viewport);
152 
153 protected:
156 
158  double Rx[3], double Ry[3], double Rz[3], vtkAxisActor* axis1, double* dop, vtkViewport* ren);
159 
160  void ComputeRotationAndTranlation(vtkViewport* ren, double translation[3], double Rx[3],
161  double Ry[3], double Rz[3], vtkAxisActor* axis);
162 
163  // \NOTE: Not used as of now.
164  void ComputerAutoCenterTranslation(const double& autoScaleFactor, double translation[3]);
165 
167  void ExecuteViewAngleVisibility(double normal[3]);
168 
169  bool IsTextUpsideDown(double* a, double* b);
170 
172 
175 
178 
179  double ScreenOffsetVector[2];
180 
183 
184 private:
186  void operator=(const vtkProp3DAxisFollower&) = delete;
187 
188  int TextUpsideDown;
189  int VisibleAtCurrentViewAngle;
190 };
191 
192 VTK_ABI_NAMESPACE_END
193 #endif
Create an axis with tick marks and labels.
Definition: vtkAxisActor.h:90
a virtual camera for 3D rendering
Definition: vtkCamera.h:151
a simple class to control print indentation
Definition: vtkIndent.h:108
a subclass of vtkProp3DFollower that ensures that data is always parallel to the axis defined by a vt...
virtual vtkViewport * GetViewport()
virtual void SetAxis(vtkAxisActor *)
Set axis that needs to be followed.
static double AutoScale(vtkViewport *viewport, vtkCamera *camera, double screenSize, double position[3])
Calculate scale factor to maintain same size of a object on the screen.
static vtkProp3DAxisFollower * New()
Creates a follower with no camera set.
virtual vtkAxisActor * GetAxis()
Set axis that needs to be followed.
void ComputeMatrix() override
Generate the matrix based on ivars.
void CalculateOrthogonalVectors(double Rx[3], double Ry[3], double Rz[3], vtkAxisActor *axis1, double *dop, vtkViewport *ren)
vtkWeakPointer< vtkAxisActor > Axis
virtual void SetViewport(vtkViewport *viewport)
int RenderOpaqueGeometry(vtkViewport *viewport) override
This causes the actor to be rendered.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods for type and printing.
void ComputeRotationAndTranlation(vtkViewport *ren, double translation[3], double Rx[3], double Ry[3], double Rz[3], vtkAxisActor *axis)
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
This causes the actor to be rendered.
int RenderVolumetricGeometry(vtkViewport *viewport) override
This causes the actor to be rendered.
void ComputerAutoCenterTranslation(const double &autoScaleFactor, double translation[3])
vtkWeakPointer< vtkViewport > Viewport
void ShallowCopy(vtkProp *prop) override
Shallow copy of a follower.
bool IsTextUpsideDown(double *a, double *b)
void SetScreenOffset(double offset)
Set/Get the desired screen vertical offset from the axis.
~vtkProp3DAxisFollower() override
void ExecuteViewAngleVisibility(double normal[3])
double GetScreenOffset()
Set/Get the desired screen vertical offset from the axis.
a vtkProp3D that always faces the camera
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:66
abstract specification for Viewports
Definition: vtkViewport.h:65
@ translation
Definition: vtkX3D.h:232
@ position
Definition: vtkX3D.h:261
@ offset
Definition: vtkX3D.h:438
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_MARSHALAUTO