VTK  9.4.20251007
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
35#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
168
170
176 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
178
180
188
190
195
197
203 vtkSetVector6Macro(WidgetBounds, double);
204 vtkGetVector6Macro(WidgetBounds, double);
206
208
219
221
226 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
228
234
240
249 void GetPlane(vtkPlane* plane);
250
257 void SetPlane(vtkPlane* plane);
258
264
266
269 vtkGetObjectMacro(NormalProperty, vtkProperty);
272
274
278 vtkGetObjectMacro(PlaneProperty, vtkProperty);
281
283
286 vtkGetObjectMacro(OutlineProperty, vtkProperty);
289
291
295 vtkGetObjectMacro(EdgesProperty, vtkProperty);
297
299
304 void SetInteractionColor(double, double, double);
305 void SetInteractionColor(double c[3]) { this->SetInteractionColor(c[0], c[1], c[2]); }
306 void SetHandleColor(double, double, double);
307 void SetHandleColor(double c[3]) { this->SetHandleColor(c[0], c[1], c[2]); }
308 void SetForegroundColor(double, double, double);
309 void SetForegroundColor(double c[3]) { this->SetForegroundColor(c[0], c[1], c[2]); }
311
313
317 void SetEdgeColor(double, double, double);
318 void SetEdgeColor(double c[3]);
320
322
327 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
328 vtkGetMacro(BumpDistance, double);
330
339 void BumpPlane(int dir, double factor);
340
347 void PushPlane(double distance);
348
350
353 int ComputeInteractionState(int X, int Y, int modify = 0) override;
354 void PlaceWidget(double bounds[6]) override;
355 void BuildRepresentation() override;
356 void StartWidgetInteraction(double eventPos[2]) override;
357 void WidgetInteraction(double newEventPos[2]) override;
358 void EndWidgetInteraction(double newEventPos[2]) override;
360 unsigned long event, void* calldata) override;
362 unsigned long event, void* calldata) override;
364 unsigned long event, void* calldata, int modify = 0) override;
366 unsigned long event, void* calldata) override;
368
370
373 double* GetBounds() VTK_SIZEHINT(6) override;
374 void GetActors(vtkPropCollection* pc) override;
380
381 // Manage the state of the widget
392
394
403 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
405
407
411 virtual void SetRepresentationState(int);
412 vtkGetMacro(RepresentationState, int);
414
415 // Get the underlying implicit plane object used by this rep
416 // that can be used as a cropping plane in vtkMapper.
417 vtkPlane* GetUnderlyingPlane() { return this->Plane; }
418
420
424 virtual void SetCropPlaneToBoundingBox(bool);
425 vtkGetMacro(CropPlaneToBoundingBox, bool);
426 vtkBooleanMacro(CropPlaneToBoundingBox, bool);
428
430
434 vtkGetMacro(SnapToAxes, bool);
435 vtkSetMacro(SnapToAxes, bool);
437
439
445 vtkGetMacro(AlwaysSnapToNearestAxis, bool);
446 virtual void SetAlwaysSnapToNearestAxis(bool snap)
447 {
448 this->AlwaysSnapToNearestAxis = snap;
449 this->SetNormal(this->GetNormal());
450 }
451
452
453protected:
456
458
459 // Keep track of event positions
463
464 // Controlling ivars
468
472
474
475 // Locking normal to camera
477
478 // Controlling the push operation
480
481 // The actual plane which is being manipulated
483
485
486 // The bounding box is represented by a single voxel image data
491 void HighlightOutline(int highlight);
492 vtkTypeBool OutlineTranslation; // whether the outline can be moved
493 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
494 vtkTypeBool OutsideBounds; // whether the widget can be moved outside input's bounds
495 double WidgetBounds[6];
497
498 // The cut plane is produced with a vtkCutter
500 vtkPlaneSource* PlaneSource; // used when plane cropping disabled
505 void HighlightPlane(int highlight);
506
507 // Optional tubes are represented by extracting boundary edges and tubing
512 vtkTypeBool Tubing; // control whether tubing is on
513
514 // The + normal cone
518 void HighlightNormal(int highlight);
519
520 // The normal line
524
525 // The - normal cone
529
530 // The origin positioning handle
534
535 // Do the picking
537
538 // Register internal Pickers within PickingManager
539 void RegisterPickers() override;
540
541 // Transform the normal (used for rotation)
543
544 // Methods to manipulate the plane
545 void Rotate(double X, double Y, double* p1, double* p2, double* vpn);
546 void Rotate3D(double* p1, double* p2);
547 void TranslateOutline(double* p1, double* p2);
548 void TranslateOrigin(double* p1, double* p2);
549 void UpdatePose(double* p1, double* d1, double* p2, double* d2);
550 void Push(double* p1, double* p2);
551 void Scale(double* p1, double* p2, double X, double Y);
553
554 // Properties used to control the appearance of selected objects and
555 // the manipulator in general.
564
566
567 // Support GetBounds() method
569
570private:
572 void operator=(const vtkImplicitPlaneRepresentation&) = delete;
573};
574
575VTK_ABI_NAMESPACE_END
576#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
Cut vtkDataSet with user-specified implicit function.
Definition vtkCutter.h:62
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
topologically and geometrically regular array of data
void SetXTranslationAxisOn()
Toggles constraint translation axis on/off.
void Rotate(double X, double Y, double *p1, double *p2, double *vpn)
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
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...
virtual void CreateDefaultProperties()
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.
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...
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...
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
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.
void TranslateOutline(double *p1, double *p2)
bool IsTranslationConstrained()
Returns true if ConstrainedAxis.
double * GetOrigin()
Get the origin of the plane.
void HighlightOutline(int highlight)
void SetYTranslationAxisOn()
Toggles constraint translation axis on/off.
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:29
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:46
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
#define vtkPolyDataAlgorithm
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)