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
35#ifndef vtkCellPicker_h
36#define vtkCellPicker_h
37
38#include "vtkPicker.h"
39#include "vtkRenderingCoreModule.h" // For export macro
40
41VTK_ABI_NAMESPACE_BEGIN
42class vtkMapper;
43class vtkTexture;
49class vtkDataArray;
50class vtkDoubleArray;
51class vtkIdList;
52class vtkCell;
53class vtkGenericCell;
54class vtkImageData;
56class vtkCollection;
57class vtkMatrix4x4;
58class vtkBitArray;
60
61class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
62{
63public:
64 static vtkCellPicker* New();
65 vtkTypeMacro(vtkCellPicker, vtkPicker);
66 void PrintSelf(ostream& os, vtkIndent indent) override;
67
74 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
75
81 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
82
91
98
103
105
113 vtkSetMacro(VolumeOpacityIsovalue, double);
114 vtkGetMacro(VolumeOpacityIsovalue, double);
116
118
124 vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
125 vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
126 vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
128
130
142 vtkSetMacro(PickClippingPlanes, vtkTypeBool);
143 vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
144 vtkGetMacro(PickClippingPlanes, vtkTypeBool);
146
148
156 vtkGetMacro(ClippingPlaneId, int);
158
160
165 vtkGetVectorMacro(PickNormal, double, 3);
167
169
173 vtkGetVector3Macro(MapperNormal, double);
175
177
181 vtkGetVector3Macro(PointIJK, int);
183
185
190 vtkGetVector3Macro(CellIJK, int);
192
194
198 vtkGetMacro(PointId, vtkIdType);
200
202
205 vtkGetMacro(CellId, vtkIdType);
207
209
213 vtkGetMacro(SubId, int);
215
217
222 vtkGetVector3Macro(PCoords, double);
224
229 vtkTexture* GetTexture() { return this->Texture; }
230
232
242 vtkSetMacro(PickTextureData, vtkTypeBool);
243 vtkBooleanMacro(PickTextureData, vtkTypeBool);
244 vtkGetMacro(PickTextureData, vtkTypeBool);
246
247protected:
249 ~vtkCellPicker() override;
250
251 void Initialize() override;
252
253 virtual void ResetPickInfo();
254
255 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
256 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
257
258 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
259 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
260
261 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
262 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
263 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
264
266
270 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
273
274 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
275 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
276
277 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
278 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
279
280 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
281 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
282
283 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
284 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
285
286 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
287 double& t1, double& t2, int& planeId);
288
290 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
291
293 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
294
295 static vtkTypeBool HasSubCells(int cellType);
296
297 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
298
299 static void GetSubCell(
300 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
301
302 static void SubCellFromCell(vtkGenericCell* cell, int subId);
303
304 void SetImageDataPickInfo(const double x[3], const int extent[6]);
305
306 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
307 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
308 vtkPiecewiseFunction* gradientOpacity);
309
311
316
319 int SubId;
320 double PCoords[3];
321
322 int PointIJK[3];
323 int CellIJK[3];
324
325 double PickNormal[3];
326 double MapperNormal[3];
327
330
332 double WordlPoint[3];
333
334private:
335 void ResetCellPickerInfo();
336
337 vtkGenericCell* Cell; // used to accelerate picking
338 vtkIdList* PointIds; // used to accelerate picking
339 vtkDoubleArray* Gradients; // used in volume picking
340
341 vtkCellPicker(const vtkCellPicker&) = delete;
342 void operator=(const vtkCellPicker&) = delete;
343};
344
345VTK_ABI_NAMESPACE_END
346#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:50
create and manipulate ordered lists of objects
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:53
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:23
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:29
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:77
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:39
abstract specification for renderers
Definition vtkRenderer.h:59
handles properties associated with a texture map
Definition vtkTexture.h:58
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315