ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvCustomAxisHandleRepresentation.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 //
8 // Custom handle representation that supports custom translation axis
9 // This backports VTK 9.3+ functionality to VTK 9.2 and earlier
10 
11 #ifndef cvCustomAxisHandleRepresentation_h
12 #define cvCustomAxisHandleRepresentation_h
13 
14 #include <vtkPointHandleRepresentation3D.h>
15 #include <vtkVersion.h>
16 
24 class cvCustomAxisHandleRepresentation : public vtkPointHandleRepresentation3D {
25 public:
28  vtkPointHandleRepresentation3D);
29  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
31 #if !((VTK_MAJOR_VERSION > 9) || \
32  (VTK_MAJOR_VERSION == 9 && VTK_MINOR_VERSION >= 3))
33  // These methods are only needed for VTK < 9.3
34  // In VTK 9.3+, the base class already has these
35 
40 
45 
50  void SetCustomTranslationAxis(double axis[3]);
51  void SetCustomTranslationAxis(double x, double y, double z);
52 
57 
61  bool IsCustomAxisEnabled() const { return this->CustomAxisEnabled; }
62 
66  void GetTranslationVector(const double* p1,
67  const double* p2,
68  double* v) const override;
69 
73  void Translate(const double* p1, const double* p2) override;
74  void Translate(const double* v) override;
75 
76 protected:
79 
82 
83 #else
84  // For VTK 9.3+, just forward to base class methods
86  this->Superclass::SetCustomTranslationAxisOn();
87  }
88 
90  this->Superclass::SetTranslationAxisOff();
91  }
92 
93  void SetCustomTranslationAxis(double axis[3]) {
94  this->Superclass::SetCustomTranslationAxis(axis);
95  }
96 
97  void SetCustomTranslationAxis(double x, double y, double z) {
98  double axis[3] = {x, y, z};
99  this->Superclass::SetCustomTranslationAxis(axis);
100  }
101 
102 protected:
105 #endif
106 
107 private:
109  delete;
110  void operator=(const cvCustomAxisHandleRepresentation&) = delete;
111 };
112 
113 #endif // cvCustomAxisHandleRepresentation_h
cvCustomAxisHandleRepresentation::Translate
void Translate(const double *p1, const double *p2) override
Override Translate to support custom axis.
Definition: cvCustomAxisHandleRepresentation.cpp:109
cvCustomAxisHandleRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Definition: cvCustomAxisHandleRepresentation.cpp:138
x
normal_z x
Definition: my_point_types.h:165
vtkStandardNewMacro
vtkStandardNewMacro(cvCustomAxisHandleRepresentation)
cvCustomAxisHandleRepresentation::CustomAxisEnabled
bool CustomAxisEnabled
Definition: cvCustomAxisHandleRepresentation.h:80
cvCustomAxisHandleRepresentation.h
y
normal_z y
Definition: my_point_types.h:168
cvCustomAxisHandleRepresentation::vtkGetVector3Macro
vtkGetVector3Macro(CustomTranslationAxis, double)
Get the custom translation axis.
cvCustomAxisHandleRepresentation::IsCustomAxisEnabled
bool IsCustomAxisEnabled() const
Check if custom translation axis is enabled.
Definition: cvCustomAxisHandleRepresentation.h:61
cvCustomAxisHandleRepresentation::cvCustomAxisHandleRepresentation
cvCustomAxisHandleRepresentation()
Definition: cvCustomAxisHandleRepresentation.cpp:19
cvCustomAxisHandleRepresentation::SetCustomTranslationAxis
void SetCustomTranslationAxis(double axis[3])
Set the custom translation axis vector.
Definition: cvCustomAxisHandleRepresentation.cpp:48
cvCustomAxisHandleRepresentation::CustomTranslationAxis
double CustomTranslationAxis[3]
Definition: cvCustomAxisHandleRepresentation.h:81
cvCustomAxisHandleRepresentation::~cvCustomAxisHandleRepresentation
~cvCustomAxisHandleRepresentation() override
cvCustomAxisHandleRepresentation::GetTranslationVector
void GetTranslationVector(const double *p1, const double *p2, double *v) const override
Override GetTranslationVector to support custom axis.
Definition: cvCustomAxisHandleRepresentation.cpp:74
cvCustomAxisHandleRepresentation::New
static cvCustomAxisHandleRepresentation * New()
cvCustomAxisHandleRepresentation::SetCustomTranslationAxisOn
void SetCustomTranslationAxisOn()
Enable custom translation axis mode.
Definition: cvCustomAxisHandleRepresentation.cpp:30
cvCustomAxisHandleRepresentation
Handle representation with custom translation axis support.
Definition: cvCustomAxisHandleRepresentation.h:24
z
normal_z z
Definition: my_point_types.h:165
cvCustomAxisHandleRepresentation::vtkTypeMacro
vtkTypeMacro(cvCustomAxisHandleRepresentation, vtkPointHandleRepresentation3D)
cvCustomAxisHandleRepresentation::SetCustomTranslationAxisOff
void SetCustomTranslationAxisOff()
Disable custom translation axis mode.
Definition: cvCustomAxisHandleRepresentation.cpp:40