VTK  9.3.20240419
vtkFinitePlaneRepresentation.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
22 #ifndef vtkFinitePlaneRepresentation_h
23 #define vtkFinitePlaneRepresentation_h
24 
25 #include "vtkInteractionWidgetsModule.h" // For export macro
27 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
28 
29 VTK_ABI_NAMESPACE_BEGIN
30 class vtkActor;
31 class vtkBox;
32 class vtkCellPicker;
33 class vtkConeSource;
34 class vtkFeatureEdges;
35 class vtkLineSource;
36 class vtkPolyData;
37 class vtkPolyDataMapper;
38 class vtkProperty;
39 class vtkSphereSource;
40 class vtkTransform;
41 class vtkTubeFilter;
42 
43 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkFinitePlaneRepresentation
45 {
46 public:
51 
53 
57  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
65 
67 
72  vtkGetObjectMacro(V1HandleProperty, vtkProperty);
73  vtkGetObjectMacro(V2HandleProperty, vtkProperty);
74  vtkGetObjectMacro(SelectedHandleProperty, vtkProperty);
76 
78 
83  vtkGetObjectMacro(PlaneProperty, vtkProperty);
84  vtkGetObjectMacro(SelectedPlaneProperty, vtkProperty);
86 
88 
92  vtkSetMacro(Tubing, bool);
93  vtkGetMacro(Tubing, bool);
94  vtkBooleanMacro(Tubing, bool);
96 
98 
104  void SetDrawPlane(bool plane);
105  vtkGetMacro(DrawPlane, bool);
106  vtkBooleanMacro(DrawPlane, bool);
108 
110 
114  void SetHandles(bool handles);
115  virtual void HandlesOn();
116  virtual void HandlesOff();
118 
120 
123  void PlaceWidget(double bounds[6]) override;
124  void BuildRepresentation() override;
125  int ComputeInteractionState(int X, int Y, int modify = 0) override;
126  void StartWidgetInteraction(double e[2]) override;
127  void WidgetInteraction(double e[2]) override;
128  double* GetBounds() override;
130 
132 
140 
141  vtkSetClampMacro(InteractionState, int, Outside, Pushing);
142 
144 
147  void SetOrigin(double x, double y, double z);
148  void SetOrigin(double x[3]);
149  vtkGetVector3Macro(Origin, double);
151 
153 
156  void SetNormal(double x, double y, double z);
157  void SetNormal(double n[3]);
158  vtkGetVector3Macro(Normal, double);
160 
162 
165  void SetV1(double x, double y);
166  void SetV1(double x[2]);
167  vtkGetVector2Macro(V1, double);
169 
171 
174  void SetV2(double x, double y);
175  void SetV2(double x[2]);
176  vtkGetVector2Macro(V2, double);
178 
180 
184  virtual void SetRepresentationState(int);
185  vtkGetMacro(RepresentationState, int);
187 
189 
192  vtkGetObjectMacro(NormalProperty, vtkProperty);
193  vtkGetObjectMacro(SelectedNormalProperty, vtkProperty);
195 
196  // Methods to manipulate the plane
197  void TranslateOrigin(double* p1, double* p2);
198  void MovePoint1(double* p1, double* p2);
199  void MovePoint2(double* p1, double* p2);
200  void Push(double* p1, double* p2);
201  void Rotate(int X, int Y, double* p1, double* p2, double* vpn);
202 
204  {
205  Outside = 0,
211  Pushing
212  };
213 
214  /*
215  * Register internal Pickers within PickingManager
216  */
217  void RegisterPickers() override;
218 
219 protected:
222 
223  virtual void CreateDefaultProperties();
224 
225  // Size the glyphs representing hot spots (e.g., handles)
226  virtual void SizeHandles();
227 
228  void SetHighlightNormal(int highlight);
229  void SetHighlightPlane(int highlight);
231 
232  double LastEventPosition[3];
233 
234  // the representation state
236 
237  // the origin
241  double Origin[3];
242 
243  // the normal
244  double Normal[3];
245 
246  // the previous normal
247  double PreviousNormal[3];
248 
249  // the rotation transform
251 
252  // the X Vector
256  double V1[3];
257 
258  // the Y Vector
262  double V2[3];
263 
264  // The + normal cone
268 
269  // The + normal line
273 
274  // The - normal cone
278 
279  // The - normal line
283 
284  // The finite plane
288 
289  // Optional tubes are represented by extracting boundary edges
294  bool Tubing; // control whether tubing is on
295  bool DrawPlane; // control whether plane is on
296 
297  // Picking objects
300 
301  // Transform the planes (used for rotations)
303 
304  // Support GetBounds() method
306 
307  // Properties used to control the appearance of selected objects and
308  // the manipulator in general.
317 
318 private:
320  void operator=(const vtkFinitePlaneRepresentation&) = delete;
321 };
322 
323 VTK_ABI_NAMESPACE_END
324 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:151
implicit function for a bounding box
Definition: vtkBox.h:110
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:91
generate polygonal cone
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
represent the vtkFinitePlaneWidget.
void Rotate(int X, int Y, double *p1, double *p2, double *vpn)
void SetHighlightNormal(int highlight)
void SetDrawPlane(bool plane)
Enable/disable the drawing of the plane.
void SetV2(double x[2])
Set/Get the v2 vector of the plane.
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting, and required by, the rendering process.
virtual void CreateDefaultProperties()
void SetHighlightHandle(vtkProp *prop)
void SetOrigin(double x, double y, double z)
Set/Get the origin of the plane.
virtual void HandlesOn()
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
virtual void SetRepresentationState(int)
Sets the visual appearance of the representation based on the state it is in.
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
double * GetBounds() override
These are methods that satisfy vtkWidgetRepresentation's API.
void SetNormal(double x, double y, double z)
Set/Get the normal to the plane.
void SetHighlightPlane(int highlight)
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting, and required by, the rendering process.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void SetHandles(bool handles)
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
void StartWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void SetNormal(double n[3])
Set/Get the normal to the plane.
void SetOrigin(double x[3])
Set/Get the origin of the plane.
void SetV1(double x[2])
Set/Get the v1 vector of the plane.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting, and required by, the rendering process.
void GetPolyData(vtkPolyData *pd)
Grab the polydata that defines the plane.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting, and required by, the rendering process.
void SetV1(double x, double y)
Set/Get the v1 vector of the plane.
static vtkFinitePlaneRepresentation * New()
Instantiate the class.
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
void PlaceWidget(double bounds[6]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void TranslateOrigin(double *p1, double *p2)
void WidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void MovePoint1(double *p1, double *p2)
virtual void HandlesOff()
Switches handles (the spheres) on or off by manipulating the underlying actor visibility.
void SetV2(double x, double y)
Set/Get the v2 vector of the plane.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard vtkObject methods.
~vtkFinitePlaneRepresentation() override
void MovePoint2(double *p1, double *p2)
void Push(double *p1, double *p2)
a simple class to control print indentation
Definition: vtkIndent.h:108
create a line defined by two end points
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:66
represent surface properties of a geometric object
Definition: vtkProperty.h:167
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:160
filter that generates tubes around lines
abstract specification for Viewports
Definition: vtkViewport.h:65
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ Normal
Definition: vtkX3D.h:45
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_MARSHALAUTO