VTK  9.3.20240328
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 
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkAxisActor;
26 class vtkViewport;
27 
28 class VTKRENDERINGANNOTATION_EXPORT vtkProp3DAxisFollower : public vtkProp3DFollower
29 {
30 public:
35 
37 
41  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
45 
48  virtual void SetAxis(vtkAxisActor*);
49  virtual vtkAxisActor* GetAxis();
51 
53 
58  vtkSetMacro(AutoCenter, vtkTypeBool);
59  vtkGetMacro(AutoCenter, vtkTypeBool);
60  vtkBooleanMacro(AutoCenter, vtkTypeBool);
62 
64 
69  vtkSetMacro(EnableDistanceLOD, int);
70  vtkGetMacro(EnableDistanceLOD, int);
72 
74 
79  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
80  vtkGetMacro(DistanceLODThreshold, double);
82 
84 
89  vtkSetMacro(EnableViewAngleLOD, int);
90  vtkGetMacro(EnableViewAngleLOD, int);
92 
94 
99  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
100  vtkGetMacro(ViewAngleLODThreshold, double);
102 
104 
108  double GetScreenOffset();
109  void SetScreenOffset(double offset);
111 
113 
116  vtkSetVector2Macro(ScreenOffsetVector, double);
117  vtkGetVector2Macro(ScreenOffsetVector, double);
119 
124  void ComputeMatrix() override;
125 
129  void ShallowCopy(vtkProp* prop) override;
130 
135  static double AutoScale(
136  vtkViewport* viewport, vtkCamera* camera, double screenSize, double position[3]);
137 
139 
144  int RenderOpaqueGeometry(vtkViewport* viewport) override;
146  int RenderVolumetricGeometry(vtkViewport* viewport) override;
148 
149  virtual void SetViewport(vtkViewport* viewport);
151 
152 protected:
155 
157  double Rx[3], double Ry[3], double Rz[3], vtkAxisActor* axis1, double* dop, vtkViewport* ren);
158 
159  void ComputeRotationAndTranlation(vtkViewport* ren, double translation[3], double Rx[3],
160  double Ry[3], double Rz[3], vtkAxisActor* axis);
161 
162  // \NOTE: Not used as of now.
163  void ComputerAutoCenterTranslation(const double& autoScaleFactor, double translation[3]);
164 
166  void ExecuteViewAngleVisibility(double normal[3]);
167 
168  bool IsTextUpsideDown(double* a, double* b);
169 
171 
174 
177 
178  double ScreenOffsetVector[2];
179 
182 
183 private:
185  void operator=(const vtkProp3DAxisFollower&) = delete;
186 
187  int TextUpsideDown;
188  int VisibleAtCurrentViewAngle;
189 };
190 
191 VTK_ABI_NAMESPACE_END
192 #endif
Create an axis with tick marks and labels.
Definition: vtkAxisActor.h:89
a virtual camera for 3D rendering
Definition: vtkCamera.h:150
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:65
abstract specification for Viewports
Definition: vtkViewport.h:64
@ translation
Definition: vtkX3D.h:232
@ position
Definition: vtkX3D.h:261
@ offset
Definition: vtkX3D.h:438
int vtkTypeBool
Definition: vtkABI.h:64