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=========================================================================*/
70#ifndef vtkCellPicker_h
71#define vtkCellPicker_h
72
73#include "vtkPicker.h"
74#include "vtkRenderingCoreModule.h" // For export macro
75
76class vtkMapper;
77class vtkTexture;
83class vtkDataArray;
84class vtkDoubleArray;
85class vtkIdList;
86class vtkCell;
87class vtkGenericCell;
88class vtkImageData;
90class vtkCollection;
91class vtkMatrix4x4;
92class vtkBitArray;
94
95class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
96{
97public:
98 static vtkCellPicker* New();
99 vtkTypeMacro(vtkCellPicker, vtkPicker);
100 void PrintSelf(ostream& os, vtkIndent indent) override;
101
108 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
109
115 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
116
127
134
139
141
149 vtkSetMacro(VolumeOpacityIsovalue, double);
150 vtkGetMacro(VolumeOpacityIsovalue, double);
152
154
160 vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
161 vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
162 vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
164
166
178 vtkSetMacro(PickClippingPlanes, vtkTypeBool);
179 vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
180 vtkGetMacro(PickClippingPlanes, vtkTypeBool);
182
184
192 vtkGetMacro(ClippingPlaneId, int);
194
196
201 vtkGetVectorMacro(PickNormal, double, 3);
203
205
209 vtkGetVector3Macro(MapperNormal, double);
211
213
217 vtkGetVector3Macro(PointIJK, int);
219
221
226 vtkGetVector3Macro(CellIJK, int);
228
230
234 vtkGetMacro(PointId, vtkIdType);
236
238
241 vtkGetMacro(CellId, vtkIdType);
243
245
249 vtkGetMacro(SubId, int);
251
253
258 vtkGetVector3Macro(PCoords, double);
260
265 vtkTexture* GetTexture() { return this->Texture; }
266
268
278 vtkSetMacro(PickTextureData, vtkTypeBool);
279 vtkBooleanMacro(PickTextureData, vtkTypeBool);
280 vtkGetMacro(PickTextureData, vtkTypeBool);
282
283protected:
285 ~vtkCellPicker() override;
286
287 void Initialize() override;
288
289 virtual void ResetPickInfo();
290
291 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
292 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
293
294 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
295 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
296
297 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
298 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
299 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
300
302
306 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
309
310 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
311 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
312
313 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
314 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
315
316 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
317 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
318
319 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
320 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
321
322 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
323 double& t1, double& t2, int& planeId);
324
326 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
327
329 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
330
331 static int HasSubCells(int cellType);
332
333 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
334
335 static void GetSubCell(
336 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
337
338 static void SubCellFromCell(vtkGenericCell* cell, int subId);
339
340 void SetImageDataPickInfo(const double x[3], const int extent[6]);
341
342 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
343 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
344 vtkPiecewiseFunction* gradientOpacity);
345
347
352
355 int SubId;
356 double PCoords[3];
357
358 int PointIJK[3];
359 int CellIJK[3];
360
361 double PickNormal[3];
362 double MapperNormal[3];
363
366
368 double WordlPoint[3];
369
370private:
371 void ResetCellPickerInfo();
372
373 vtkGenericCell* Cell; // used to accelerate picking
374 vtkIdList* PointIds; // used to accelerate picking
375 vtkDoubleArray* Gradients; // used in volume picking
376
377private:
378 vtkCellPicker(const vtkCellPicker&) = delete;
379 void operator=(const vtkCellPicker&) = delete;
380};
381
382#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:96
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:147
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:140
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
abstract class for mapping images to the screen
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:171
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:145
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:93
abstract specification for renderers
Definition: vtkRenderer.h:173
handles properties associated with a texture map
Definition: vtkTexture.h:175
@ extent
Definition: vtkX3D.h:351
@ data
Definition: vtkX3D.h:321
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332