VTK: Rendering/Core/vtkCellPicker.h Source File

| VTK 9.3.1

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
50 VTK_ABI_NAMESPACE_BEGIN
51 class vtkMapper;
52 class vtkTexture;
53 class vtkAbstractHyperTreeGridMapper;
54 class vtkAbstractVolumeMapper;
55 class vtkImageMapper3D;
56 class vtkPlaneCollection;
57 class vtkPiecewiseFunction;
58 class vtkDataArray;
59 class vtkDoubleArray;
60 class vtkIdList;
61 class vtkCell;
62 class vtkGenericCell;
63 class vtkImageData;
64 class vtkAbstractCellLocator;
65 class vtkCollection;
66 class vtkMatrix4x4;
67 class vtkBitArray;
68 class vtkHyperTreeGridNonOrientedGeometryCursor;
69
70 class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
71 {
72 public:
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
99 void AddLocator(vtkAbstractCellLocator* locator);
100
106 void RemoveLocator(vtkAbstractCellLocator* locator);
107
111 void RemoveAllLocators();
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
256 protected:
257 vtkCellPicker();
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
278 virtual double IntersectHyperTreeGridWithLine(
279 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
280 virtual bool RecursivelyProcessTree(vtkHyperTreeGridNonOrientedGeometryCursor*, int);
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
298 static int ComputeSurfaceNormal(
299 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
300
301 static int ComputeSurfaceTCoord(
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
319 vtkCollection* Locators;
320
321 double VolumeOpacityIsovalue;
322 vtkTypeBool UseVolumeGradientOpacity;
323 vtkTypeBool PickClippingPlanes;
324 int ClippingPlaneId;
325
326 vtkIdType PointId;
327 vtkIdType CellId;
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
337 vtkTexture* Texture;
338 vtkTypeBool PickTextureData;
339
340 vtkBitArray* InMask;
341 double WordlPoint[3];
342
343 private:
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
354 VTK_ABI_NAMESPACE_END
355 #endif
vtkAbstractCellLocator
an abstract base class for locators which find cells
Definition: vtkAbstractCellLocator.h:46
vtkAbstractHyperTreeGridMapper
Abstract class for a HyperTreeGrid mapper.
Definition: vtkAbstractHyperTreeGridMapper.h:36
vtkAbstractMapper3D
abstract class specifies interface to map 3D data
Definition: vtkAbstractMapper3D.h:35
vtkAbstractVolumeMapper
Abstract class for a volume mapper.
Definition: vtkAbstractVolumeMapper.h:28
vtkAssemblyPath
a list of nodes that form an assembly path
Definition: vtkAssemblyPath.h:43
vtkBitArray
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:29
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:71
vtkCellPicker::Texture
vtkTexture * Texture
Definition: vtkCellPicker.h:337
vtkCellPicker::Locators
vtkCollection * Locators
Definition: vtkCellPicker.h:319
vtkCellPicker::ComputeSurfaceNormal
static int ComputeSurfaceNormal(vtkDataSet *data, vtkCell *cell, const double *weights, double normal[3])
vtkCellPicker::vtkCellPicker
vtkCellPicker()
vtkCellPicker::IntersectHyperTreeGridWithLine
virtual double IntersectHyperTreeGridWithLine(const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper *)
Intersect a vtkAbstractHyperTreeGridMapper with a line by ray casting.
vtkCellPicker::IntersectActorWithLine
virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1, double t2, double tol, vtkProp3D *prop, vtkMapper *mapper)
vtkCellPicker::IntersectWithLine
double IntersectWithLine(const double p1[3], const double p2[3], double tol, vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m) override
vtkCellPicker::GetTexture
vtkTexture * GetTexture()
Get the texture that was picked.
Definition: vtkCellPicker.h:238
vtkCellPicker::Initialize
void Initialize() override
vtkCellPicker::Pick
int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer) override
Perform pick operation with selection point provided.
vtkCellPicker::InMask
vtkBitArray * InMask
Definition: vtkCellPicker.h:340
vtkCellPicker::ResetPickInfo
virtual void ResetPickInfo()
vtkCellPicker::New
static vtkCellPicker * New()
vtkCellPicker::RemoveAllLocators
void RemoveAllLocators()
Remove all locators associated with this picker.
vtkCellPicker::ComputeSurfaceTCoord
static int ComputeSurfaceTCoord(vtkDataSet *data, vtkCell *cell, const double *weights, double tcoord[3])
vtkCellPicker::PickClippingPlanes
vtkTypeBool PickClippingPlanes
Definition: vtkCellPicker.h:323
vtkCellPicker::SubCellFromCell
static void SubCellFromCell(vtkGenericCell *cell, int subId)
vtkCellPicker::UseVolumeGradientOpacity
vtkTypeBool UseVolumeGradientOpacity
Definition: vtkCellPicker.h:322
vtkCellPicker::SetImageDataPickInfo
void SetImageDataPickInfo(const double x[3], const int extent[6])
vtkCellPicker::ClipLineWithPlanes
static int ClipLineWithPlanes(vtkAbstractMapper3D *mapper, vtkMatrix4x4 *propMatrix, const double p1[3], const double p2[3], double &t1, double &t2, int &planeId)
vtkCellPicker::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCellPicker::RecursivelyProcessTree
virtual bool RecursivelyProcessTree(vtkHyperTreeGridNonOrientedGeometryCursor *, int)
Intersect a vtkAbstractHyperTreeGridMapper with a line by ray casting.
vtkCellPicker::PointId
vtkIdType PointId
Definition: vtkCellPicker.h:326
vtkCellPicker::ClipLineWithExtent
static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3], double &t1, double &t2, int &planeId)
vtkCellPicker::ClippingPlaneId
int ClippingPlaneId
Definition: vtkCellPicker.h:324
vtkCellPicker::IntersectVolumeWithLine
virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1, double t2, vtkProp3D *prop, vtkAbstractVolumeMapper *mapper)
vtkCellPicker::VolumeOpacityIsovalue
double VolumeOpacityIsovalue
Definition: vtkCellPicker.h:321
vtkCellPicker::AddLocator
void AddLocator(vtkAbstractCellLocator *locator)
Add a locator for one of the data sets that will be included in the scene.
vtkCellPicker::IntersectImageWithLine
virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1, double t2, vtkProp3D *prop, vtkImageMapper3D *mapper)
vtkCellPicker::IntersectDataSetWithLine
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])
vtkCellPicker::Pick3DRay
int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer *ren) override
Perform pick operation with selection point provided.
vtkCellPicker::RemoveLocator
void RemoveLocator(vtkAbstractCellLocator *locator)
Remove a locator that was previously added.
vtkCellPicker::~vtkCellPicker
~vtkCellPicker() override
vtkCellPicker::SubId
int SubId
Definition: vtkCellPicker.h:328
vtkCellPicker::ComputeVolumeOpacity
double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData *data, vtkDataArray *scalars, vtkPiecewiseFunction *scalarOpacity, vtkPiecewiseFunction *gradientOpacity)
vtkCellPicker::GetSubCell
static void GetSubCell(vtkDataSet *data, vtkIdList *pointIds, int subId, int cellType, vtkGenericCell *cell)
vtkCellPicker::IntersectProp3DWithLine
virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1, double t2, double tol, vtkProp3D *prop, vtkAbstractMapper3D *mapper)
vtkCellPicker::PickTextureData
vtkTypeBool PickTextureData
Definition: vtkCellPicker.h:338
vtkCellPicker::GetNumberOfSubCells
static int GetNumberOfSubCells(vtkIdList *pointIds, int cellType)
vtkCellPicker::CellId
vtkIdType CellId
Definition: vtkCellPicker.h:327
vtkCellPicker::HasSubCells
static vtkTypeBool HasSubCells(int cellType)
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkCollection
create and manipulate ordered lists of objects
Definition: vtkCollection.h:45
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:40
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:38
vtkHyperTreeGridNonOrientedGeometryCursor
Objects for traversal a HyperTreeGrid.
Definition: vtkHyperTreeGridNonOrientedGeometryCursor.h:52
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:32
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
vtkImageMapper3D
abstract class for mapping images to the screen
Definition: vtkImageMapper3D.h:50
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:86
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:40
vtkPicker
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:51
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:50
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:35
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:48
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:71
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:67
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkPicker.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315