VTK  9.2.6
vtkPicker.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPicker.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
43
44#ifndef vtkPicker_h
45#define vtkPicker_h
46
48#include "vtkRenderingCoreModule.h" // For export macro
49
52class vtkDataSet;
53class vtkTransform;
56class vtkPoints;
57
58class VTKRENDERINGCORE_EXPORT vtkPicker : public vtkAbstractPropPicker
59{
60public:
61 static vtkPicker* New();
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
66
71 vtkSetMacro(Tolerance, double);
72 vtkGetMacro(Tolerance, double);
74
76
80 vtkGetVectorMacro(MapperPosition, double, 3);
82
84
87 vtkGetObjectMacro(Mapper, vtkAbstractMapper3D);
89
91
95 vtkGetObjectMacro(DataSet, vtkDataSet);
97
99
105
107
114
120
127
134
141 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
142
148 int Pick(double selectionPt[3], vtkRenderer* ren)
149 {
150 return this->Pick(selectionPt[0], selectionPt[1], selectionPt[2], ren);
151 }
152
158 int Pick3DPoint(double selectionPt[3], vtkRenderer* ren) override;
159
160 /*
161 * Pick a point in the scene with the selection point and focal point
162 * provided. The two points are in world coordinates.
163 *
164 * Returns non-zero if something was successfully picked.
165 */
166 virtual int Pick3DPoint(double p1World[3], double p2World[3], vtkRenderer* ren);
172 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
173
174protected:
176 ~vtkPicker() override;
177
178 // shared code for picking
179 virtual int Pick3DInternal(vtkRenderer* ren, double p1World[4], double p2World[4]);
180
182 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m, double tMin, double mapperPos[3]);
183 void MarkPickedData(vtkAssemblyPath* path, double tMin, double mapperPos[3],
184 vtkAbstractMapper3D* mapper, vtkDataSet* input, vtkIdType flatBlockIndex = -1);
185 virtual double IntersectWithLine(const double p1[3], const double p2[3], double tol,
187 void Initialize() override;
188 static bool CalculateRay(
189 const double p1[3], const double p2[3], double ray[3], double& rayFactor);
190
191 double Tolerance; // tolerance for computation (% of window)
192 double MapperPosition[3]; // selection point in untransformed coordinates
193
194 vtkAbstractMapper3D* Mapper; // selected mapper (if the prop has a mapper)
195 vtkDataSet* DataSet; // selected dataset (if there is one)
197 vtkIdType FlatBlockIndex; // flat block index, for a composite data set
198
199 double GlobalTMin; // parametric coordinate along pick ray where hit occurred
200 vtkTransform* Transform; // use to perform ray transformation
201 vtkActorCollection* Actors; // candidate actors (based on bounding box)
202 vtkProp3DCollection* Prop3Ds; // candidate actors (based on bounding box)
203 vtkPoints* PickedPositions; // candidate positions
204
205private:
206 vtkPicker(const vtkPicker&) = delete;
207 void operator=(const vtkPicker&) = delete;
208};
209
210#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:57
a simple class to control print indentation
Definition vtkIndent.h:34
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:203
vtkPoints * GetPickedPositions()
Return a list of the points the actors returned by GetProp3Ds were intersected at.
Definition vtkPicker.h:133
int Pick(double selectionPt[3], vtkRenderer *ren)
Perform pick operation with selection point provided.
Definition vtkPicker.h:148
vtkTransform * Transform
Definition vtkPicker.h:200
vtkIdType FlatBlockIndex
Definition vtkPicker.h:197
vtkProp3DCollection * GetProp3Ds()
Return a collection of all the prop 3D's that were intersected by the pick ray.
Definition vtkPicker.h:119
vtkCompositeDataSet * CompositeDataSet
Definition vtkPicker.h:196
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:195
double MapperPosition[3]
Definition vtkPicker.h:192
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:199
vtkProp3DCollection * Prop3Ds
Definition vtkPicker.h:202
void MarkPickedData(vtkAssemblyPath *path, double tMin, double mapperPos[3], vtkAbstractMapper3D *mapper, vtkDataSet *input, vtkIdType flatBlockIndex=-1)
double Tolerance
Definition vtkPicker.h:191
vtkActorCollection * Actors
Definition vtkPicker.h:201
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:194
represent and manipulate 3D points
Definition vtkPoints.h:34
an ordered list of 3D props
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:47
abstract specification for renderers
Definition vtkRenderer.h:67
describes linear transformations via a 4x4 matrix
int vtkIdType
Definition vtkType.h:332