VTK  9.5.20251215
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
48
49#ifndef vtkImplicitConeRepresentation_h
50#define vtkImplicitConeRepresentation_h
51
53#include "vtkInteractionWidgetsModule.h" // For export macro
54#include "vtkVector.h" // For vtkVector3d
55#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
56
57VTK_ABI_NAMESPACE_BEGIN
58class vtkActor;
60class vtkConeSource;
61class vtkLineSource;
62class vtkSphereSource;
63class vtkTubeFilter;
64class vtkCone;
65class vtkProperty;
66class vtkImageData;
67class vtkPolyData;
68class vtkBox;
69class vtkCellPicker;
70
71#define VTK_MAX_CONE_RESOLUTION 2048
72
73class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkImplicitConeRepresentation
75{
76public:
77 // Manage the state of the widget
89
92 void PrintSelf(ostream& os, vtkIndent indent) override;
93
95
99 void SetOrigin(double x, double y, double z);
100 void SetOrigin(double x[3]);
102 void GetOrigin(double xyz[3]);
104
106
110 void SetAxis(double x, double y, double z);
111 void SetAxis(double a[3]);
112 double* GetAxis() VTK_SIZEHINT(3);
113 void GetAxis(double a[3]);
115
117
120 void SetAngle(double r);
121 double GetAngle();
123
125
133 void SetAlongXAxis(bool);
134 vtkGetMacro(AlongXAxis, bool);
135 vtkBooleanMacro(AlongXAxis, bool);
136 void SetAlongYAxis(bool);
137 vtkGetMacro(AlongYAxis, bool);
138 vtkBooleanMacro(AlongYAxis, bool);
139 void SetAlongZAxis(bool);
140 vtkGetMacro(AlongZAxis, bool);
141 vtkBooleanMacro(AlongZAxis, bool);
143
145
151 void SetDrawCone(bool draw);
152 vtkGetMacro(DrawCone, bool);
153 vtkBooleanMacro(DrawCone, bool);
155
157
164 vtkSetClampMacro(Resolution, int, 8, VTK_MAX_CONE_RESOLUTION);
165 vtkGetMacro(Resolution, int);
167
169
175 vtkSetMacro(Tubing, bool);
176 vtkGetMacro(Tubing, bool);
177 vtkBooleanMacro(Tubing, bool);
179
181
185 vtkSetMacro(ScaleEnabled, bool);
186 vtkGetMacro(ScaleEnabled, bool);
187 vtkBooleanMacro(ScaleEnabled, bool);
189
195
201
203
206 vtkGetObjectMacro(AxisProperty, vtkProperty);
209
211
215 vtkGetObjectMacro(ConeProperty, 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
272 vtkSetClampMacro(BumpDistance, double, 0.000001, 1);
273 vtkGetMacro(BumpDistance, double);
275
283 void BumpCone(int dir, double factor);
284
291 void PushCone(double distance);
292
304
306
313
314 /*
315 * Register internal Pickers within PickingManager
316 */
317 void RegisterPickers() override;
318
319 void GetCone(vtkCone* cone) const;
320
321protected:
324
325 // The actual cone we're manipulating
327
329
330 // Keep track of event positions
332
333 // Controlling the push operation
334 double BumpDistance = 0.01;
335
336 // Controlling ivars
337 bool AlongXAxis = false;
338 bool AlongYAxis = false;
339 bool AlongZAxis = false;
340
341 // The facet resolution for rendering purposes.
342 int Resolution = 128;
343
344 bool ScaleEnabled = true; // whether the widget can be scaled
345
349 bool DrawCone = true;
350
351 // Optional tubes are represented by extracting boundary edges and tubing
356 bool Tubing = true; // control whether tubing is on
357
358 // The axis line
362
363 // Axis line arrow
367
368 // The origin positioning handle
372
373 // Do the picking
376
377 // Properties used to control the appearance of selected objects and
378 // the manipulator in general.
386
387 // Support GetBounds() method
389
390 void HighlightCone(bool highlight);
391 void HighlightOriginHandle(bool highlight);
392 void HighlightAxis(bool highlight);
393
394 // Methods to manipulate the cone
395 void Rotate(
396 double X, double Y, const vtkVector3d& p1, const vtkVector3d& p2, const vtkVector3d& vpn);
397 void TranslateCone(const vtkVector3d& p1, const vtkVector3d& p2);
398 void TranslateRepresentation(const vtkVector3d& motion) override;
399 void TranslateOrigin(const vtkVector3d& p1, const vtkVector3d& p2);
401 void ScaleAngle(const vtkVector3d& p1, const vtkVector3d& p2);
402 void AdjustAngle(double X, double Y, const vtkVector3d& p1, const vtkVector3d& p2);
403 void Scale(const vtkVector3d& p1, const vtkVector3d& p2, double X, double Y);
405
406 // Intersect oriented infinite cone against bounding box
407 void BuildCone();
408
411};
412
413VTK_ABI_NAMESPACE_END
414#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
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 cone
Definition vtkCone.h:91
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.
vtkImplicitConeRepresentation(const vtkImplicitConeRepresentation &)=delete
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 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
Standard methods for instances of this class.
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 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 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 TranslateRepresentation(const vtkVector3d &motion) override
Translate the representation, to be implemented in derived class.
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)
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:108
create a line defined by two end points
Allocate and hold a VTK object.
Definition vtkNew.h:167
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
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_CONE_RESOLUTION
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO