VTK  9.6.20260404
vtkPicker.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
34
35#ifndef vtkPicker_h
36#define vtkPicker_h
37
39#include "vtkDeprecation.h" // For VTK_DEPRECATED_9_7_0
40#include "vtkRenderingCoreModule.h" // For export macro
41#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
42
43VTK_ABI_NAMESPACE_BEGIN
46class vtkDataSet;
47class vtkTransform;
50class vtkPoints;
51
52class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkPicker : public vtkAbstractPropPicker
53{
54public:
55 static vtkPicker* New();
57 void PrintSelf(ostream& os, vtkIndent indent) override;
58
60
65 vtkSetMacro(Tolerance, double);
66 vtkGetMacro(Tolerance, double);
68
70
74 vtkGetVectorMacro(MapperPosition, double, 3);
76
78
81 vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
83
85
89 vtkGetObjectMacro(DataSet, vtkDataSet);
91
93
99
101
108
114
120 VTK_DEPRECATED_IN_9_7_0("Use GetProp3Ds instead.")
122
129
136 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
137
143 int Pick(VTK_FUTURE_CONST double selectionPt[3], vtkRenderer* ren)
144 {
145 return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren);
146 }
147
153 int Pick3DPoint(VTK_FUTURE_CONST double selectionPt[3], vtkRenderer* ren) override;
154
155 /*
156 * Pick a point in the scene with the selection point and focal point
157 * provided. The two points are in world coordinates.
158 *
159 * Returns non-zero if something was successfully picked.
160 */
161 virtual int Pick3DPoint(
162 VTK_FUTURE_CONST double p1World[3], VTK_FUTURE_CONST double p2World[3], vtkRenderer* ren);
168 int Pick3DRay(VTK_FUTURE_CONST double selectionPt[3], VTK_FUTURE_CONST double orient[4],
169 vtkRenderer* ren) override;
170
171protected:
173 ~vtkPicker() override;
174
175 // shared code for picking
176 virtual int Pick3DInternal(
177 vtkRenderer* ren, VTK_FUTURE_CONST double p1World[4], VTK_FUTURE_CONST double p2World[4]);
178
180 VTK_FUTURE_CONST double mapperPos[3]);
181 void MarkPickedData(vtkAssemblyPath* path, double tMin, VTK_FUTURE_CONST double mapperPos[3],
182 vtkAbstractMapper3D* mapper, vtkDataSet* input, vtkIdType flatBlockIndex = -1);
183 virtual double IntersectWithLine(const double p1[3], const double p2[3], double tol,
185 void Initialize() override;
186 static bool CalculateRay(
187 const double p1[3], const double p2[3], double ray[3], double& rayFactor);
188
189 double Tolerance; // tolerance for computation (% of window)
190 double MapperPosition[3]; // selection point in untransformed coordinates
191
192 vtkAbstractMapper3D* Mapper; // selected mapper (if the prop has a mapper)
193 vtkDataSet* DataSet; // selected dataset (if there is one)
195 vtkIdType FlatBlockIndex; // flat block index, for a composite data set
196
197 double GlobalTMin; // parametric coordinate along pick ray where hit occurred
198 vtkTransform* Transform; // use to perform ray transformation
199 vtkActorCollection* Actors; // candidate actors (based on bounding box)
200 vtkProp3DCollection* Prop3Ds; // candidate actors (based on bounding box)
201 vtkPoints* PickedPositions; // candidate positions
202
203private:
204 vtkPicker(const vtkPicker&) = delete;
205 void operator=(const vtkPicker&) = delete;
206};
207
208VTK_ABI_NAMESPACE_END
209#endif
abstract class specifies interface to map 3D data
virtual int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer)=0
Perform pick operation with selection point provided.
an ordered list of actors
a list of nodes that form an assembly path
abstract superclass for composite (multi-block or AMR) datasets
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
a simple class to control print indentation
Definition vtkIndent.h:108
int Pick3DPoint(VTK_FUTURE_CONST double selectionPt[3], vtkRenderer *ren) override
Perform pick operation with selection point provided.
static vtkPicker * New()
vtkActorCollection * GetActors()
Return a collection of all the actors that were intersected.
vtkPoints * PickedPositions
Definition vtkPicker.h:201
vtkPoints * GetPickedPositions()
Return a list of the points the actors returned by GetProp3Ds were intersected at.
Definition vtkPicker.h:128
vtkTransform * Transform
Definition vtkPicker.h:198
void MarkPicked(vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m, double tMin, VTK_FUTURE_CONST double mapperPos[3])
vtkIdType FlatBlockIndex
Definition vtkPicker.h:195
vtkProp3DCollection * GetProp3Ds()
Return a collection of all the prop 3D's that were intersected by the pick ray.
Definition vtkPicker.h:113
vtkCompositeDataSet * CompositeDataSet
Definition vtkPicker.h:194
int Pick(VTK_FUTURE_CONST double selectionPt[3], vtkRenderer *ren)
Perform pick operation with selection point provided.
Definition vtkPicker.h:143
void Initialize() override
~vtkPicker() override
static bool CalculateRay(const double p1[3], const double p2[3], double ray[3], double &rayFactor)
vtkDataSet * DataSet
Definition vtkPicker.h:193
double MapperPosition[3]
Definition vtkPicker.h:190
virtual double IntersectWithLine(const double p1[3], const double p2[3], double tol, vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m)
int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer) override
Perform pick operation with selection point provided.
virtual int Pick3DInternal(vtkRenderer *ren, VTK_FUTURE_CONST double p1World[4], VTK_FUTURE_CONST double p2World[4])
int Pick3DRay(VTK_FUTURE_CONST double selectionPt[3], VTK_FUTURE_CONST double orient[4], vtkRenderer *ren) override
Perform pick operation with selection point and orientation provided.
double GlobalTMin
Definition vtkPicker.h:197
void MarkPickedData(vtkAssemblyPath *path, double tMin, VTK_FUTURE_CONST double mapperPos[3], vtkAbstractMapper3D *mapper, vtkDataSet *input, vtkIdType flatBlockIndex=-1)
vtkProp3DCollection * Prop3Ds
Definition vtkPicker.h:200
double Tolerance
Definition vtkPicker.h:189
vtkActorCollection * Actors
Definition vtkPicker.h:199
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int Pick3DPoint(VTK_FUTURE_CONST double p1World[3], VTK_FUTURE_CONST double p2World[3], vtkRenderer *ren)
vtkAbstractMapper3D * Mapper
Definition vtkPicker.h:192
represent and manipulate 3D points
Definition vtkPoints.h:140
an ordered list of 3D props
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:89
abstract specification for renderers
describes linear transformations via a 4x4 matrix
#define VTK_DEPRECATED_IN_9_7_0(reason)
int vtkIdType
Definition vtkType.h:363
#define VTK_MARSHALAUTO