VTK  9.3.20240328
vtkCellPicker.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
64 #ifndef vtkCellPicker_h
65 #define vtkCellPicker_h
66 
67 #include "vtkPicker.h"
68 #include "vtkRenderingCoreModule.h" // For export macro
69 
70 VTK_ABI_NAMESPACE_BEGIN
71 class vtkMapper;
72 class vtkTexture;
75 class vtkImageMapper3D;
76 class vtkPlaneCollection;
78 class vtkDataArray;
79 class vtkDoubleArray;
80 class vtkIdList;
81 class vtkCell;
82 class vtkGenericCell;
83 class vtkImageData;
85 class vtkCollection;
86 class vtkMatrix4x4;
87 class vtkBitArray;
89 
90 class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
91 {
92 public:
93  static vtkCellPicker* New();
94  vtkTypeMacro(vtkCellPicker, vtkPicker);
95  void PrintSelf(ostream& os, vtkIndent indent) override;
96 
103  int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
104 
110  int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
111 
120 
127 
132 
134 
142  vtkSetMacro(VolumeOpacityIsovalue, double);
143  vtkGetMacro(VolumeOpacityIsovalue, double);
145 
147 
153  vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
154  vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
155  vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
157 
159 
171  vtkSetMacro(PickClippingPlanes, vtkTypeBool);
172  vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
173  vtkGetMacro(PickClippingPlanes, vtkTypeBool);
175 
177 
185  vtkGetMacro(ClippingPlaneId, int);
187 
189 
194  vtkGetVectorMacro(PickNormal, double, 3);
196 
198 
202  vtkGetVector3Macro(MapperNormal, double);
204 
206 
210  vtkGetVector3Macro(PointIJK, int);
212 
214 
219  vtkGetVector3Macro(CellIJK, int);
221 
223 
227  vtkGetMacro(PointId, vtkIdType);
229 
231 
234  vtkGetMacro(CellId, vtkIdType);
236 
238 
242  vtkGetMacro(SubId, int);
244 
246 
251  vtkGetVector3Macro(PCoords, double);
253 
258  vtkTexture* GetTexture() { return this->Texture; }
259 
261 
271  vtkSetMacro(PickTextureData, vtkTypeBool);
272  vtkBooleanMacro(PickTextureData, vtkTypeBool);
273  vtkGetMacro(PickTextureData, vtkTypeBool);
275 
276 protected:
278  ~vtkCellPicker() override;
279 
280  void Initialize() override;
281 
282  virtual void ResetPickInfo();
283 
284  double IntersectWithLine(const double p1[3], const double p2[3], double tol,
285  vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
286 
287  virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
288  double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
289 
290  virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
291  double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
292  int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
293 
295 
299  const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
302 
303  virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
304  double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
305 
306  virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
307  double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
308 
309  virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
310  double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
311 
312  static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
313  const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
314 
315  static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
316  double& t1, double& t2, int& planeId);
317 
319  vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
320 
322  vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
323 
324  static vtkTypeBool HasSubCells(int cellType);
325 
326  static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
327 
328  static void GetSubCell(
329  vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
330 
331  static void SubCellFromCell(vtkGenericCell* cell, int subId);
332 
333  void SetImageDataPickInfo(const double x[3], const int extent[6]);
334 
335  double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
336  vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
337  vtkPiecewiseFunction* gradientOpacity);
338 
340 
345 
348  int SubId;
349  double PCoords[3];
350 
351  int PointIJK[3];
352  int CellIJK[3];
353 
354  double PickNormal[3];
355  double MapperNormal[3];
356 
359 
361  double WordlPoint[3];
362 
363 private:
364  void ResetCellPickerInfo();
365 
366  vtkGenericCell* Cell; // used to accelerate picking
367  vtkIdList* PointIds; // used to accelerate picking
368  vtkDoubleArray* Gradients; // used in volume picking
369 
370  vtkCellPicker(const vtkCellPicker&) = delete;
371  void operator=(const vtkCellPicker&) = delete;
372 };
373 
374 VTK_ABI_NAMESPACE_END
375 #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:29
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:91
vtkTexture * Texture
vtkCollection * Locators
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
vtkTexture * GetTexture()
Get the texture that was picked.
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()
static vtkCellPicker * New()
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
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
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
static vtkTypeBool HasSubCells(int cellType)
abstract class to specify cell behavior
Definition: vtkCell.h:130
create and manipulate ordered lists of objects
Definition: vtkCollection.h:45
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:154
abstract class to specify dataset behavior
Definition: vtkDataSet.h:165
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:132
topologically and geometrically regular array of data
Definition: vtkImageData.h:155
abstract class for mapping images to the screen
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:136
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:140
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:51
Defines a 1D piecewise function.
maintain a list of planes
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:88
abstract specification for renderers
Definition: vtkRenderer.h:171
handles properties associated with a texture map
Definition: vtkTexture.h:167
const std::string pointIds
@ extent
Definition: vtkX3D.h:345
@ data
Definition: vtkX3D.h:315
int vtkTypeBool
Definition: vtkABI.h:64
int vtkIdType
Definition: vtkType.h:315