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=========================================================================*/
56#ifndef vtkCellPicker_h
57#define vtkCellPicker_h
58
59#include "vtkPicker.h"
60#include "vtkRenderingCoreModule.h" // For export macro
61
62class vtkMapper;
63class vtkTexture;
69class vtkDataArray;
70class vtkDoubleArray;
71class vtkIdList;
72class vtkCell;
73class vtkGenericCell;
74class vtkImageData;
76class vtkCollection;
77class vtkMatrix4x4;
78class vtkBitArray;
80
81class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
82{
83public:
84 static vtkCellPicker* New();
85 vtkTypeMacro(vtkCellPicker, vtkPicker);
86 void PrintSelf(ostream& os, vtkIndent indent) override;
87
94 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
95
101 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
102
111
118
123
125
133 vtkSetMacro(VolumeOpacityIsovalue, double);
134 vtkGetMacro(VolumeOpacityIsovalue, double);
136
138
144 vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
145 vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
146 vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
148
150
162 vtkSetMacro(PickClippingPlanes, vtkTypeBool);
163 vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
164 vtkGetMacro(PickClippingPlanes, vtkTypeBool);
166
168
176 vtkGetMacro(ClippingPlaneId, int);
178
180
185 vtkGetVectorMacro(PickNormal, double, 3);
187
189
193 vtkGetVector3Macro(MapperNormal, double);
195
197
201 vtkGetVector3Macro(PointIJK, int);
203
205
210 vtkGetVector3Macro(CellIJK, int);
212
214
218 vtkGetMacro(PointId, vtkIdType);
220
222
225 vtkGetMacro(CellId, vtkIdType);
227
229
233 vtkGetMacro(SubId, int);
235
237
242 vtkGetVector3Macro(PCoords, double);
244
249 vtkTexture* GetTexture() { return this->Texture; }
250
252
262 vtkSetMacro(PickTextureData, vtkTypeBool);
263 vtkBooleanMacro(PickTextureData, vtkTypeBool);
264 vtkGetMacro(PickTextureData, vtkTypeBool);
266
267protected:
269 ~vtkCellPicker() override;
270
271 void Initialize() override;
272
273 virtual void ResetPickInfo();
274
275 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
276 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
277
278 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
279 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
280
281 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
282 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
283 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
284
286
290 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
293
294 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
295 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
296
297 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
298 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
299
300 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
301 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
302
303 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
304 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
305
306 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
307 double& t1, double& t2, int& planeId);
308
310 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
311
313 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
314
315 static int HasSubCells(int cellType);
316
317 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
318
319 static void GetSubCell(
320 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
321
322 static void SubCellFromCell(vtkGenericCell* cell, int subId);
323
324 void SetImageDataPickInfo(const double x[3], const int extent[6]);
325
326 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
327 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
328 vtkPiecewiseFunction* gradientOpacity);
329
331
336
339 int SubId;
340 double PCoords[3];
341
342 int PointIJK[3];
343 int CellIJK[3];
344
345 double PickNormal[3];
346 double MapperNormal[3];
347
350
352 double WordlPoint[3];
353
354private:
355 void ResetCellPickerInfo();
356
357 vtkGenericCell* Cell; // used to accelerate picking
358 vtkIdList* PointIds; // used to accelerate picking
359 vtkDoubleArray* Gradients; // used in volume picking
360
361private:
362 vtkCellPicker(const vtkCellPicker&) = delete;
363 void operator=(const vtkCellPicker&) = delete;
364};
365
366#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
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:70
create and manipulate ordered lists of objects
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:72
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:43
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:49
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:97
represent and manipulate 4x4 transformation matrices
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:59
abstract specification for renderers
Definition vtkRenderer.h:82
handles properties associated with a texture map
Definition vtkTexture.h:78
int vtkTypeBool
Definition vtkABI.h:69
int vtkIdType
Definition vtkType.h:332