VTK  9.3.0
vtkCellPicker.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
44#ifndef vtkCellPicker_h
45#define vtkCellPicker_h
46
47#include "vtkPicker.h"
48#include "vtkRenderingCoreModule.h" // For export macro
49
50VTK_ABI_NAMESPACE_BEGIN
51class vtkMapper;
52class vtkTexture;
58class vtkDataArray;
59class vtkDoubleArray;
60class vtkIdList;
61class vtkCell;
62class vtkGenericCell;
63class vtkImageData;
65class vtkCollection;
66class vtkMatrix4x4;
67class vtkBitArray;
69
70class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
71{
72public:
73 static vtkCellPicker* New();
74 vtkTypeMacro(vtkCellPicker, vtkPicker);
75 void PrintSelf(ostream& os, vtkIndent indent) override;
76
83 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
84
90 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
91
100
107
112
114
122 vtkSetMacro(VolumeOpacityIsovalue, double);
123 vtkGetMacro(VolumeOpacityIsovalue, double);
125
127
133 vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
134 vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
135 vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
137
139
151 vtkSetMacro(PickClippingPlanes, vtkTypeBool);
152 vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
153 vtkGetMacro(PickClippingPlanes, vtkTypeBool);
155
157
165 vtkGetMacro(ClippingPlaneId, int);
167
169
174 vtkGetVectorMacro(PickNormal, double, 3);
176
178
182 vtkGetVector3Macro(MapperNormal, double);
184
186
190 vtkGetVector3Macro(PointIJK, int);
192
194
199 vtkGetVector3Macro(CellIJK, int);
201
203
207 vtkGetMacro(PointId, vtkIdType);
209
211
214 vtkGetMacro(CellId, vtkIdType);
216
218
222 vtkGetMacro(SubId, int);
224
226
231 vtkGetVector3Macro(PCoords, double);
233
238 vtkTexture* GetTexture() { return this->Texture; }
239
241
251 vtkSetMacro(PickTextureData, vtkTypeBool);
252 vtkBooleanMacro(PickTextureData, vtkTypeBool);
253 vtkGetMacro(PickTextureData, vtkTypeBool);
255
256protected:
258 ~vtkCellPicker() override;
259
260 void Initialize() override;
261
262 virtual void ResetPickInfo();
263
264 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
265 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
266
267 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
268 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
269
270 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
271 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
272 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
273
275
279 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
282
283 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
284 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
285
286 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
287 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
288
289 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
290 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
291
292 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
293 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
294
295 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
296 double& t1, double& t2, int& planeId);
297
299 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
300
302 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
303
304 static vtkTypeBool HasSubCells(int cellType);
305
306 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
307
308 static void GetSubCell(
309 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
310
311 static void SubCellFromCell(vtkGenericCell* cell, int subId);
312
313 void SetImageDataPickInfo(const double x[3], const int extent[6]);
314
315 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
316 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
317 vtkPiecewiseFunction* gradientOpacity);
318
320
325
328 int SubId;
329 double PCoords[3];
330
331 int PointIJK[3];
332 int CellIJK[3];
333
334 double PickNormal[3];
335 double MapperNormal[3];
336
339
341 double WordlPoint[3];
342
343private:
344 void ResetCellPickerInfo();
345
346 vtkGenericCell* Cell; // used to accelerate picking
347 vtkIdList* PointIds; // used to accelerate picking
348 vtkDoubleArray* Gradients; // used in volume picking
349
350 vtkCellPicker(const vtkCellPicker&) = delete;
351 void operator=(const vtkCellPicker&) = delete;
352};
353
354VTK_ABI_NAMESPACE_END
355#endif
an abstract base class for locators which find cells
Abstract class for a HyperTreeGrid mapper.
abstract class specifies interface to map 3D data
Abstract class for a volume mapper.
a list of nodes that form an assembly path
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:29
ray-cast cell picker for all kinds of Prop3Ds
vtkTexture * Texture
vtkCollection * Locators
static vtkCellPicker * New()
static int ComputeSurfaceNormal(vtkDataSet *data, vtkCell *cell, const double *weights, double normal[3])
virtual double IntersectHyperTreeGridWithLine(const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper *)
Intersect a vtkAbstractHyperTreeGridMapper with a line by ray casting.
virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1, double t2, double tol, vtkProp3D *prop, vtkMapper *mapper)
double IntersectWithLine(const double p1[3], const double p2[3], double tol, vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m) override
void Initialize() override
int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer) override
Perform pick operation with selection point provided.
vtkBitArray * InMask
virtual void ResetPickInfo()
void RemoveAllLocators()
Remove all locators associated with this picker.
static int ComputeSurfaceTCoord(vtkDataSet *data, vtkCell *cell, const double *weights, double tcoord[3])
vtkTypeBool PickClippingPlanes
static void SubCellFromCell(vtkGenericCell *cell, int subId)
vtkTypeBool UseVolumeGradientOpacity
vtkTexture * GetTexture()
Get the texture that was picked.
void SetImageDataPickInfo(const double x[3], const int extent[6])
static int ClipLineWithPlanes(vtkAbstractMapper3D *mapper, vtkMatrix4x4 *propMatrix, const double p1[3], const double p2[3], double &t1, double &t2, int &planeId)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool RecursivelyProcessTree(vtkHyperTreeGridNonOrientedGeometryCursor *, int)
Intersect a vtkAbstractHyperTreeGridMapper with a line by ray casting.
vtkIdType PointId
static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3], double &t1, double &t2, int &planeId)
virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1, double t2, vtkProp3D *prop, vtkAbstractVolumeMapper *mapper)
double VolumeOpacityIsovalue
void AddLocator(vtkAbstractCellLocator *locator)
Add a locator for one of the data sets that will be included in the scene.
virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1, double t2, vtkProp3D *prop, vtkImageMapper3D *mapper)
virtual bool IntersectDataSetWithLine(vtkDataSet *dataSet, const double p1[3], const double p2[3], double t1, double t2, double tol, vtkAbstractCellLocator *&locator, vtkIdType &cellId, int &subId, double &tMin, double &pDistMin, double xyz[3], double minPCoords[3])
int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer *ren) override
Perform pick operation with selection point provided.
void RemoveLocator(vtkAbstractCellLocator *locator)
Remove a locator that was previously added.
~vtkCellPicker() override
double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData *data, vtkDataArray *scalars, vtkPiecewiseFunction *scalarOpacity, vtkPiecewiseFunction *gradientOpacity)
static void GetSubCell(vtkDataSet *data, vtkIdList *pointIds, int subId, int cellType, vtkGenericCell *cell)
virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1, double t2, double tol, vtkProp3D *prop, vtkAbstractMapper3D *mapper)
vtkTypeBool PickTextureData
static int GetNumberOfSubCells(vtkIdList *pointIds, int cellType)
vtkIdType CellId
static vtkTypeBool HasSubCells(int cellType)
abstract class to specify cell behavior
Definition vtkCell.h:59
create and manipulate ordered lists of objects
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:62
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:32
topologically and geometrically regular array of data
abstract class for mapping images to the screen
a simple class to control print indentation
Definition vtkIndent.h:38
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:86
represent and manipulate 4x4 transformation matrices
superclass for 3D geometric pickers (uses ray cast)
Definition vtkPicker.h:48
Defines a 1D piecewise function.
maintain a list of planes
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:48
abstract specification for renderers
Definition vtkRenderer.h:68
handles properties associated with a texture map
Definition vtkTexture.h:67
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315