VTK  9.5.20251120
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
50
51#ifndef vtkImplicitPlaneRepresentation_h
52#define vtkImplicitPlaneRepresentation_h
53
55#include "vtkInteractionWidgetsModule.h" // For export macro
56#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
57
58VTK_ABI_NAMESPACE_BEGIN
59class vtkActor;
60class vtkBox;
61class vtkCellPicker;
62class vtkConeSource;
63class vtkCutter;
64class vtkFeatureEdges;
65class vtkImageData;
66class vtkLineSource;
67class vtkLookupTable;
69class vtkPlane;
70class vtkPlaneSource;
71class vtkPolyData;
74class vtkProperty;
75class vtkSphereSource;
76class vtkTransform;
77class vtkTubeFilter;
78
79class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkImplicitPlaneRepresentation
81{
82public:
87
89
93 void PrintSelf(ostream& os, vtkIndent indent) override;
95
97
100 void SetOrigin(double x, double y, double z);
101 void SetOrigin(double x[3]);
103 void GetOrigin(double xyz[3]);
105
107
110 void SetNormal(double x, double y, double z);
111 void SetNormal(double n[3]);
114 void GetNormal(double xyz[3]);
116
118
127 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
130 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
133 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
135
137
146
148
152 vtkSetMacro(Tubing, vtkTypeBool);
153 vtkGetMacro(Tubing, vtkTypeBool);
154 vtkBooleanMacro(Tubing, vtkTypeBool);
156
158
165 vtkGetMacro(DrawPlane, vtkTypeBool);
166 vtkBooleanMacro(DrawPlane, vtkTypeBool);
168
170
175 vtkBooleanMacro(DrawOutline, vtkTypeBool);
177
179
184 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
186
192
198
207 void GetPlane(vtkPlane* plane);
208
215 void SetPlane(vtkPlane* plane);
216
222
224
227 vtkGetObjectMacro(NormalProperty, vtkProperty);
230
232
236 vtkGetObjectMacro(PlaneProperty, vtkProperty);
239
241
245 vtkGetObjectMacro(EdgesProperty, vtkProperty);
247
249
254 void SetInteractionColor(double, double, double);
255 void SetInteractionColor(double c[3]) { this->SetInteractionColor(c[0], c[1], c[2]); }
256 void SetHandleColor(double, double, double);
257 void SetHandleColor(double c[3]) { this->SetHandleColor(c[0], c[1], c[2]); }
258 void SetForegroundColor(double, double, double);
259 void SetForegroundColor(double c[3]) { this->SetForegroundColor(c[0], c[1], c[2]); }
261
263
267 void SetEdgeColor(double, double, double);
268 void SetEdgeColor(double c[3]);
270
272
277 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
278 vtkGetMacro(BumpDistance, double);
280
289 void BumpPlane(int dir, double factor);
290
297 void PushPlane(double distance);
298
300
303 int ComputeInteractionState(int X, int Y, int modify = 0) override;
304 void PlaceWidget(double bounds[6]) override;
305 void BuildRepresentation() override;
306 void StartWidgetInteraction(double eventPos[2]) override;
307 void WidgetInteraction(double newEventPos[2]) override;
308 void EndWidgetInteraction(double newEventPos[2]) override;
310 unsigned long event, void* calldata) override;
312 unsigned long event, void* calldata) override;
314 unsigned long event, void* calldata, int modify = 0) override;
316 unsigned long event, void* calldata) override;
318
320
323 double* GetBounds() VTK_SIZEHINT(6) override;
324 void GetActors(vtkPropCollection* pc) override;
330
331 // Manage the state of the widget
342
344
353 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
355
357
361 virtual void SetRepresentationState(int);
362 vtkGetMacro(RepresentationState, int);
364
365 // Get the underlying implicit plane object used by this rep
366 // that can be used as a cropping plane in vtkMapper.
367 vtkPlane* GetUnderlyingPlane() { return this->Plane; }
368
370
374 virtual void SetCropPlaneToBoundingBox(bool);
375 vtkGetMacro(CropPlaneToBoundingBox, bool);
376 vtkBooleanMacro(CropPlaneToBoundingBox, bool);
378
380
384 vtkGetMacro(SnapToAxes, bool);
385 vtkSetMacro(SnapToAxes, bool);
387
389
395 vtkGetMacro(AlwaysSnapToNearestAxis, bool);
396 virtual void SetAlwaysSnapToNearestAxis(bool snap)
397 {
398 this->AlwaysSnapToNearestAxis = snap;
399 this->SetNormal(this->GetNormal());
400 }
401
402
403protected:
406
408
409 // Keep track of event positions
413
414 // Controlling ivars
418
422
424
425 // Locking normal to camera
427
428 // Controlling the push operation
430
431 // The actual plane which is being manipulated
433
434 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
435
436 // The cut plane is produced with a vtkCutter
438 vtkPlaneSource* PlaneSource; // used when plane cropping disabled
443 void HighlightPlane(int highlight);
444
445 // Optional tubes are represented by extracting boundary edges and tubing
450 vtkTypeBool Tubing; // control whether tubing is on
451
452 // The + normal cone
456 void HighlightNormal(int highlight);
457
458 // The normal line
462
463 // The - normal cone
467
468 // The origin positioning handle
472
473 // Do the picking
475
476 // Register internal Pickers within PickingManager
477 void RegisterPickers() override;
478
479 // Transform the normal (used for rotation)
481
482 // Methods to manipulate the plane
483 void Rotate(double X, double Y, double* p1, double* p2, double* vpn);
484 void Rotate3D(double* p1, double* p2);
486 void TranslateOrigin(double* p1, double* p2);
487 void UpdatePose(double* p1, double* d1, double* p2, double* d2);
488 void Push(double* p1, double* p2);
489 void Scale(double* p1, double* p2, double X, double Y);
491
492 // Properties used to control the appearance of selected objects and
493 // the manipulator in general.
501 void CreateDefaultProperties() override;
502
504
505 // Support GetBounds() method
507
508private:
510 void operator=(const vtkImplicitPlaneRepresentation&) = delete;
511};
512
513VTK_ABI_NAMESPACE_END
514#endif
define the API for widget / widget representation
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
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:108
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:141
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
an ordered list of Props
represent surface properties of a geometric object
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:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
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