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=========================================================================*/
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
136 void SetAlongXAxis(vtkTypeBool);
137 vtkGetMacro(AlongXAxis, vtkTypeBool);
138 vtkBooleanMacro(AlongXAxis, vtkTypeBool);
139 void SetAlongYAxis(vtkTypeBool);
140 vtkGetMacro(AlongYAxis, vtkTypeBool);
141 vtkBooleanMacro(AlongYAxis, vtkTypeBool);
142 void SetAlongZAxis(vtkTypeBool);
143 vtkGetMacro(AlongZAxis, vtkTypeBool);
144 vtkBooleanMacro(AlongZAxis, vtkTypeBool);
146
148
154 void SetDrawCylinder(vtkTypeBool drawCyl);
155 vtkGetMacro(DrawCylinder, vtkTypeBool);
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
186 vtkSetMacro(OutlineTranslation, vtkTypeBool);
187 vtkGetMacro(OutlineTranslation, vtkTypeBool);
188 vtkBooleanMacro(OutlineTranslation, vtkTypeBool);
190
192
196 vtkSetMacro(OutsideBounds, vtkTypeBool);
197 vtkGetMacro(OutsideBounds, vtkTypeBool);
198 vtkBooleanMacro(OutsideBounds, vtkTypeBool);
200
202
208 vtkSetVector6Macro(WidgetBounds, double);
209 vtkGetVector6Macro(WidgetBounds, double);
211
213
221 vtkSetMacro(ConstrainToWidgetBounds, vtkTypeBool);
222 vtkGetMacro(ConstrainToWidgetBounds, vtkTypeBool);
223 vtkBooleanMacro(ConstrainToWidgetBounds, vtkTypeBool);
225
227
230 vtkSetMacro(ScaleEnabled, vtkTypeBool);
231 vtkGetMacro(ScaleEnabled, vtkTypeBool);
232 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
234
241 void GetCylinder(vtkCylinder* cyl);
242
247 void GetPolyData(vtkPolyData* pd);
248
253 void UpdatePlacement(void);
254
256
259 vtkGetObjectMacro(AxisProperty, vtkProperty);
260 vtkGetObjectMacro(SelectedAxisProperty, vtkProperty);
262
264
268 vtkGetObjectMacro(CylinderProperty, vtkProperty);
269 vtkGetObjectMacro(SelectedCylinderProperty, vtkProperty);
271
273
276 vtkGetObjectMacro(OutlineProperty, vtkProperty);
277 vtkGetObjectMacro(SelectedOutlineProperty, vtkProperty);
279
281
285 vtkGetObjectMacro(EdgesProperty, vtkProperty);
288
291 void SetEdgeColor(vtkLookupTable*);
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;
314 void ReleaseGraphicsResources(vtkWindow*) override;
315 int RenderOpaqueGeometry(vtkViewport*) override;
316 int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
317 vtkTypeBool HasTranslucentPolygonalGeometry() 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
349 {
350 Outside = 0,
357 TranslatingCenter
358 };
359#if !defined(VTK_LEGACY_REMOVE)
360 VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
362#endif
363
365
374 vtkSetClampMacro(InteractionState, int, Outside, TranslatingCenter);
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
404 void SetXTranslationAxisOn() { this->TranslationAxis = Axis::XAxis; }
405 void SetYTranslationAxisOn() { this->TranslationAxis = Axis::YAxis; }
406 void SetZTranslationAxisOn() { this->TranslationAxis = Axis::ZAxis; }
407 void SetTranslationAxisOff() { this->TranslationAxis = Axis::NONE; }
409
411
414 bool IsTranslationConstrained() { return this->TranslationAxis != Axis::NONE; }
416
417protected:
420
422
424
425 // Keep track of event positions
426 double LastEventPosition[3];
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
defining the representation for a vtkImplicitCylinderWidget
void HighlightOutline(int highlight)
void HighlightCylinder(int highlight)
void HighlightNormal(int highlight)
void TranslateCylinder(double *p1, double *p2)
void TranslateCenterOnAxis(double *p1, double *p2)
void ScaleRadius(double *p1, double *p2)
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
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 SetCenter(double x, double y, double z)
Get the center of the cylinder.
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
double * GetCenter()
Get the center of the cylinder.
bool IsTranslationConstrained()
Returns true if ContrainedAxis.
static vtkImplicitCylinderRepresentation * New()
Instantiate the class.
void Rotate(double X, double Y, double *p1, double *p2, double *vpn)
virtual void SetRepresentationState(int)
Sets the visual appearance of the representation based on the state it is in.
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
void Scale(double *p1, double *p2, double X, double Y)
void SetYTranslationAxisOn()
Toggles constraint translation axis on/off.
void TranslateCenter(double *p1, double *p2)
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for the class.
void SetCenter(double x[3])
Get the center of the cylinder.
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
abstract class defines interface between the widget and widget representation classes
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(...)