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=========================================================================*/
50#ifndef vtkCellPicker_h
51#define vtkCellPicker_h
52
53#include "vtkPicker.h"
54#include "vtkRenderingCoreModule.h" // For export macro
55
56class vtkMapper;
57class vtkTexture;
63class vtkDataArray;
64class vtkDoubleArray;
65class vtkIdList;
66class vtkCell;
67class vtkGenericCell;
68class vtkImageData;
70class vtkCollection;
71class vtkMatrix4x4;
72class vtkBitArray;
74
75class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
76{
77public:
78 static vtkCellPicker* New();
79 vtkTypeMacro(vtkCellPicker, vtkPicker);
80 void PrintSelf(ostream& os, vtkIndent indent) override;
81
88 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
89
95 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
96
107
114
119
121
129 vtkSetMacro(VolumeOpacityIsovalue, double);
130 vtkGetMacro(VolumeOpacityIsovalue, double);
132
134
140 vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
141 vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
142 vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
144
146
158 vtkSetMacro(PickClippingPlanes, vtkTypeBool);
159 vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
160 vtkGetMacro(PickClippingPlanes, vtkTypeBool);
162
164
172 vtkGetMacro(ClippingPlaneId, int);
174
176
181 vtkGetVectorMacro(PickNormal, double, 3);
183
185
189 vtkGetVector3Macro(MapperNormal, double);
191
193
197 vtkGetVector3Macro(PointIJK, int);
199
201
206 vtkGetVector3Macro(CellIJK, int);
208
210
214 vtkGetMacro(PointId, vtkIdType);
216
218
221 vtkGetMacro(CellId, vtkIdType);
223
225
229 vtkGetMacro(SubId, int);
231
233
238 vtkGetVector3Macro(PCoords, double);
240
245 vtkTexture* GetTexture() { return this->Texture; }
246
248
258 vtkSetMacro(PickTextureData, vtkTypeBool);
259 vtkBooleanMacro(PickTextureData, vtkTypeBool);
260 vtkGetMacro(PickTextureData, vtkTypeBool);
262
263protected:
265 ~vtkCellPicker() override;
266
267 void Initialize() override;
268
269 virtual void ResetPickInfo();
270
271 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
272 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
273
274 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
275 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
276
277 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
278 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
279 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
280
282
286 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
289
290 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
291 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
292
293 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
294 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
295
296 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
297 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
298
299 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
300 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
301
302 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
303 double& t1, double& t2, int& planeId);
304
306 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
307
309 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
310
311 static int HasSubCells(int cellType);
312
313 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
314
315 static void GetSubCell(
316 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
317
318 static void SubCellFromCell(vtkGenericCell* cell, int subId);
319
320 void SetImageDataPickInfo(const double x[3], const int extent[6]);
321
322 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
323 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
324 vtkPiecewiseFunction* gradientOpacity);
325
327
332
335 int SubId;
336 double PCoords[3];
337
338 int PointIJK[3];
339 int CellIJK[3];
340
341 double PickNormal[3];
342 double MapperNormal[3];
343
346
348 double WordlPoint[3];
349
350private:
351 void ResetCellPickerInfo();
352
353 vtkGenericCell* Cell; // used to accelerate picking
354 vtkIdList* PointIds; // used to accelerate picking
355 vtkDoubleArray* Gradients; // used in volume picking
356
357private:
358 vtkCellPicker(const vtkCellPicker&) = delete;
359 void operator=(const vtkCellPicker&) = delete;
360};
361
362#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:76
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:67
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:59
abstract class to specify dataset behavior
Definition: vtkDataSet.h:66
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:40
topologically and geometrically regular array of data
Definition: vtkImageData.h:57
abstract class for mapping images to the screen
a simple class to control print indentation
Definition: vtkIndent.h:43
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:91
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:45
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:56
Defines a 1D piecewise function.
maintain a list of planes
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:53
abstract specification for renderers
Definition: vtkRenderer.h:73
handles properties associated with a texture map
Definition: vtkTexture.h:75
@ extent
Definition: vtkX3D.h:351
@ data
Definition: vtkX3D.h:321
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332