VTK  9.2.5
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=========================================================================*/
47#ifndef vtkCellPicker_h
48#define vtkCellPicker_h
49
50#include "vtkPicker.h"
51#include "vtkRenderingCoreModule.h" // For export macro
52
53class vtkMapper;
54class vtkTexture;
60class vtkDataArray;
61class vtkDoubleArray;
62class vtkIdList;
63class vtkCell;
64class vtkGenericCell;
65class vtkImageData;
67class vtkCollection;
68class vtkMatrix4x4;
69class vtkBitArray;
71
72class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
73{
74public:
75 static vtkCellPicker* New();
76 vtkTypeMacro(vtkCellPicker, vtkPicker);
77 void PrintSelf(ostream& os, vtkIndent indent) override;
78
85 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
86
92 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
93
102
109
114
116
124 vtkSetMacro(VolumeOpacityIsovalue, double);
125 vtkGetMacro(VolumeOpacityIsovalue, double);
127
129
135 vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
136 vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
137 vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
139
141
153 vtkSetMacro(PickClippingPlanes, vtkTypeBool);
154 vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
155 vtkGetMacro(PickClippingPlanes, vtkTypeBool);
157
159
167 vtkGetMacro(ClippingPlaneId, int);
169
171
176 vtkGetVectorMacro(PickNormal, double, 3);
178
180
184 vtkGetVector3Macro(MapperNormal, double);
186
188
192 vtkGetVector3Macro(PointIJK, int);
194
196
201 vtkGetVector3Macro(CellIJK, int);
203
205
209 vtkGetMacro(PointId, vtkIdType);
211
213
216 vtkGetMacro(CellId, vtkIdType);
218
220
224 vtkGetMacro(SubId, int);
226
228
233 vtkGetVector3Macro(PCoords, double);
235
240 vtkTexture* GetTexture() { return this->Texture; }
241
243
253 vtkSetMacro(PickTextureData, vtkTypeBool);
254 vtkBooleanMacro(PickTextureData, vtkTypeBool);
255 vtkGetMacro(PickTextureData, vtkTypeBool);
257
258protected:
260 ~vtkCellPicker() override;
261
262 void Initialize() override;
263
264 virtual void ResetPickInfo();
265
266 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
267 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
268
269 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
270 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
271
272 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
273 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
274 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
275
277
281 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
284
285 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
286 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
287
288 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
289 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
290
291 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
292 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
293
294 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
295 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
296
297 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
298 double& t1, double& t2, int& planeId);
299
301 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
302
304 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
305
306 static int HasSubCells(int cellType);
307
308 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
309
310 static void GetSubCell(
311 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
312
313 static void SubCellFromCell(vtkGenericCell* cell, int subId);
314
315 void SetImageDataPickInfo(const double x[3], const int extent[6]);
316
317 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
318 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
319 vtkPiecewiseFunction* gradientOpacity);
320
322
327
330 int SubId;
331 double PCoords[3];
332
333 int PointIJK[3];
334 int CellIJK[3];
335
336 double PickNormal[3];
337 double MapperNormal[3];
338
341
343 double WordlPoint[3];
344
345private:
346 void ResetCellPickerInfo();
347
348 vtkGenericCell* Cell; // used to accelerate picking
349 vtkIdList* PointIds; // used to accelerate picking
350 vtkDoubleArray* Gradients; // used in volume picking
351
352private:
353 vtkCellPicker(const vtkCellPicker&) = delete;
354 void operator=(const vtkCellPicker&) = delete;
355};
356
357#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:37
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:73
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:61
create and manipulate ordered lists of objects
Definition: vtkCollection.h:56
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:56
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:34
topologically and geometrically regular array of data
Definition: vtkImageData.h:54
abstract class for mapping images to the screen
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:88
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
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:50
abstract specification for renderers
Definition: vtkRenderer.h:73
handles properties associated with a texture map
Definition: vtkTexture.h:69
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332