VTK  9.5.2
vtkPlaneWidget.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
84
85#ifndef vtkPlaneWidget_h
86#define vtkPlaneWidget_h
87
88#include "vtkInteractionWidgetsModule.h" // For export macro
90
91VTK_ABI_NAMESPACE_BEGIN
92class vtkActor;
93class vtkCellPicker;
94class vtkConeSource;
95class vtkLineSource;
96class vtkPlaneSource;
97class vtkPoints;
98class vtkPolyData;
100class vtkProp;
101class vtkProperty;
102class vtkSphereSource;
103class vtkTransform;
104class vtkPlane;
105
106#define VTK_PLANE_OFF 0
107#define VTK_PLANE_OUTLINE 1
108#define VTK_PLANE_WIREFRAME 2
109#define VTK_PLANE_SURFACE 3
110
111#define VTK_PLANE_ZERO_THRESHOLD (std::numeric_limits<double>::min() * 1000)
112
113class VTKINTERACTIONWIDGETS_EXPORT vtkPlaneWidget : public vtkPolyDataSourceWidget
114{
115public:
120
122 void PrintSelf(ostream& os, vtkIndent indent) override;
123
125
128 void SetEnabled(int) override;
129 void PlaceWidget(double bounds[6]) override;
130 void PlaceWidget() override { this->Superclass::PlaceWidget(); }
132 double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
133 {
134 this->Superclass::PlaceWidget(xmin, xmax, ymin, ymax, zmin, zmax);
135 }
136
137
139
142 void SetResolution(int r);
145
147
150 void SetOrigin(double x, double y, double z);
151 void SetOrigin(double x[3]);
153 void GetOrigin(double xyz[3]);
155
157
160 void SetPoint1(double x, double y, double z);
161 void SetPoint1(double x[3]);
163 void GetPoint1(double xyz[3]);
165
167
170 void SetPoint2(double x, double y, double z);
171 void SetPoint2(double x[3]);
173 void GetPoint2(double xyz[3]);
175
177
180 void SetCenter(double x, double y, double z);
181 void SetCenter(double x[3]);
183 void GetCenter(double xyz[3]);
185
187
190 void SetNormal(double x, double y, double z);
191 void SetNormal(double x[3]);
193 void GetNormal(double xyz[3]);
195
197
206 vtkGetMacro(Representation, int);
212
214
222 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
225 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
228 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
230
240
248 void GetPlane(vtkPlane* plane);
249
257
262 void UpdatePlacement() override;
263
265
270 vtkGetObjectMacro(HandleProperty, vtkProperty);
273
275
280 vtkGetObjectMacro(PlaneProperty, vtkProperty);
283
284protected:
286 ~vtkPlaneWidget() override;
287
288 // Manage the state of the widget
289 int State;
301
302 // handles the events
303 static void ProcessEvents(
304 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
305
306 // ProcessEvents() dispatches to these methods.
315 void OnPinch();
317
318 // controlling ivars
324
325 // the plane
330 void HighlightPlane(int highlight);
331
332 // glyphs representing hot spots (e.g., handles)
337 void HandlesOn(double length);
339 int HighlightHandle(vtkProp* prop); // returns cell id
340 void SizeHandles() override;
341
342 // the normal cone
346 void HighlightNormal(int highlight);
347
348 // the normal line
352
353 // the normal cone
357
358 // the normal line
362
363 // Do the picking
367
368 // Register internal Pickers within PickingManager
369 void RegisterPickers() override;
370
371 // Methods to manipulate the hexahedron.
372 void MoveOrigin(double* p1, double* p2);
373 void MovePoint1(double* p1, double* p2);
374 void MovePoint2(double* p1, double* p2);
375 void MovePoint3(double* p1, double* p2);
376 void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
377 void Spin(double* p1, double* p2);
378 void Scale(double* p1, double* p2, int X, int Y);
379 void Translate(double* p1, double* p2);
380 void Push(double* p1, double* p2);
381
382 // Plane normal, normalized
383 double Normal[3];
384
385 // Transform the hexahedral points (used for rotations)
387
388 // Properties used to control the appearance of selected objects and
389 // the manipulator in general.
395
397
400
401private:
402 vtkPlaneWidget(const vtkPlaneWidget&) = delete;
403 void operator=(const vtkPlaneWidget&) = delete;
404};
405
406VTK_ABI_NAMESPACE_END
407#endif
virtual void PlaceWidget()
This method is used to initially place the widget.
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
a simple class to control print indentation
Definition vtkIndent.h:108
create a line defined by two end points
abstract base class for most VTK objects
Definition vtkObject.h:159
create an array of quadrilaterals located in a plane
vtkProperty * HandleProperty
void MovePoint3(double *p1, double *p2)
virtual void SetRepresentation(int)
Control how the plane appears when GetPolyData() is invoked.
void SetOrigin(double x, double y, double z)
Set/Get the origin of the plane.
vtkConeSource * ConeSource
vtkTypeBool NormalToYAxis
vtkPlaneSource * PlaneSource
double * GetCenter()
Get the center of the plane.
vtkSphereSource ** HandleGeometry
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLineSource * LineSource
~vtkPlaneWidget() override
void GetPlane(vtkPlane *plane)
Get the planes describing the implicit function defined by the plane widget.
void MovePoint2(double *p1, double *p2)
vtkPolyDataAlgorithm * GetPolyDataAlgorithm() override
Satisfies superclass API.
void PlaceWidget(double bounds[6]) override
Methods that satisfy the superclass' API.
double * GetOrigin()
Set/Get the origin of the plane.
vtkPolyDataMapper * PlaneMapper
void OnRightButtonUp()
vtkProperty * PlaneProperty
void PlaceWidget() override
Methods that satisfy the superclass' API.
void UpdatePlacement() override
Satisfies superclass API.
void PlaceWidget(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) override
Methods that satisfy the superclass' API.
int HighlightHandle(vtkProp *prop)
vtkActor * ConeActor2
vtkActor ** Handle
void SetPoint1(double x, double y, double z)
Set/Get the position of the point defining the first axis of the plane.
void OnStartPinch()
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void CreateDefaultProperties()
void OnLeftButtonDown()
void HighlightNormal(int highlight)
void SetEnabled(int) override
Methods that satisfy the superclass' API.
void GetPolyData(vtkPolyData *pd)
Grab the polydata (including points) that defines the plane.
vtkPolyDataMapper * LineMapper2
void MovePoint1(double *p1, double *p2)
void SetNormal(double x, double y, double z)
Get the normal to the plane.
void SetCenter(double x, double y, double z)
Get the center of the plane.
static vtkPlaneWidget * New()
Instantiate the object.
vtkProperty * SelectedHandleProperty
void GeneratePlane()
vtkPolyDataMapper * ConeMapper2
void Scale(double *p1, double *p2, int X, int Y)
void Push(double *p1, double *p2)
vtkProperty * SelectedPlaneProperty
void OnLeftButtonUp()
void SizeHandles() override
void HandlesOn(double length)
void MoveOrigin(double *p1, double *p2)
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void OnMouseMove()
double * GetNormal()
Get the normal to the plane.
double * GetPoint1()
Set/Get the position of the point defining the first axis of the plane.
void SetResolution(int r)
Set/Get the resolution (number of subdivisions) of the plane.
vtkPolyDataMapper ** HandleMapper
vtkCellPicker * HandlePicker
vtkPolyDataMapper * LineMapper
vtkActor * ConeActor
vtkTypeBool NormalToZAxis
double * GetPoint2()
Set/Get the position of the point defining the second axis of the plane.
void SetRepresentationToSurface()
Control how the plane appears when GetPolyData() is invoked.
void SetRepresentationToOutline()
Control how the plane appears when GetPolyData() is invoked.
vtkActor * CurrentHandle
void SelectRepresentation()
void SetOrigin(double x[3])
Set/Get the origin of the plane.
int GetResolution()
Set/Get the resolution (number of subdivisions) of the plane.
vtkPolyData * PlaneOutline
vtkTransform * Transform
void PositionHandles()
void OnMiddleButtonDown()
vtkLineSource * LineSource2
void SetPoint2(double x, double y, double z)
Set/Get the position of the point defining the second axis of the plane.
vtkPolyDataMapper * ConeMapper
void OnRightButtonDown()
vtkCellPicker * PlanePicker
virtual void SetPlaneProperty(vtkProperty *)
Get the plane properties.
void Rotate(int X, int Y, double *p1, double *p2, double *vpn)
vtkConeSource * ConeSource2
vtkActor * LineActor
void SetRepresentationToOff()
Control how the plane appears when GetPolyData() is invoked.
void Spin(double *p1, double *p2)
void HighlightPlane(int highlight)
vtkActor * PlaneActor
void SetRepresentationToWireframe()
Control how the plane appears when GetPolyData() is invoked.
void Translate(double *p1, double *p2)
void OnMiddleButtonUp()
vtkTypeBool NormalToXAxis
vtkActor * LineActor2
perform various plane computations
Definition vtkPlane.h:141
represent and manipulate 3D points
Definition vtkPoints.h:139
map vtkPolyData to graphics primitives
vtkPolyDataSourceWidget()
Empty constructor that calls the parent constructor.
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:63
represent surface properties of a geometric object
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
int vtkTypeBool
Definition vtkABI.h:64
#define vtkPolyDataAlgorithm
#define VTK_PLANE_OUTLINE
#define VTK_PLANE_WIREFRAME
#define VTK_PLANE_OFF
#define VTK_PLANE_SURFACE
#define VTK_SIZEHINT(...)