VTK  9.1.0
vtkCellPicker.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkCellPicker.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=========================================================================*/
41#ifndef vtkCellPicker_h
42#define vtkCellPicker_h
43
44#include "vtkPicker.h"
45#include "vtkRenderingCoreModule.h" // For export macro
46
47class vtkMapper;
48class vtkTexture;
54class vtkDataArray;
55class vtkDoubleArray;
56class vtkIdList;
57class vtkCell;
58class vtkGenericCell;
59class vtkImageData;
61class vtkCollection;
62class vtkMatrix4x4;
63class vtkBitArray;
65
66class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
67{
68public:
69 static vtkCellPicker* New();
70 vtkTypeMacro(vtkCellPicker, vtkPicker);
71 void PrintSelf(ostream& os, vtkIndent indent) override;
72
79 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
80
86 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
87
98
105
110
112
120 vtkSetMacro(VolumeOpacityIsovalue, double);
121 vtkGetMacro(VolumeOpacityIsovalue, double);
123
125
131 vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
132 vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
133 vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
135
137
149 vtkSetMacro(PickClippingPlanes, vtkTypeBool);
150 vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
151 vtkGetMacro(PickClippingPlanes, vtkTypeBool);
153
155
163 vtkGetMacro(ClippingPlaneId, int);
165
167
172 vtkGetVectorMacro(PickNormal, double, 3);
174
176
180 vtkGetVector3Macro(MapperNormal, double);
182
184
188 vtkGetVector3Macro(PointIJK, int);
190
192
197 vtkGetVector3Macro(CellIJK, int);
199
201
205 vtkGetMacro(PointId, vtkIdType);
207
209
212 vtkGetMacro(CellId, vtkIdType);
214
216
220 vtkGetMacro(SubId, int);
222
224
229 vtkGetVector3Macro(PCoords, double);
231
236 vtkTexture* GetTexture() { return this->Texture; }
237
239
249 vtkSetMacro(PickTextureData, vtkTypeBool);
250 vtkBooleanMacro(PickTextureData, vtkTypeBool);
251 vtkGetMacro(PickTextureData, vtkTypeBool);
253
254protected:
256 ~vtkCellPicker() override;
257
258 void Initialize() override;
259
260 virtual void ResetPickInfo();
261
262 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
263 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
264
265 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
266 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
267
268 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
269 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
270 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
271
273
277 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
280
281 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
282 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
283
284 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
285 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
286
287 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
288 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
289
290 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
291 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
292
293 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
294 double& t1, double& t2, int& planeId);
295
297 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
298
300 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
301
302 static int HasSubCells(int cellType);
303
304 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
305
306 static void GetSubCell(
307 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
308
309 static void SubCellFromCell(vtkGenericCell* cell, int subId);
310
311 void SetImageDataPickInfo(const double x[3], const int extent[6]);
312
313 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
314 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
315 vtkPiecewiseFunction* gradientOpacity);
316
318
323
326 int SubId;
327 double PCoords[3];
328
329 int PointIJK[3];
330 int CellIJK[3];
331
332 double PickNormal[3];
333 double MapperNormal[3];
334
337
339 double WordlPoint[3];
340
341private:
342 void ResetCellPickerInfo();
343
344 vtkGenericCell* Cell; // used to accelerate picking
345 vtkIdList* PointIds; // used to accelerate picking
346 vtkDoubleArray* Gradients; // used in volume picking
347
348private:
349 vtkCellPicker(const vtkCellPicker&) = delete;
350 void operator=(const vtkCellPicker&) = delete;
351};
352
353#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:34
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:67
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
static int HasSubCells(int cellType)
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
abstract class to specify cell behavior
Definition: vtkCell.h:58
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:31
topologically and geometrically regular array of data
Definition: vtkImageData.h:48
abstract class for mapping images to the screen
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:82
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:62
Defines a 1D piecewise function.
maintain a list of planes
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:44
abstract specification for renderers
Definition: vtkRenderer.h:73
handles properties associated with a texture map
Definition: vtkTexture.h:66
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332