VTK  9.6.1
vtkImplicitPlaneRepresentation.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
31
32#ifndef vtkImplicitPlaneRepresentation_h
33#define vtkImplicitPlaneRepresentation_h
34
36#include "vtkInteractionWidgetsModule.h" // For export macro
37#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
38
39VTK_ABI_NAMESPACE_BEGIN
40class vtkActor;
41class vtkBox;
42class vtkCellPicker;
43class vtkConeSource;
44class vtkCutter;
45class vtkFeatureEdges;
46class vtkImageData;
47class vtkLineSource;
48class vtkLookupTable;
50class vtkPlane;
51class vtkPlaneSource;
52class vtkPolyData;
55class vtkProperty;
56class vtkSphereSource;
57class vtkTransform;
58class vtkTubeFilter;
59
60class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkImplicitPlaneRepresentation
62{
63public:
68
70
74 void PrintSelf(ostream& os, vtkIndent indent) override;
76
78
81 void SetOrigin(double x, double y, double z);
82 void SetOrigin(double x[3]);
83 double* GetOrigin() VTK_SIZEHINT(3);
84 void GetOrigin(double xyz[3]);
86
88
91 void SetNormal(double x, double y, double z);
92 void SetNormal(double n[3]);
94 double* GetNormal() VTK_SIZEHINT(3);
95 void GetNormal(double xyz[3]);
97
99
108 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
111 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
114 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
116
118
127
129
133 vtkSetMacro(Tubing, vtkTypeBool);
134 vtkGetMacro(Tubing, vtkTypeBool);
135 vtkBooleanMacro(Tubing, vtkTypeBool);
137
139
146 vtkGetMacro(DrawPlane, vtkTypeBool);
147 vtkBooleanMacro(DrawPlane, vtkTypeBool);
149
151
156 vtkBooleanMacro(DrawOutline, vtkTypeBool);
158
160
165 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
167
173
179
188 void GetPlane(vtkPlane* plane);
189
196 void SetPlane(vtkPlane* plane);
197
203
205
208 vtkGetObjectMacro(NormalProperty, vtkProperty);
211
213
217 vtkGetObjectMacro(PlaneProperty, vtkProperty);
220
222
226 vtkGetObjectMacro(EdgesProperty, vtkProperty);
228
230
235 void SetInteractionColor(double, double, double);
236 void SetInteractionColor(double c[3]) { this->SetInteractionColor(c[0], c[1], c[2]); }
237 void SetHandleColor(double, double, double);
238 void SetHandleColor(double c[3]) { this->SetHandleColor(c[0], c[1], c[2]); }
239 void SetForegroundColor(double, double, double);
240 void SetForegroundColor(double c[3]) { this->SetForegroundColor(c[0], c[1], c[2]); }
242
244
248 void SetEdgeColor(double, double, double);
249 void SetEdgeColor(double c[3]);
251
253
258 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
259 vtkGetMacro(BumpDistance, double);
261
270 void BumpPlane(int dir, double factor);
271
278 void PushPlane(double distance);
279
281
284 int ComputeInteractionState(int X, int Y, int modify = 0) override;
285 void PlaceWidget(double bounds[6]) override;
286 void BuildRepresentation() override;
287 void StartWidgetInteraction(double eventPos[2]) override;
288 void WidgetInteraction(double newEventPos[2]) override;
289 void EndWidgetInteraction(double newEventPos[2]) override;
291 unsigned long event, void* calldata) override;
293 unsigned long event, void* calldata) override;
295 unsigned long event, void* calldata, int modify = 0) override;
297 unsigned long event, void* calldata) override;
299
301
304 double* GetBounds() VTK_SIZEHINT(6) override;
305 void GetActors(vtkPropCollection* pc) override;
311
312 // Manage the state of the widget
323
325
334 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
336
338
342 virtual void SetRepresentationState(int);
343 vtkGetMacro(RepresentationState, int);
345
346 // Get the underlying implicit plane object used by this rep
347 // that can be used as a cropping plane in vtkMapper.
348 vtkPlane* GetUnderlyingPlane() { return this->Plane; }
349
351
355 virtual void SetCropPlaneToBoundingBox(bool);
356 vtkGetMacro(CropPlaneToBoundingBox, bool);
357 vtkBooleanMacro(CropPlaneToBoundingBox, bool);
359
361
365 vtkGetMacro(SnapToAxes, bool);
366 vtkSetMacro(SnapToAxes, bool);
368
370
376 vtkGetMacro(AlwaysSnapToNearestAxis, bool);
377 virtual void SetAlwaysSnapToNearestAxis(bool snap)
378 {
379 this->AlwaysSnapToNearestAxis = snap;
380 this->SetNormal(this->GetNormal());
381 }
382
383
384protected:
387
389
390 // Keep track of event positions
394
395 // Controlling ivars
399
403
405
406 // Locking normal to camera
408
409 // Controlling the push operation
411
412 // The actual plane which is being manipulated
414
415 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
416
417 // The cut plane is produced with a vtkCutter
419 vtkPlaneSource* PlaneSource; // used when plane cropping disabled
424 void HighlightPlane(int highlight);
425
426 // Optional tubes are represented by extracting boundary edges and tubing
431 vtkTypeBool Tubing; // control whether tubing is on
432
433 // The + normal cone
437 void HighlightNormal(int highlight);
438
439 // The normal line
443
444 // The - normal cone
448
449 // The origin positioning handle
453
454 // Do the picking
456
457 // Register internal Pickers within PickingManager
458 void RegisterPickers() override;
459
460 // Transform the normal (used for rotation)
462
463 // Methods to manipulate the plane
464 void Rotate(double X, double Y, double* p1, double* p2, double* vpn);
465 void Rotate3D(double* p1, double* p2);
467 void TranslateOrigin(double* p1, double* p2);
468 void UpdatePose(double* p1, double* d1, double* p2, double* d2);
469 void Push(double* p1, double* p2);
470 void Scale(double* p1, double* p2, double X, double Y);
472
473 // Properties used to control the appearance of selected objects and
474 // the manipulator in general.
482 void CreateDefaultProperties() override;
483
485
486 // Support GetBounds() method
488
489private:
491 void operator=(const vtkImplicitPlaneRepresentation&) = delete;
492};
493
494VTK_ABI_NAMESPACE_END
495#endif
define the API for widget / widget representation
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:42
implicit function for a bounding box
Definition vtkBox.h:31
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
topologically and geometrically regular array of data
void Rotate(double X, double Y, double *p1, double *p2, double *vpn)
void EndWidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkImplicitPlaneWidget2.
void SetEdgeColor(vtkLookupTable *)
Set color to the edge.
void SetHandleColor(double c[3])
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
virtual void SetCropPlaneToBoundingBox(bool)
Control if the plane should be drawn cropped by the bounding box or without cropping.
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkImplicitPlaneWidget2.
void GetPolyData(vtkPolyData *pd)
Grab the polydata that defines the plane.
void SetEdgeColor(double c[3])
Set color to the edge.
void Scale(double *p1, double *p2, double X, double Y)
virtual void SetLockNormalToCamera(vtkTypeBool)
If enabled, and a vtkCamera is available through the renderer, then LockNormalToCamera will cause the...
vtkPolyDataAlgorithm * GetPolyDataAlgorithm()
Satisfies superclass API.
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
void HighlightPlane(int highlight)
int ComputeInteractionState(int X, int Y, int modify=0) override
Methods to interface with the vtkImplicitPlaneWidget2.
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting the rendering process.
void SetNormalToYAxis(vtkTypeBool)
Force the plane widget to be aligned with one of the x-y-z axes.
void TranslateRepresentation(const vtkVector3d &) override
Translate the representation, to be implemented in derived class.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
void SetOrigin(double x[3])
Get the origin of the plane.
void HighlightNormal(int highlight)
void BuildRepresentation() override
Methods to interface with the vtkImplicitPlaneWidget2.
void GetPlane(vtkPlane *plane)
Get the implicit function for the plane by copying the origin and normal of the cut plane into the pr...
void StartComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkImplicitPlaneWidget2.
void GetActors(vtkPropCollection *pc) override
Methods supporting the rendering process.
void SetNormalToXAxis(vtkTypeBool)
Force the plane widget to be aligned with one of the x-y-z axes.
void SetNormalToZAxis(vtkTypeBool)
Force the plane widget to be aligned with one of the x-y-z axes.
void Push(double *p1, double *p2)
static vtkImplicitPlaneRepresentation * New()
Instantiate the class.
void SetInteractionColor(double, double, double)
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
void CreateDefaultProperties() override
Create and initialize properties with default values.
virtual void SetAlwaysSnapToNearestAxis(bool snap)
Forces the plane's normal to be aligned with x, y or z axis.
void SetForegroundColor(double c[3])
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
void UpdatePlacement()
Satisfies the superclass API.
int ComputeComplexInteractionState(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata, int modify=0) override
Methods to interface with the vtkImplicitPlaneWidget2.
void EndComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkImplicitPlaneWidget2.
void WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkImplicitPlaneWidget2.
void SetNormalToCamera()
Get the normal to the plane.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
void SetDrawOutline(vtkTypeBool plane)
Enable/disable the drawing of the outline.
void ComplexInteraction(vtkRenderWindowInteractor *iren, vtkAbstractWidget *widget, unsigned long event, void *calldata) override
Methods to interface with the vtkImplicitPlaneWidget2.
void PushPlane(double distance)
Push the plane the distance specified along the normal.
void SetOrigin(double x, double y, double z)
Get the origin of the plane.
void StartWidgetInteraction(double eventPos[2]) override
Methods to interface with the vtkImplicitPlaneWidget2.
void BumpPlane(int dir, double factor)
Translate the plane in the direction of the normal by the specified BumpDistance.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting the rendering process.
void TranslateOrigin(double *p1, double *p2)
double * GetNormal()
Get the normal to the plane.
void SetHandleColor(double, double, double)
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
double * GetBounds() override
Methods supporting the rendering process.
void SetEdgeColor(double, double, double)
Set color to the edge.
void SetDrawPlane(vtkTypeBool plane)
Enable/disable the drawing of the plane.
void SetForegroundColor(double, double, double)
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
virtual void SetRepresentationState(int)
Sets the visual appearance of the representation based on the state it is in.
void SetNormal(double x, double y, double z)
Get the normal to the plane.
void UpdatePose(double *p1, double *d1, double *p2, double *d2)
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
double * GetOrigin()
Get the origin of the plane.
void SetPlane(vtkPlane *plane)
Alternative way to define the cutting plane.
~vtkImplicitPlaneRepresentation() override
void SetInteractionColor(double c[3])
Set the color of all the widget's handles (edges, cone1, cone2, line, sphere, selected plane) and the...
void Rotate3D(double *p1, double *p2)
a simple class to control print indentation
Definition vtkIndent.h:29
create a line defined by two end points
map scalar values into colors via a lookup table
create wireframe outline for an arbitrary data set or composite dataset
create an array of quadrilaterals located in a plane
perform various plane computations
Definition vtkPlane.h:32
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:60
platform-independent render window interaction including picking and frame rate control.
create a polygonal sphere centered at the origin
describes linear transformations via a 4x4 matrix
filter that generates tubes around lines
abstract specification for Viewports
Definition vtkViewport.h:47
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)
#define vtkPolyDataAlgorithm
#define vtkCutter
Definition vtkmSlice.h:23