VTK  9.4.20250421
vtkImplicitCylinderRepresentation.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
30#ifndef vtkImplicitCylinderRepresentation_h
31#define vtkImplicitCylinderRepresentation_h
32
34#include "vtkInteractionWidgetsModule.h" // For export macro
35#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
36
37VTK_ABI_NAMESPACE_BEGIN
38class vtkActor;
40class vtkCellPicker;
41class vtkConeSource;
42class vtkLineSource;
43class vtkSphereSource;
44class vtkTubeFilter;
45class vtkCylinder;
46class vtkProperty;
47class vtkImageData;
49class vtkFeatureEdges;
50class vtkPolyData;
52class vtkTransform;
53class vtkBox;
54class vtkLookupTable;
55
56#define VTK_MAX_CYL_RESOLUTION 2048
57
58class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkImplicitCylinderRepresentation
60{
61public:
66
68
72 void PrintSelf(ostream& os, vtkIndent indent) override;
74
76
80 void SetCenter(double x, double y, double z);
81 void SetCenter(double x[3]);
82 double* GetCenter() VTK_SIZEHINT(3);
83 void GetCenter(double xyz[3]);
85
87
91 void SetAxis(double x, double y, double z);
92 void SetAxis(double a[3]);
93 double* GetAxis() VTK_SIZEHINT(3);
94 void GetAxis(double a[3]);
96
98
102 void SetRadius(double r);
103 double GetRadius();
105
107
114 vtkSetClampMacro(MinRadius, double, 0.001, 0.25);
115 vtkGetMacro(MinRadius, double);
116 vtkSetClampMacro(MaxRadius, double, 0.25, VTK_FLOAT_MAX);
117 vtkGetMacro(MaxRadius, double);
119
121
128 void SetAlongXAxis(vtkTypeBool);
129 vtkGetMacro(AlongXAxis, vtkTypeBool);
130 vtkBooleanMacro(AlongXAxis, vtkTypeBool);
131 void SetAlongYAxis(vtkTypeBool);
132 vtkGetMacro(AlongYAxis, vtkTypeBool);
133 vtkBooleanMacro(AlongYAxis, vtkTypeBool);
134 void SetAlongZAxis(vtkTypeBool);
135 vtkGetMacro(AlongZAxis, vtkTypeBool);
136 vtkBooleanMacro(AlongZAxis, vtkTypeBool);
138
140
146 void SetDrawCylinder(vtkTypeBool drawCyl);
147 vtkGetMacro(DrawCylinder, vtkTypeBool);
148 vtkBooleanMacro(DrawCylinder, vtkTypeBool);
150
152
158 vtkSetClampMacro(Resolution, int, 8, VTK_MAX_CYL_RESOLUTION);
159 vtkGetMacro(Resolution, int);
161
163
168 vtkSetMacro(Tubing, vtkTypeBool);
169 vtkGetMacro(Tubing, vtkTypeBool);
170 vtkBooleanMacro(Tubing, vtkTypeBool);
172
174
177 vtkSetMacro(ScaleEnabled, vtkTypeBool);
178 vtkGetMacro(ScaleEnabled, vtkTypeBool);
179 vtkBooleanMacro(ScaleEnabled, vtkTypeBool);
181
188 void GetCylinder(vtkCylinder* cyl);
189
194 void GetPolyData(vtkPolyData* pd);
195
200 void UpdatePlacement();
201
203
206 vtkGetObjectMacro(AxisProperty, vtkProperty);
207 vtkGetObjectMacro(SelectedAxisProperty, vtkProperty);
209
211
215 vtkGetObjectMacro(CylinderProperty, vtkProperty);
216 vtkGetObjectMacro(SelectedCylinderProperty, vtkProperty);
218
220
224 vtkGetObjectMacro(EdgesProperty, vtkProperty);
226
228
233 void SetInteractionColor(double, double, double);
234 void SetInteractionColor(double c[3]) { this->SetInteractionColor(c[0], c[1], c[2]); }
235 void SetHandleColor(double, double, double);
236 void SetHandleColor(double c[3]) { this->SetHandleColor(c[0], c[1], c[2]); }
237 void SetForegroundColor(double, double, double);
238 void SetForegroundColor(double c[3]) { this->SetForegroundColor(c[0], c[1], c[2]); }
240
242
245 int ComputeInteractionState(int X, int Y, int modify = 0) override;
246 void PlaceWidget(double bounds[6]) override;
247 void BuildRepresentation() override;
248 void StartWidgetInteraction(double eventPos[2]) override;
249 void WidgetInteraction(double newEventPos[2]) override;
250 void EndWidgetInteraction(double newEventPos[2]) override;
252
254
257 double* GetBounds() override;
258 void GetActors(vtkPropCollection* pc) override;
264
266
271 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
272 vtkGetMacro(BumpDistance, double);
274
282 void BumpCylinder(int dir, double factor);
283
290 void PushCylinder(double distance);
291
292 // Manage the state of the widget
294 {
295 Outside = 0,
302 TranslatingCenter
303 };
304
306
315 vtkSetClampMacro(InteractionState, int, Outside, TranslatingCenter);
317
319
323 virtual void SetRepresentationState(int);
324 vtkGetMacro(RepresentationState, int);
326
327 /*
328 * Register internal Pickers within PickingManager
329 */
330 void RegisterPickers() override;
331
332protected:
335
336 void TranslateRepresentation(const vtkVector3d& move) override;
337
339
340 // Keep track of event positions
341 double LastEventPosition[3];
342
343 // Control the radius
344 double MinRadius;
345 double MaxRadius;
346
347 // Controlling the push operation
349
350 // Controlling ivars
354
355 // The actual cylinder which is being manipulated
357
358 // The facet resolution for rendering purposes.
360
361 vtkTypeBool ScaleEnabled; // whether the widget can be scaled
362
363 // The cut cylinder is produced with a vtkCutter
368 void HighlightCylinder(int highlight);
369
370 // Optional tubes are represented by extracting boundary edges and tubing
375 vtkTypeBool Tubing; // control whether tubing is on
376
377 // The + normal cone (i.e., in positive direction along normal)
381 void HighlightNormal(int highlight);
382
383 // The + normal line
387
388 // The - normal cone
392
393 // The - normal line
397
398 // The center positioning handle
402
403 // Do the picking
406
407 // Transform the normal (used for rotation)
409
410 // Methods to manipulate the cylinder
411 void Rotate(double X, double Y, double* p1, double* p2, double* vpn);
412 void TranslateCylinder(double* p1, double* p2);
413 void TranslateCenter(double* p1, double* p2);
414 void TranslateCenterOnAxis(double* p1, double* p2);
415 void ScaleRadius(double* p1, double* p2);
416 void AdjustRadius(double X, double Y, double* p1, double* p2);
417 void Scale(double* p1, double* p2, double X, double Y);
419
420 // Properties used to control the appearance of selected objects and
421 // the manipulator in general.
427 void CreateDefaultProperties() override;
428
429 // Intersect oriented infinite cylinder against bounding box
431
432 // Support GetBounds() method
434
435private:
437 void operator=(const vtkImplicitCylinderRepresentation&) = delete;
438};
439
440VTK_ABI_NAMESPACE_END
441#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
Extends the vtkWidgetRepresentation to help positioning widget in space and how it should be displaye...
implicit function for a bounding box
Definition vtkBox.h:110
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
implicit function for a cylinder
Definition vtkCylinder.h:76
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 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 SetHandleColor(double, double, double)
Set the color of all the widgets handles (edges, axis, selected cylinder) and their color during inte...
void TranslateCylinder(double *p1, double *p2)
void TranslateCenterOnAxis(double *p1, double *p2)
void ScaleRadius(double *p1, double *p2)
void CreateDefaultProperties() override
Create and initialize properties with default values.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void AdjustRadius(double X, double Y, double *p1, double *p2)
void SetInteractionColor(double c[3])
Set the color of all the widgets handles (edges, axis, selected cylinder) and their color during inte...
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.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
double * GetCenter()
Get the center 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 SetHandleColor(double c[3])
Set the color of all the widgets handles (edges, axis, selected cylinder) and their color during inte...
void Rotate(double X, double Y, double *p1, double *p2, double *vpn)
void BuildRepresentation() override
Methods to interface with the vtkImplicitCylinderWidget.
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 WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkImplicitCylinderWidget.
void Scale(double *p1, double *p2, double X, double Y)
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.
void TranslateRepresentation(const vtkVector3d &move) override
Translate the representation, to be implemented in derived class.
double * GetBounds() override
Methods supporting the rendering process.
void SetForegroundColor(double c[3])
Set the color of all the widgets handles (edges, axis, selected cylinder) and their color during inte...
void SetForegroundColor(double, double, double)
Set the color of all the widgets handles (edges, axis, selected cylinder) and their color during inte...
int ComputeInteractionState(int X, int Y, int modify=0) override
Methods to interface with the vtkImplicitCylinderWidget.
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
Superclass for algorithms that produce only polydata as output.
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
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_MAX_CYL_RESOLUTION
#define VTK_FLOAT_MAX
Definition vtkType.h:169
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO