VTK  9.4.20251007
vtkImplicitConeRepresentation.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
29
30#ifndef vtkImplicitConeRepresentation_h
31#define vtkImplicitConeRepresentation_h
32
33#include "vtkInteractionWidgetsModule.h" // For export macro
34#include "vtkVector.h" // For vtkVector3d
36#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
37
38VTK_ABI_NAMESPACE_BEGIN
39class vtkActor;
41class vtkConeSource;
42class vtkLineSource;
43class vtkSphereSource;
44class vtkTubeFilter;
45class vtkCone;
46class vtkProperty;
47class vtkImageData;
49class vtkPolyData;
50class vtkBox;
51class vtkCellPicker;
52
53#define VTK_MAX_CONE_RESOLUTION 2048
54
55class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkImplicitConeRepresentation
57{
58public:
59 // Manage the state of the widget
71
74 void PrintSelf(ostream& os, vtkIndent indent) override;
75
77
81 void SetOrigin(double x, double y, double z);
82 void SetOrigin(double x[3]);
83 double* GetOrigin() VTK_SIZEHINT(3);
84 void GetOrigin(double xyz[3]);
86
88
92 void SetAxis(double x, double y, double z);
93 void SetAxis(double a[3]);
94 double* GetAxis() VTK_SIZEHINT(3);
95 void GetAxis(double a[3]);
97
99
102 void SetAngle(double r);
103 double GetAngle();
105
107
115 void SetAlongXAxis(bool);
116 vtkGetMacro(AlongXAxis, bool);
117 vtkBooleanMacro(AlongXAxis, bool);
118 void SetAlongYAxis(bool);
119 vtkGetMacro(AlongYAxis, bool);
120 vtkBooleanMacro(AlongYAxis, bool);
121 void SetAlongZAxis(bool);
122 vtkGetMacro(AlongZAxis, bool);
123 vtkBooleanMacro(AlongZAxis, bool);
125
127
133 void SetDrawCone(bool draw);
134 vtkGetMacro(DrawCone, bool);
135 vtkBooleanMacro(DrawCone, bool);
137
139
146 vtkSetClampMacro(Resolution, int, 8, VTK_MAX_CONE_RESOLUTION);
147 vtkGetMacro(Resolution, int);
149
151
157 vtkSetMacro(Tubing, bool);
158 vtkGetMacro(Tubing, bool);
159 vtkBooleanMacro(Tubing, bool);
161
163
168 vtkSetMacro(OutlineTranslation, bool);
169 vtkGetMacro(OutlineTranslation, bool);
170 vtkBooleanMacro(OutlineTranslation, bool);
172
174
179 vtkSetMacro(OutsideBounds, bool);
180 vtkGetMacro(OutsideBounds, bool);
181 vtkBooleanMacro(OutsideBounds, bool);
183
185
191 vtkSetVector6Macro(WidgetBounds, double);
192 vtkGetVector6Macro(WidgetBounds, double);
194
196
203 vtkSetMacro(ConstrainToWidgetBounds, bool);
204 vtkGetMacro(ConstrainToWidgetBounds, bool);
205 vtkBooleanMacro(ConstrainToWidgetBounds, bool);
207
209
213 vtkSetMacro(ScaleEnabled, bool);
214 vtkGetMacro(ScaleEnabled, bool);
215 vtkBooleanMacro(ScaleEnabled, bool);
217
223
229
231
234 vtkGetObjectMacro(AxisProperty, vtkProperty);
237
239
243 vtkGetObjectMacro(ConeProperty, vtkProperty);
246
248
251 vtkGetObjectMacro(OutlineProperty, vtkProperty);
254
256
260 vtkGetObjectMacro(EdgesProperty, vtkProperty);
262
264
269 void SetInteractionColor(double, double, double);
270 void SetInteractionColor(double c[3]) { this->SetInteractionColor(c[0], c[1], c[2]); }
271 void SetHandleColor(double, double, double);
272 void SetHandleColor(double c[3]) { this->SetHandleColor(c[0], c[1], c[2]); }
273 void SetForegroundColor(double, double, double);
274 void SetForegroundColor(double c[3]) { this->SetForegroundColor(c[0], c[1], c[2]); }
276
278
281 int ComputeInteractionState(int X, int Y, int modify = 0) override;
282 void PlaceWidget(double bounds[6]) override;
283 void BuildRepresentation() override;
284 void StartWidgetInteraction(double eventPos[2]) override;
285 void WidgetInteraction(double newEventPos[2]) override;
286 void EndWidgetInteraction(double newEventPos[2]) override;
288
290
293 double* GetBounds() override;
294 void GetActors(vtkPropCollection* pc) override;
300
302
308 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
309 vtkGetMacro(BumpDistance, double);
311
319 void BumpCone(int dir, double factor);
320
327 void PushCone(double distance);
328
340
342
349
350 /*
351 * Register internal Pickers within PickingManager
352 */
353 void RegisterPickers() override;
354
356
360 vtkGetMacro(TranslationAxis, int);
361 vtkSetClampMacro(TranslationAxis, int, Axis::NONE, Axis::ZAxis);
363
365
373
378
379 void GetCone(vtkCone* cone) const;
380
381protected:
384
385 // The actual cone we're manipulating
387
390
391 // Keep track of event positions
393
394 // Controlling the push operation
395 double BumpDistance = 0.01;
396
397 // Controlling ivars
398 bool AlongXAxis = false;
399 bool AlongYAxis = false;
400 bool AlongZAxis = false;
401
402 // The facet resolution for rendering purposes.
403 int Resolution = 128;
404
405 // The bounding box is represented by a single voxel image data
410 bool OutlineTranslation = true; // whether the outline can be moved
411 bool ScaleEnabled = true; // whether the widget can be scaled
412 bool OutsideBounds = true; // whether the widget can be moved outside input's bounds
413 double WidgetBounds[6];
415
419 bool DrawCone = true;
420
421 // Optional tubes are represented by extracting boundary edges and tubing
426 bool Tubing = true; // control whether tubing is on
427
428 // The axis line
432
433 // Axis line arrow
437
438 // The origin positioning handle
442
443 // Do the picking
446
447 // Properties used to control the appearance of selected objects and
448 // the manipulator in general.
458
459 // Support GetBounds() method
461
462 void HighlightCone(bool highlight);
463 void HighlightOriginHandle(bool highlight);
464 void HighlightAxis(bool highlight);
465 void HighlightOutline(bool highlight);
466
467 // Methods to manipulate the cone
468 void Rotate(
469 double X, double Y, const vtkVector3d& p1, const vtkVector3d& p2, const vtkVector3d& vpn);
470 void TranslateCone(const vtkVector3d& p1, const vtkVector3d& p2);
471 void TranslateOutline(const vtkVector3d& p1, const vtkVector3d& p2);
472 void TranslateOrigin(const vtkVector3d& p1, const vtkVector3d& p2);
474 void ScaleAngle(const vtkVector3d& p1, const vtkVector3d& p2);
475 void AdjustAngle(double X, double Y, const vtkVector3d& p1, const vtkVector3d& p2);
476 void Scale(const vtkVector3d& p1, const vtkVector3d& p2, double X, double Y);
478
479 // Intersect oriented infinite cone against bounding box
480 void BuildCone();
481
484};
485
486VTK_ABI_NAMESPACE_END
487#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:42
implicit function for a bounding box
Definition vtkBox.h:31
ray-cast cell picker for all kinds of Prop3Ds
generate polygonal cone
implicit function for a cone
Definition vtkCone.h:32
topologically and geometrically regular array of data
~vtkImplicitConeRepresentation() override
void GetPolyData(vtkPolyData *pd)
Grab the polydata that defines the cone.
void SetInteractionColor(double c[3])
Set the color of all the widgets handles (edges, axis, selected cone) and their color during interact...
void StartWidgetInteraction(double eventPos[2]) override
Methods to interface with the vtkImplicitConeWidget.
void SetXTranslationAxisOn()
Toggles constraint translation axis on/off.
vtkImplicitConeRepresentation(const vtkImplicitConeRepresentation &)=delete
void SetYTranslationAxisOn()
Toggles constraint translation axis on/off.
void SetForegroundColor(double, double, double)
Set the color of all the widgets handles (edges, axis, selected cone) and their color during interact...
void SetAlongXAxis(bool)
Force the cone widget to be aligned with one of the x-y-z axes.
double * GetAxis()
Set/Get the axis of rotation for the cone.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods supporting the rendering process.
void SetHandleColor(double c[3])
Set the color of all the widgets handles (edges, axis, selected cone) and their color during interact...
void SetAxis(double x, double y, double z)
Set/Get the axis of rotation for the cone.
double * GetOrigin()
Get the origin of the cone representation.
virtual void SetRepresentationState(InteractionStateType)
Sets the visual appearance of the representation based on the state it is in.
void HighlightCone(bool highlight)
void TranslateOrigin(const vtkVector3d &p1, const vtkVector3d &p2)
void SetTranslationAxisOff()
Toggles constraint translation axis on/off.
void SetAlongYAxis(bool)
Force the cone widget to be aligned with one of the x-y-z axes.
void SetOrigin(double x[3])
Get the origin of the cone representation.
vtkNew< vtkPolyDataMapper > AxisArrowMapper
void SetAlongZAxis(bool)
Force the cone widget to be aligned with one of the x-y-z axes.
void PushCone(double distance)
Push the cone the distance specified along the view vector.
int ComputeInteractionState(int X, int Y, int modify=0) override
Methods to interface with the vtkImplicitConeWidget.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Methods supporting the rendering process.
void AdjustAngle(double X, double Y, const vtkVector3d &p1, const vtkVector3d &p2)
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting the rendering process.
void WidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkImplicitConeWidget.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
int RenderOpaqueGeometry(vtkViewport *) override
Methods supporting the rendering process.
void PlaceWidget(double bounds[6]) override
Methods to interface with the vtkImplicitConeWidget.
void UpdatePlacement()
Satisfies the superclass API.
void EndWidgetInteraction(double newEventPos[2]) override
Methods to interface with the vtkImplicitConeWidget.
void SetOrigin(double x, double y, double z)
Get the origin of the cone representation.
double GetAngle()
Set/Get the cone angle (expressed in degrees).
vtkNew< vtkPolyDataMapper > OriginHandleMapper
void HighlightAxis(bool highlight)
void SetAngle(double r)
Set/Get the cone angle (expressed in degrees).
void operator=(const vtkImplicitConeRepresentation &)=delete
void HighlightOutline(bool highlight)
void GetCone(vtkCone *cone) const
void HighlightOriginHandle(bool highlight)
void SetForegroundColor(double c[3])
Set the color of all the widgets handles (edges, axis, selected cone) and their color during interact...
void SetZTranslationAxisOn()
Toggles constraint translation axis on/off.
void TranslateOutline(const vtkVector3d &p1, const vtkVector3d &p2)
void SetDrawCone(bool draw)
Enable/disable the drawing of the cone.
void GetActors(vtkPropCollection *pc) override
Methods supporting the rendering process.
double * GetBounds() override
Methods supporting the rendering process.
void SetHandleColor(double, double, double)
Set the color of all the widgets handles (edges, axis, selected cone) and their color during interact...
void Scale(const vtkVector3d &p1, const vtkVector3d &p2, double X, double Y)
void Rotate(double X, double Y, const vtkVector3d &p1, const vtkVector3d &p2, const vtkVector3d &vpn)
void ScaleAngle(const vtkVector3d &p1, const vtkVector3d &p2)
void TranslateOriginOnAxis(const vtkVector3d &p1, const vtkVector3d &p2)
bool IsTranslationConstrained()
Returns true if ConstrainedAxis.
static vtkImplicitConeRepresentation * New()
void BumpCone(int dir, double factor)
Translate the cone in the direction of the view vector by the specified BumpDistance.
void SetInteractionColor(double, double, double)
Set the color of all the widgets handles (edges, axis, selected cone) and their color during interact...
void BuildRepresentation() override
Methods to interface with the vtkImplicitConeWidget.
void TranslateCone(const vtkVector3d &p1, const vtkVector3d &p2)
a simple class to control print indentation
Definition vtkIndent.h:29
create a line defined by two end points
Allocate and hold a VTK object.
Definition vtkNew.h:58
create wireframe outline for an arbitrary data set or composite dataset
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
an ordered list of Props
represent surface properties of a geometric object
Definition vtkProperty.h:60
create a polygonal sphere centered at the origin
filter that generates tubes around lines
abstract specification for Viewports
Definition vtkViewport.h:46
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_MAX_CONE_RESOLUTION
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO