VTK  9.2.6
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=========================================================================*/
40
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
96
103
108
110
118 vtkSetMacro(VolumeOpacityIsovalue, double);
119 vtkGetMacro(VolumeOpacityIsovalue, double);
121
123
133
135
151
153
161 vtkGetMacro(ClippingPlaneId, int);
163
165
170 vtkGetVectorMacro(PickNormal, double, 3);
172
174
178 vtkGetVector3Macro(MapperNormal, double);
180
182
186 vtkGetVector3Macro(PointIJK, int);
188
190
195 vtkGetVector3Macro(CellIJK, int);
197
199
203 vtkGetMacro(PointId, vtkIdType);
205
207
210 vtkGetMacro(CellId, vtkIdType);
212
214
218 vtkGetMacro(SubId, int);
220
222
227 vtkGetVector3Macro(PCoords, double);
229
234 vtkTexture* GetTexture() { return this->Texture; }
235
237
248 vtkBooleanMacro(PickTextureData, vtkTypeBool);
251
252protected:
254 ~vtkCellPicker() override;
255
256 void Initialize() override;
257
258 virtual void ResetPickInfo();
259
260 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
261 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
262
263 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
264 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
265
266 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
267 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
268 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
269
271
275 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
278
279 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
280 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
281
282 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
283 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
284
285 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
286 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
287
288 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
289 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
290
291 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
292 double& t1, double& t2, int& planeId);
293
295 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
296
298 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
299
300 static int HasSubCells(int cellType);
301
302 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
303
304 static void GetSubCell(
305 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
306
307 static void SubCellFromCell(vtkGenericCell* cell, int subId);
308
309 void SetImageDataPickInfo(const double x[3], const int extent[6]);
310
311 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
312 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
313 vtkPiecewiseFunction* gradientOpacity);
314
316
321
324 int SubId;
325 double PCoords[3];
326
327 int PointIJK[3];
328 int CellIJK[3];
329
330 double PickNormal[3];
331 double MapperNormal[3];
332
335
337 double WordlPoint[3];
338
339private:
340 void ResetCellPickerInfo();
341
342 vtkGenericCell* Cell; // used to accelerate picking
343 vtkIdList* PointIds; // used to accelerate picking
344 vtkDoubleArray* Gradients; // used in volume picking
345
346private:
347 vtkCellPicker(const vtkCellPicker&) = delete;
348 void operator=(const vtkCellPicker&) = delete;
349};
350
351#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
vtkTexture * Texture
vtkCollection * Locators
static vtkCellPicker * New()
double PCoords[3]
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.
double WordlPoint[3]
void SetImageDataPickInfo(const double x[3], const int extent[6])
double MapperNormal[3]
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.
double PickNormal[3]
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
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
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
Defines a 1D piecewise function.
maintain a list of planes
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:47
abstract specification for renderers
Definition vtkRenderer.h:67
handles properties associated with a texture map
Definition vtkTexture.h:66
int vtkTypeBool
Definition vtkABI.h:69
#define vtkDataArray
int vtkIdType
Definition vtkType.h:332