VTK: Rendering/Core/vtkRenderWindowInteractor3D.h Source File

| VTK 9.3.1

vtkRenderWindowInteractor3D.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
20 #ifndef vtkRenderWindowInteractor3D_h
21 #define vtkRenderWindowInteractor3D_h
22
23 #include "vtkRenderWindowInteractor.h"
24 #include "vtkRenderingCoreModule.h" // For export macro
25
26 #include "vtkNew.h" // ivars
27
28 VTK_ABI_NAMESPACE_BEGIN
29 class vtkCamera;
30 class vtkMatrix4x4;
31 enum class vtkEventDataDevice;
32 enum class vtkEventDataDeviceInput;
33
34 class VTKRENDERINGCORE_EXPORT vtkRenderWindowInteractor3D : public vtkRenderWindowInteractor
35 {
36 public:
40 static vtkRenderWindowInteractor3D* New();
41
42 vtkTypeMacro(vtkRenderWindowInteractor3D, vtkRenderWindowInteractor);
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
46
55 void Enable() override;
56 void Disable() override;
58
60
65 virtual double* GetWorldEventPosition(int pointerIndex)
66 {
67 if (pointerIndex >= VTKI_MAX_POINTERS)
68 {
69 return nullptr;
70 }
71 return this->WorldEventPositions[pointerIndex];
72 }
73 virtual double* GetLastWorldEventPosition(int pointerIndex)
74 {
75 if (pointerIndex >= VTKI_MAX_POINTERS)
76 {
77 return nullptr;
78 }
79 return this->LastWorldEventPositions[pointerIndex];
80 }
81 virtual double* GetWorldEventOrientation(int pointerIndex)
82 {
83 if (pointerIndex >= VTKI_MAX_POINTERS)
84 {
85 return nullptr;
86 }
87 return this->WorldEventOrientations[pointerIndex];
88 }
89 virtual double* GetLastWorldEventOrientation(int pointerIndex)
90 {
91 if (pointerIndex >= VTKI_MAX_POINTERS)
92 {
93 return nullptr;
94 }
95 return this->LastWorldEventOrientations[pointerIndex];
96 }
97 virtual void GetWorldEventPose(vtkMatrix4x4* poseMatrix, int pointerIndex);
98 virtual void GetLastWorldEventPose(vtkMatrix4x4* poseMatrix, int pointerIndex);
100
102
107 virtual void SetPhysicalEventPosition(double x, double y, double z, int pointerIndex)
108 {
109 if (pointerIndex < 0 || pointerIndex >= VTKI_MAX_POINTERS)
110 {
111 return;
112 }
113 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting PhysicalEventPosition to ("
114 << x << "," << y << "," << z << ") for pointerIndex number " << pointerIndex);
115 if (this->PhysicalEventPositions[pointerIndex][0] != x ||
116 this->PhysicalEventPositions[pointerIndex][1] != y ||
117 this->PhysicalEventPositions[pointerIndex][2] != z ||
118 this->LastPhysicalEventPositions[pointerIndex][0] != x ||
119 this->LastPhysicalEventPositions[pointerIndex][1] != y ||
120 this->LastPhysicalEventPositions[pointerIndex][2] != z)
121 {
122 this->LastPhysicalEventPositions[pointerIndex][0] =
123 this->PhysicalEventPositions[pointerIndex][0];
124 this->LastPhysicalEventPositions[pointerIndex][1] =
125 this->PhysicalEventPositions[pointerIndex][1];
126 this->LastPhysicalEventPositions[pointerIndex][2] =
127 this->PhysicalEventPositions[pointerIndex][2];
128 this->PhysicalEventPositions[pointerIndex][0] = x;
129 this->PhysicalEventPositions[pointerIndex][1] = y;
130 this->PhysicalEventPositions[pointerIndex][2] = z;
131 this->Modified();
132 }
133 }
134 virtual void SetPhysicalEventPose(vtkMatrix4x4* poseMatrix, int pointerIndex);
136
138
143 virtual void GetPhysicalEventPose(vtkMatrix4x4* poseMatrix, int pointerIndex);
144 virtual void GetLastPhysicalEventPose(vtkMatrix4x4* poseMatrix, int pointerIndex);
145 virtual void GetStartingPhysicalEventPose(vtkMatrix4x4* poseMatrix, int pointerIndex);
147
149
154 virtual void SetWorldEventPosition(double x, double y, double z, int pointerIndex)
155 {
156 if (pointerIndex < 0 || pointerIndex >= VTKI_MAX_POINTERS)
157 {
158 return;
159 }
160 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting WorldEventPosition to ("
161 << x << "," << y << "," << z << ") for pointerIndex number " << pointerIndex);
162 if (this->WorldEventPositions[pointerIndex][0] != x ||
163 this->WorldEventPositions[pointerIndex][1] != y ||
164 this->WorldEventPositions[pointerIndex][2] != z ||
165 this->LastWorldEventPositions[pointerIndex][0] != x ||
166 this->LastWorldEventPositions[pointerIndex][1] != y ||
167 this->LastWorldEventPositions[pointerIndex][2] != z)
168 {
169 this->LastWorldEventPositions[pointerIndex][0] = this->WorldEventPositions[pointerIndex][0];
170 this->LastWorldEventPositions[pointerIndex][1] = this->WorldEventPositions[pointerIndex][1];
171 this->LastWorldEventPositions[pointerIndex][2] = this->WorldEventPositions[pointerIndex][2];
172 this->WorldEventPositions[pointerIndex][0] = x;
173 this->WorldEventPositions[pointerIndex][1] = y;
174 this->WorldEventPositions[pointerIndex][2] = z;
175 this->Modified();
176 }
177 }
178 virtual void SetWorldEventOrientation(double w, double x, double y, double z, int pointerIndex)
179 {
180 if (pointerIndex < 0 || pointerIndex >= VTKI_MAX_POINTERS)
181 {
182 return;
183 }
184 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting WorldEventOrientation to ("
185 << w << "," << x << "," << y << "," << z << ") for pointerIndex number "
186 << pointerIndex);
187 if (this->WorldEventOrientations[pointerIndex][0] != w ||
188 this->WorldEventOrientations[pointerIndex][1] != x ||
189 this->WorldEventOrientations[pointerIndex][2] != y ||
190 this->WorldEventOrientations[pointerIndex][3] != z ||
191 this->LastWorldEventOrientations[pointerIndex][0] != w ||
192 this->LastWorldEventOrientations[pointerIndex][1] != x ||
193 this->LastWorldEventOrientations[pointerIndex][2] != y ||
194 this->LastWorldEventOrientations[pointerIndex][3] != z)
195 {
196 this->LastWorldEventOrientations[pointerIndex][0] =
197 this->WorldEventOrientations[pointerIndex][0];
198 this->LastWorldEventOrientations[pointerIndex][1] =
199 this->WorldEventOrientations[pointerIndex][1];
200 this->LastWorldEventOrientations[pointerIndex][2] =
201 this->WorldEventOrientations[pointerIndex][2];
202 this->LastWorldEventOrientations[pointerIndex][3] =
203 this->WorldEventOrientations[pointerIndex][3];
204 this->WorldEventOrientations[pointerIndex][0] = w;
205 this->WorldEventOrientations[pointerIndex][1] = x;
206 this->WorldEventOrientations[pointerIndex][2] = y;
207 this->WorldEventOrientations[pointerIndex][3] = z;
208 this->Modified();
209 }
210 }
211 virtual void SetWorldEventPose(vtkMatrix4x4* poseMatrix, int pointerIndex);
213
215
218 void RightButtonPressEvent() override;
219 void RightButtonReleaseEvent() override;
221
223
226 void MiddleButtonPressEvent() override;
227 void MiddleButtonReleaseEvent() override;
229
231
234 virtual void GetTouchPadPosition(vtkEventDataDevice, vtkEventDataDeviceInput, float[3]) {}
236
238
241 virtual void SetPhysicalViewDirection(double, double, double){};
242 virtual double* GetPhysicalViewDirection() { return nullptr; };
244
246
249 virtual void SetPhysicalViewUp(double, double, double){};
250 virtual double* GetPhysicalViewUp() { return nullptr; };
252
254
257 virtual void SetPhysicalTranslation(vtkCamera*, double, double, double) {}
258 virtual double* GetPhysicalTranslation(vtkCamera*) { return nullptr; }
260
262
265 virtual void SetPhysicalScale(double) {}
266 virtual double GetPhysicalScale() { return 1.0; }
268
270
273 void SetTranslation3D(double val[3]);
274 vtkGetVector3Macro(Translation3D, double);
275 vtkGetVector3Macro(LastTranslation3D, double);
277
278 protected:
279 vtkRenderWindowInteractor3D();
280 ~vtkRenderWindowInteractor3D() override;
281
282 int MouseInWindow;
283 int StartedMessageLoop;
284 double Translation3D[3];
285 double LastTranslation3D[3];
286
287 double WorldEventPositions[VTKI_MAX_POINTERS][3];
288 double LastWorldEventPositions[VTKI_MAX_POINTERS][3];
289 double PhysicalEventPositions[VTKI_MAX_POINTERS][3];
290 double LastPhysicalEventPositions[VTKI_MAX_POINTERS][3];
291 double StartingPhysicalEventPositions[VTKI_MAX_POINTERS][3];
292 double WorldEventOrientations[VTKI_MAX_POINTERS][4];
293 double LastWorldEventOrientations[VTKI_MAX_POINTERS][4];
294 vtkNew<vtkMatrix4x4> WorldEventPoses[VTKI_MAX_POINTERS];
295 vtkNew<vtkMatrix4x4> LastWorldEventPoses[VTKI_MAX_POINTERS];
296 vtkNew<vtkMatrix4x4> PhysicalEventPoses[VTKI_MAX_POINTERS];
297 vtkNew<vtkMatrix4x4> LastPhysicalEventPoses[VTKI_MAX_POINTERS];
298 vtkNew<vtkMatrix4x4> StartingPhysicalEventPoses[VTKI_MAX_POINTERS];
299 void RecognizeGesture(vtkCommand::EventIds) override;
300
301 private:
302 vtkRenderWindowInteractor3D(const vtkRenderWindowInteractor3D&) = delete;
303 void operator=(const vtkRenderWindowInteractor3D&) = delete;
304 };
305
306 VTK_ABI_NAMESPACE_END
307 #endif
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
vtkCommand::EventIds
EventIds
Definition: vtkCommand.h:451
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:40
vtkNew< vtkMatrix4x4 >
vtkObjectBase::GetClassName
const char * GetClassName() const
Return the class name as a string.
vtkObject::Modified
virtual void Modified()
Update the modification time for this object.
vtkRenderWindowInteractor3D
adds support for 3D events to vtkRenderWindowInteractor.
Definition: vtkRenderWindowInteractor3D.h:35
vtkRenderWindowInteractor3D::Disable
void Disable() override
Enable/Disable interactions.
vtkRenderWindowInteractor3D::SetPhysicalViewUp
virtual void SetPhysicalViewUp(double, double, double)
Set/get the direction of the physical coordinate system +Y axis in world coordinates.
Definition: vtkRenderWindowInteractor3D.h:249
vtkRenderWindowInteractor3D::SetPhysicalViewDirection
virtual void SetPhysicalViewDirection(double, double, double)
Set/get the direction of the physical coordinate system -Z axis in world coordinates.
Definition: vtkRenderWindowInteractor3D.h:241
vtkRenderWindowInteractor3D::GetPhysicalEventPose
virtual void GetPhysicalEventPose(vtkMatrix4x4 *poseMatrix, int pointerIndex)
With VR we know the physical/room coordinate positions and orientations of events.
vtkRenderWindowInteractor3D::RightButtonPressEvent
void RightButtonPressEvent() override
Override to set pointers down.
vtkRenderWindowInteractor3D::SetTranslation3D
void SetTranslation3D(double val[3])
Set/get the translation for pan/swipe gestures, update LastTranslation.
vtkRenderWindowInteractor3D::SetWorldEventPosition
virtual void SetWorldEventPosition(double x, double y, double z, int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
Definition: vtkRenderWindowInteractor3D.h:154
vtkRenderWindowInteractor3D::GetTouchPadPosition
virtual void GetTouchPadPosition(vtkEventDataDevice, vtkEventDataDeviceInput, float[3])
Get the latest touchpad or joystick position for a device.
Definition: vtkRenderWindowInteractor3D.h:234
vtkRenderWindowInteractor3D::GetPhysicalScale
virtual double GetPhysicalScale()
Set/get the physical scale (world / physical distance ratio)
Definition: vtkRenderWindowInteractor3D.h:266
vtkRenderWindowInteractor3D::RecognizeGesture
void RecognizeGesture(vtkCommand::EventIds) override
vtkRenderWindowInteractor3D::GetLastWorldEventOrientation
virtual double * GetLastWorldEventOrientation(int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
Definition: vtkRenderWindowInteractor3D.h:89
vtkRenderWindowInteractor3D::SetWorldEventOrientation
virtual void SetWorldEventOrientation(double w, double x, double y, double z, int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
Definition: vtkRenderWindowInteractor3D.h:178
vtkRenderWindowInteractor3D::GetWorldEventPosition
virtual double * GetWorldEventPosition(int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
Definition: vtkRenderWindowInteractor3D.h:65
vtkRenderWindowInteractor3D::RightButtonReleaseEvent
void RightButtonReleaseEvent() override
Override to set pointers down.
vtkRenderWindowInteractor3D::SetWorldEventPose
virtual void SetWorldEventPose(vtkMatrix4x4 *poseMatrix, int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
vtkRenderWindowInteractor3D::~vtkRenderWindowInteractor3D
~vtkRenderWindowInteractor3D() override
vtkRenderWindowInteractor3D::SetPhysicalEventPosition
virtual void SetPhysicalEventPosition(double x, double y, double z, int pointerIndex)
With VR we know the physical/room coordinate positions and orientations of events.
Definition: vtkRenderWindowInteractor3D.h:107
vtkRenderWindowInteractor3D::GetLastWorldEventPose
virtual void GetLastWorldEventPose(vtkMatrix4x4 *poseMatrix, int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
vtkRenderWindowInteractor3D::SetPhysicalScale
virtual void SetPhysicalScale(double)
Set/get the physical scale (world / physical distance ratio)
Definition: vtkRenderWindowInteractor3D.h:265
vtkRenderWindowInteractor3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderWindowInteractor3D::StartedMessageLoop
int StartedMessageLoop
Definition: vtkRenderWindowInteractor3D.h:283
vtkRenderWindowInteractor3D::SetPhysicalTranslation
virtual void SetPhysicalTranslation(vtkCamera *, double, double, double)
Set/get position of the physical coordinate system origin in world coordinates.
Definition: vtkRenderWindowInteractor3D.h:257
vtkRenderWindowInteractor3D::vtkRenderWindowInteractor3D
vtkRenderWindowInteractor3D()
vtkRenderWindowInteractor3D::GetWorldEventOrientation
virtual double * GetWorldEventOrientation(int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
Definition: vtkRenderWindowInteractor3D.h:81
vtkRenderWindowInteractor3D::GetWorldEventPose
virtual void GetWorldEventPose(vtkMatrix4x4 *poseMatrix, int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
vtkRenderWindowInteractor3D::MiddleButtonPressEvent
void MiddleButtonPressEvent() override
Override to set pointers down.
vtkRenderWindowInteractor3D::New
static vtkRenderWindowInteractor3D * New()
Construct object so that light follows camera motion.
vtkRenderWindowInteractor3D::MiddleButtonReleaseEvent
void MiddleButtonReleaseEvent() override
Override to set pointers down.
vtkRenderWindowInteractor3D::GetLastPhysicalEventPose
virtual void GetLastPhysicalEventPose(vtkMatrix4x4 *poseMatrix, int pointerIndex)
With VR we know the physical/room coordinate positions and orientations of events.
vtkRenderWindowInteractor3D::SetPhysicalEventPose
virtual void SetPhysicalEventPose(vtkMatrix4x4 *poseMatrix, int pointerIndex)
With VR we know the physical/room coordinate positions and orientations of events.
vtkRenderWindowInteractor3D::MouseInWindow
int MouseInWindow
Definition: vtkRenderWindowInteractor3D.h:282
vtkRenderWindowInteractor3D::GetStartingPhysicalEventPose
virtual void GetStartingPhysicalEventPose(vtkMatrix4x4 *poseMatrix, int pointerIndex)
With VR we know the physical/room coordinate positions and orientations of events.
vtkRenderWindowInteractor3D::Enable
void Enable() override
Enable/Disable interactions.
vtkRenderWindowInteractor3D::GetPhysicalViewUp
virtual double * GetPhysicalViewUp()
Set/get the direction of the physical coordinate system +Y axis in world coordinates.
Definition: vtkRenderWindowInteractor3D.h:250
vtkRenderWindowInteractor3D::GetPhysicalViewDirection
virtual double * GetPhysicalViewDirection()
Set/get the direction of the physical coordinate system -Z axis in world coordinates.
Definition: vtkRenderWindowInteractor3D.h:242
vtkRenderWindowInteractor3D::GetPhysicalTranslation
virtual double * GetPhysicalTranslation(vtkCamera *)
Set/get position of the physical coordinate system origin in world coordinates.
Definition: vtkRenderWindowInteractor3D.h:258
vtkRenderWindowInteractor3D::GetLastWorldEventPosition
virtual double * GetLastWorldEventPosition(int pointerIndex)
With VR we know the world coordinate positions and orientations of events.
Definition: vtkRenderWindowInteractor3D.h:73
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:82
vtkEventDataDevice
vtkEventDataDevice
platform-independent event data structures
Definition: vtkEventData.h:15
vtkEventDataDeviceInput
vtkEventDataDeviceInput
Definition: vtkEventData.h:29
vtkNew.h
vtkRenderWindowInteractor.h
VTKI_MAX_POINTERS
#define VTKI_MAX_POINTERS
Definition: vtkRenderWindowInteractor.h:68