VTK  9.2.6
vtkImplicitPlaneRepresentation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkImplicitPlaneRepresentation.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
37
38#ifndef vtkImplicitPlaneRepresentation_h
39#define vtkImplicitPlaneRepresentation_h
40
41#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
42#include "vtkInteractionWidgetsModule.h" // For export macro
44
45class vtkActor;
46class vtkBox;
47class vtkCellPicker;
48class vtkConeSource;
49class vtkCutter;
50class vtkFeatureEdges;
51class vtkImageData;
52class vtkLineSource;
53class vtkLookupTable;
55class vtkPlane;
56class vtkPlaneSource;
57class vtkPolyData;
60class vtkProperty;
61class vtkSphereSource;
62class vtkTransform;
63class vtkTubeFilter;
64
65class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitPlaneRepresentation : public vtkWidgetRepresentation
66{
67public:
72
74
78 void PrintSelf(ostream& os, vtkIndent indent) override;
80
82
85 void SetOrigin(double x, double y, double z);
86 void SetOrigin(double x[3]);
87 double* GetOrigin() VTK_SIZEHINT(3);
88 void GetOrigin(double xyz[3]);
90
92
95 void SetNormal(double x, double y, double z);
96 void SetNormal(double n[3]);
98 double* GetNormal() VTK_SIZEHINT(3);
99 void GetNormal(double xyz[3]);
101
103
112 vtkBooleanMacro(NormalToXAxis, vtkTypeBool);
115 vtkBooleanMacro(NormalToYAxis, vtkTypeBool);
118 vtkBooleanMacro(NormalToZAxis, vtkTypeBool);
120
122
131
133
137 vtkSetMacro(Tubing, vtkTypeBool);
138 vtkGetMacro(Tubing, vtkTypeBool);
139 vtkBooleanMacro(Tubing, vtkTypeBool);
141
143
150 vtkGetMacro(DrawPlane, vtkTypeBool);
151 vtkBooleanMacro(DrawPlane, vtkTypeBool);
153
155
160 vtkBooleanMacro(DrawOutline, vtkTypeBool);
162
164
172
174
180 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
182
184
192
194
199
201
207 vtkSetVector6Macro(WidgetBounds, double);
208 vtkGetVector6Macro(WidgetBounds, double);
210
212
223
225
230 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
232
238
244
252 void GetPlane(vtkPlane* plane);
253
259 void SetPlane(vtkPlane* plane);
260
265 void UpdatePlacement(void);
266
268
271 vtkGetObjectMacro(NormalProperty, vtkProperty);
274
276
280 vtkGetObjectMacro(PlaneProperty, vtkProperty);
283
285
288 vtkGetObjectMacro(OutlineProperty, vtkProperty);
291
293
297 vtkGetObjectMacro(EdgesProperty, vtkProperty);
300
304 void SetEdgeColor(double, double, double);
305 void SetEdgeColor(double c[3]);
307
309
314 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
315 vtkGetMacro(BumpDistance, double);
317
326 void BumpPlane(int dir, double factor);
327
334 void PushPlane(double distance);
335
337
340 int ComputeInteractionState(int X, int Y, int modify = 0) override;
341 void PlaceWidget(double bounds[6]) override;
342 void BuildRepresentation() override;
343 void StartWidgetInteraction(double eventPos[2]) override;
344 void WidgetInteraction(double newEventPos[2]) override;
345 void EndWidgetInteraction(double newEventPos[2]) override;
347 unsigned long event, void* calldata) override;
349 unsigned long event, void* calldata) override;
351 unsigned long event, void* calldata, int modify = 0) override;
353 unsigned long event, void* calldata) override;
355
357
360 double* GetBounds() VTK_SIZEHINT(6) override;
361 void GetActors(vtkPropCollection* pc) override;
367
368 // Manage the state of the widget
379#if !defined(VTK_LEGACY_REMOVE)
380 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
382#endif
383
385
394 vtkSetClampMacro(InteractionState, int, Outside, Scaling);
396
398
402 virtual void SetRepresentationState(int);
403 vtkGetMacro(RepresentationState, int);
405
406 // Get the underlying implicit plane object used by this rep
407 // that can be used as a cropping plane in vtkMapper.
408 vtkPlane* GetUnderlyingPlane() { return this->Plane; }
409
411
415 virtual void SetCropPlaneToBoundingBox(bool);
416 vtkGetMacro(CropPlaneToBoundingBox, bool);
417 vtkBooleanMacro(CropPlaneToBoundingBox, bool);
419
421
425 vtkGetMacro(SnapToAxes, bool);
426 vtkSetMacro(SnapToAxes, bool);
428
430
436 vtkGetMacro(AlwaysSnapToNearestAxis, bool);
437 virtual void SetAlwaysSnapToNearestAxis(bool snap)
438 {
439 this->AlwaysSnapToNearestAxis = snap;
440 this->SetNormal(this->GetNormal());
441 }
442
443
444protected:
447
449
450 // Keep track of event positions
454
455 // Controlling ivars
459
463
465
466 // Locking normal to camera
468
469 // Controlling the push operation
471
472 // The actual plane which is being manipulated
474
476
477 // The bounding box is represented by a single voxel image data
482 void HighlightOutline(int highlight);
483 vtkTypeBool OutlineTranslation; // whether the outline can be moved
484 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
485 vtkTypeBool OutsideBounds; // whether the widget can be moved outside input's bounds
486 double WidgetBounds[6];
488
489 // The cut plane is produced with a vtkCutter
491 vtkPlaneSource* PlaneSource; // used when plane cropping disabled
496 void HighlightPlane(int highlight);
497
498 // Optional tubes are represented by extracting boundary edges and tubing
503 vtkTypeBool Tubing; // control whether tubing is on
504
505 // The + normal cone
509 void HighlightNormal(int highlight);
510
511 // The normal line
515
516 // The - normal cone
520
521 // The origin positioning handle
525
526 // Do the picking
528
529 // Register internal Pickers within PickingManager
530 void RegisterPickers() override;
531
532 // Transform the normal (used for rotation)
534
535 // Methods to manipulate the plane
536 void Rotate(double X, double Y, double* p1, double* p2, double* vpn);
537 void Rotate3D(double* p1, double* p2);
538 void TranslateOutline(double* p1, double* p2);
539 void TranslateOrigin(double* p1, double* p2);
540 void UpdatePose(double* p1, double* d1, double* p2, double* d2);
541 void Push(double* p1, double* p2);
542 void Scale(double* p1, double* p2, double X, double Y);
544
545 // Properties used to control the appearance of selected objects and
546 // the manipulator in general.
555
557
558 // Support GetBounds() method
560
561private:
563 void operator=(const vtkImplicitPlaneRepresentation&) = delete;
564};
565
566#endif
define the API for widget / widget representation
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:46
implicit function for a bounding box
Definition vtkBox.h:39
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
Cut vtkDataSet with user-specified implicit function.
Definition vtkCutter.h:71
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.
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 UpdatePlacement(void)
Satisfies the superclass API.
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.
virtual void SetAlwaysSnapToNearestAxis(bool snap)
Forces the plane's normal to be aligned with x, y or z axis.
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.
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 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 ContrainedAxis.
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 Rotate3D(double *p1, double *p2)
a simple class to control print indentation
Definition vtkIndent.h:34
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:34
Superclass for algorithms that produce only polydata as output.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:85
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:62
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:50
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69
#define VTK_DEPRECATED_IN_9_2_0(reason)
#define VTK_SIZEHINT(...)