VTK  9.5.2
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
31
32#ifndef vtkPicker_h
33#define vtkPicker_h
34
36#include "vtkRenderingCoreModule.h" // For export macro
37#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
38
39VTK_ABI_NAMESPACE_BEGIN
42class vtkDataSet;
43class vtkTransform;
46class vtkPoints;
47
48class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkPicker : public vtkAbstractPropPicker
49{
50public:
51 static vtkPicker* New();
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
56
61 vtkSetMacro(Tolerance, double);
62 vtkGetMacro(Tolerance, double);
64
66
70 vtkGetVectorMacro(MapperPosition, double, 3);
72
74
77 vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
79
81
85 vtkGetObjectMacro(DataSet, vtkDataSet);
87
89
95
97
104
110
117
124
131 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
132
138 int Pick(double selectionPt[3], vtkRenderer* ren)
139 {
140 return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren);
141 }
142
148 int Pick3DPoint(double selectionPt[3], vtkRenderer* ren) override;
149
150 /*
151 * Pick a point in the scene with the selection point and focal point
152 * provided. The two points are in world coordinates.
153 *
154 * Returns non-zero if something was successfully picked.
155 */
156 virtual int Pick3DPoint(double p1World[3], double p2World[3], vtkRenderer* ren);
162 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
163
164protected:
166 ~vtkPicker() override;
167
168 // shared code for picking
169 virtual int Pick3DInternal(vtkRenderer* ren, double p1World[4], double p2World[4]);
170
172 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m, double tMin, double mapperPos[3]);
173 void MarkPickedData(vtkAssemblyPath* path, double tMin, double mapperPos[3],
174 vtkAbstractMapper3D* mapper, vtkDataSet* input, vtkIdType flatBlockIndex = -1);
175 virtual double IntersectWithLine(const double p1[3], const double p2[3], double tol,
177 void Initialize() override;
178 static bool CalculateRay(
179 const double p1[3], const double p2[3], double ray[3], double& rayFactor);
180
181 double Tolerance; // tolerance for computation (% of window)
182 double MapperPosition[3]; // selection point in untransformed coordinates
183
184 vtkAbstractMapper3D* Mapper; // selected mapper (if the prop has a mapper)
185 vtkDataSet* DataSet; // selected dataset (if there is one)
187 vtkIdType FlatBlockIndex; // flat block index, for a composite data set
188
189 double GlobalTMin; // parametric coordinate along pick ray where hit occurred
190 vtkTransform* Transform; // use to perform ray transformation
191 vtkActorCollection* Actors; // candidate actors (based on bounding box)
192 vtkProp3DCollection* Prop3Ds; // candidate actors (based on bounding box)
193 vtkPoints* PickedPositions; // candidate positions
194
195private:
196 vtkPicker(const vtkPicker&) = delete;
197 void operator=(const vtkPicker&) = delete;
198};
199
200VTK_ABI_NAMESPACE_END
201#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:56
a simple class to control print indentation
Definition vtkIndent.h:29
virtual int Pick3DPoint(double p1World[3], double p2World[3], vtkRenderer *ren)
static vtkPicker * New()
vtkActorCollection * GetActors()
Return a collection of all the actors that were intersected.
vtkPoints * PickedPositions
Definition vtkPicker.h:193
vtkPoints * GetPickedPositions()
Return a list of the points the actors returned by GetProp3Ds were intersected at.
Definition vtkPicker.h:123
int Pick(double selectionPt[3], vtkRenderer *ren)
Perform pick operation with selection point provided.
Definition vtkPicker.h:138
vtkTransform * Transform
Definition vtkPicker.h:190
vtkIdType FlatBlockIndex
Definition vtkPicker.h:187
vtkProp3DCollection * GetProp3Ds()
Return a collection of all the prop 3D's that were intersected by the pick ray.
Definition vtkPicker.h:109
vtkCompositeDataSet * CompositeDataSet
Definition vtkPicker.h:186
int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer *ren) override
Perform pick operation with selection point and orientation provided.
int Pick3DPoint(double selectionPt[3], vtkRenderer *ren) override
Perform pick operation with selection point provided.
void Initialize() override
virtual int Pick3DInternal(vtkRenderer *ren, double p1World[4], double p2World[4])
~vtkPicker() override
static bool CalculateRay(const double p1[3], const double p2[3], double ray[3], double &rayFactor)
vtkDataSet * DataSet
Definition vtkPicker.h:185
double MapperPosition[3]
Definition vtkPicker.h:182
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.
double GlobalTMin
Definition vtkPicker.h:189
vtkProp3DCollection * Prop3Ds
Definition vtkPicker.h:192
void MarkPickedData(vtkAssemblyPath *path, double tMin, double mapperPos[3], vtkAbstractMapper3D *mapper, vtkDataSet *input, vtkIdType flatBlockIndex=-1)
double Tolerance
Definition vtkPicker.h:181
vtkActorCollection * Actors
Definition vtkPicker.h:191
void MarkPicked(vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m, double tMin, double mapperPos[3])
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractMapper3D * Mapper
Definition vtkPicker.h:184
represent and manipulate 3D points
Definition vtkPoints.h:30
an ordered list of 3D props
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:40
abstract specification for renderers
Definition vtkRenderer.h:60
describes linear transformations via a 4x4 matrix
int vtkIdType
Definition vtkType.h:332
#define VTK_MARSHALAUTO