VTK  9.2.6
vtkImplicitCylinderRepresentation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkImplicitCylinderRepresentation.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=========================================================================*/
38
39#ifndef vtkImplicitCylinderRepresentation_h
40#define vtkImplicitCylinderRepresentation_h
41
42#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
43#include "vtkInteractionWidgetsModule.h" // For export macro
45
46class vtkActor;
48class vtkCellPicker;
49class vtkConeSource;
50class vtkLineSource;
51class vtkSphereSource;
52class vtkTubeFilter;
53class vtkCylinder;
54class vtkProperty;
55class vtkImageData;
57class vtkFeatureEdges;
58class vtkPolyData;
60class vtkTransform;
61class vtkBox;
62class vtkLookupTable;
63
64#define VTK_MAX_CYL_RESOLUTION 2048
65
66class VTKINTERACTIONWIDGETS_EXPORT vtkImplicitCylinderRepresentation
68{
69public:
74
76
80 void PrintSelf(ostream& os, vtkIndent indent) override;
82
84
88 void SetCenter(double x, double y, double z);
89 void SetCenter(double x[3]);
90 double* GetCenter() VTK_SIZEHINT(3);
91 void GetCenter(double xyz[3]);
93
95
99 void SetAxis(double x, double y, double z);
100 void SetAxis(double a[3]);
101 double* GetAxis() VTK_SIZEHINT(3);
102 void GetAxis(double a[3]);
104
106
110 void SetRadius(double r);
111 double GetRadius();
113
115
122 vtkSetClampMacro(MinRadius, double, 0.001, 0.25);
123 vtkGetMacro(MinRadius, double);
124 vtkSetClampMacro(MaxRadius, double, 0.25, VTK_FLOAT_MAX);
125 vtkGetMacro(MaxRadius, double);
127
129
137 vtkGetMacro(AlongXAxis, vtkTypeBool);
138 vtkBooleanMacro(AlongXAxis, vtkTypeBool);
140 vtkGetMacro(AlongYAxis, vtkTypeBool);
141 vtkBooleanMacro(AlongYAxis, vtkTypeBool);
143 vtkGetMacro(AlongZAxis, vtkTypeBool);
144 vtkBooleanMacro(AlongZAxis, vtkTypeBool);
146
148
156 vtkBooleanMacro(DrawCylinder, vtkTypeBool);
158
160
166 vtkSetClampMacro(Resolution, int, 8, VTK_MAX_CYL_RESOLUTION);
167 vtkGetMacro(Resolution, int);
169
171
176 vtkSetMacro(Tubing, vtkTypeBool);
177 vtkGetMacro(Tubing, vtkTypeBool);
178 vtkBooleanMacro(Tubing, vtkTypeBool);
180
182
190
192
198 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
200
202
208 vtkSetVector6Macro(WidgetBounds, double);
209 vtkGetVector6Macro(WidgetBounds, double);
211
213
225
227
232 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
234
242
248
253 void UpdatePlacement(void);
254
256
259 vtkGetObjectMacro(AxisProperty, vtkProperty);
262
264
268 vtkGetObjectMacro(CylinderProperty, vtkProperty);
271
273
276 vtkGetObjectMacro(OutlineProperty, vtkProperty);
279
281
285 vtkGetObjectMacro(EdgesProperty, vtkProperty);
288
292 void SetEdgeColor(double, double, double);
293 void SetEdgeColor(double c[3]);
295
297
300 int ComputeInteractionState(int X, int Y, int modify = 0) override;
301 void PlaceWidget(double bounds[6]) override;
302 void BuildRepresentation() override;
303 void StartWidgetInteraction(double eventPos[2]) override;
304 void WidgetInteraction(double newEventPos[2]) override;
305 void EndWidgetInteraction(double newEventPos[2]) override;
307
309
312 double* GetBounds() override;
313 void GetActors(vtkPropCollection* pc) override;
319
321
326 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
327 vtkGetMacro(BumpDistance, double);
329
337 void BumpCylinder(int dir, double factor);
338
345 void PushCylinder(double distance);
346
347 // Manage the state of the widget
359#if !defined(VTK_LEGACY_REMOVE)
360 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
362#endif
363
365
376
378
382 virtual void SetRepresentationState(int);
383 vtkGetMacro(RepresentationState, int);
385
386 /*
387 * Register internal Pickers within PickingManager
388 */
389 void RegisterPickers() override;
390
392
396 vtkGetMacro(TranslationAxis, int);
397 vtkSetClampMacro(TranslationAxis, int, -1, 2);
399
401
409
411
416
417protected:
420
422
424
425 // Keep track of event positions
427
428 // Control the radius
429 double MinRadius;
430 double MaxRadius;
431
432 // Controlling the push operation
434
435 // Controlling ivars
439
440 // The actual cylinder which is being manipulated
442
443 // The facet resolution for rendering purposes.
445
446 // The bounding box is represented by a single voxel image data
451 void HighlightOutline(int highlight);
452 vtkTypeBool OutlineTranslation; // whether the outline can be moved
453 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
454 vtkTypeBool OutsideBounds; // whether the widget can be moved outside input's bounds
455 double WidgetBounds[6];
457
458 // The cut cylinder is produced with a vtkCutter
463 void HighlightCylinder(int highlight);
464
465 // Optional tubes are represented by extracting boundary edges and tubing
470 vtkTypeBool Tubing; // control whether tubing is on
471
472 // The + normal cone (i.e., in positive direction along normal)
476 void HighlightNormal(int highlight);
477
478 // The + normal line
482
483 // The - normal cone
487
488 // The - normal line
492
493 // The center positioning handle
497
498 // Do the picking
501
502 // Transform the normal (used for rotation)
504
505 // Methods to manipulate the cylinder
506 void Rotate(double X, double Y, double* p1, double* p2, double* vpn);
507 void TranslateCylinder(double* p1, double* p2);
508 void TranslateOutline(double* p1, double* p2);
509 void TranslateCenter(double* p1, double* p2);
510 void TranslateCenterOnAxis(double* p1, double* p2);
511 void ScaleRadius(double* p1, double* p2);
512 void AdjustRadius(double X, double Y, double* p1, double* p2);
513 void Scale(double* p1, double* p2, double X, double Y);
515
516 // Properties used to control the appearance of selected objects and
517 // the manipulator in general.
526
527 // Intersect oriented infinite cylinder against bounding box
529
530 // Support GetBounds() method
532
533private:
535 void operator=(const vtkImplicitCylinderRepresentation&) = delete;
536};
537
538#endif
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
implicit function for a cylinder
Definition vtkCylinder.h:45
extract interior, boundary, non-manifold, and/or sharp edges from polygonal data
topologically and geometrically regular array of data
void HighlightOutline(int highlight)
void StartWidgetInteraction(double eventPos[2]) override
Methods to interface with the vtkImplicitCylinderWidget.
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting the rendering process.
void HighlightCylinder(int highlight)
void BumpCylinder(int dir, double factor)
Translate the cylinder in the direction of the view vector by the specified BumpDistance.
void HighlightNormal(int highlight)
void TranslateCylinder(double *p1, double *p2)
void TranslateCenterOnAxis(double *p1, double *p2)
void SetEdgeColor(vtkLookupTable *)
Set color to the edge.
void ScaleRadius(double *p1, double *p2)
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void SetAlongZAxis(vtkTypeBool)
Force the cylinder widget to be aligned with one of the x-y-z axes.
void AdjustRadius(double X, double Y, double *p1, double *p2)
void TranslateOutline(double *p1, double *p2)
void SetXTranslationAxisOn()
Toggles constraint translation axis on/off.
void SetAxis(double x, double y, double z)
Set/Get the axis of rotation for the cylinder.
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkImplicitCylinderWidget.
void SetCenter(double x, double y, double z)
Get the center of the cylinder.
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
double * GetCenter()
Get the center of the cylinder.
bool IsTranslationConstrained()
Returns true if ContrainedAxis.
void SetAlongYAxis(vtkTypeBool)
Force the cylinder widget to be aligned with one of the x-y-z axes.
void SetAlongXAxis(vtkTypeBool)
Force the cylinder widget to be aligned with one of the x-y-z axes.
double GetRadius()
Set/Get the radius of the cylinder.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting the rendering process.
void GetActors(vtkPropCollection *pc) override
Methods supporting the rendering process.
void PushCylinder(double distance)
Push the cylinder the distance specified along the view vector.
static vtkImplicitCylinderRepresentation * New()
Instantiate the class.
void Rotate(double X, double Y, double *p1, double *p2, double *vpn)
void GetCylinder(vtkCylinder *cyl)
Get the implicit function for the cylinder.
void BuildRepresentation() override
Methods to interface with the vtkImplicitCylinderWidget.
double * GetAxis()
Set/Get the axis of rotation for the cylinder.
virtual void SetRepresentationState(int)
Sets the visual appearance of the representation based on the state it is in.
void EndWidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkImplicitCylinderWidget.
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
void WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkImplicitCylinderWidget.
void SetDrawCylinder(vtkTypeBool drawCyl)
Enable/disable the drawing of the cylinder.
void Scale(double *p1, double *p2, double X, double Y)
void SetYTranslationAxisOn()
Toggles constraint translation axis on/off.
void GetPolyData(vtkPolyData *pd)
Grab the polydata that defines the cylinder.
void TranslateCenter(double *p1, double *p2)
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
void SetCenter(double x[3])
Get the center of the cylinder.
double * GetBounds() override
Methods supporting the rendering process.
void SetRadius(double r)
Set/Get the radius of the cylinder.
int ComputeInteractionState(int X, int Y, int modify=0) override
Methods to interface with the vtkImplicitCylinderWidget.
void UpdatePlacement(void)
Satisfies the superclass API.
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
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
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_MAX_CYL_RESOLUTION
#define VTK_FLOAT_MAX
Definition vtkType.h:163
#define VTK_SIZEHINT(...)