VTK  9.4.20250509
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
70
71VTK_ABI_NAMESPACE_BEGIN
72class vtkMapper;
73class vtkTexture;
79class vtkDataArray;
80class vtkDoubleArray;
81class vtkIdList;
82class vtkCell;
83class vtkGenericCell;
84class vtkImageData;
86class vtkCollection;
87class vtkMatrix4x4;
88class vtkBitArray;
90
91class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkCellPicker : public vtkPicker
92{
93public:
94 static vtkCellPicker* New();
95 vtkTypeMacro(vtkCellPicker, vtkPicker);
96 void PrintSelf(ostream& os, vtkIndent indent) override;
97
104 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
105
111 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
112
121 void AddLocator(vtkAbstractCellLocator* locator);
122
129 void RemoveLocator(vtkAbstractCellLocator* locator);
130
134 void RemoveAllLocators();
135
137
145 vtkSetMacro(VolumeOpacityIsovalue, double);
146 vtkGetMacro(VolumeOpacityIsovalue, double);
148
150
156 vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
157 vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
158 vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
160
162
174 vtkSetMacro(PickClippingPlanes, vtkTypeBool);
175 vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
176 vtkGetMacro(PickClippingPlanes, vtkTypeBool);
178
180
188 vtkGetMacro(ClippingPlaneId, int);
190
192
197 vtkGetVectorMacro(PickNormal, double, 3);
199
201
205 vtkGetVector3Macro(MapperNormal, double);
207
209
213 vtkGetVector3Macro(PointIJK, int);
215
217
222 vtkGetVector3Macro(CellIJK, int);
224
226
230 vtkGetMacro(PointId, vtkIdType);
232
234
237 vtkGetMacro(CellId, vtkIdType);
239
241
245 vtkGetMacro(SubId, int);
247
249
254 vtkGetVector3Macro(PCoords, double);
256
261 vtkTexture* GetTexture() { return this->Texture; }
262
264
274 vtkSetMacro(PickTextureData, vtkTypeBool);
275 vtkBooleanMacro(PickTextureData, vtkTypeBool);
276 vtkGetMacro(PickTextureData, vtkTypeBool);
278
279protected:
281 ~vtkCellPicker() override;
282
283 void Initialize() override;
284
285 virtual void ResetPickInfo();
286
287 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
288 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
289
290 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
291 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
292
293 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
294 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
295 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
296
298
302 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
305
306 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
307 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
308
309 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
310 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
311
312 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
313 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
314
315 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
316 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
317
318 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
319 double& t1, double& t2, int& planeId);
320
322 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
323
325 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
326
327 static vtkTypeBool HasSubCells(int cellType);
328
329 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
330
331 static void GetSubCell(
332 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
333
334 static void SubCellFromCell(vtkGenericCell* cell, int subId);
335
336 void SetImageDataPickInfo(const double x[3], const int extent[6]);
337
338 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
339 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
340 vtkPiecewiseFunction* gradientOpacity);
341
343
348
351 int SubId;
352 double PCoords[3];
353
354 int PointIJK[3];
355 int CellIJK[3];
356
357 double PickNormal[3];
358 double MapperNormal[3];
359
362
364 double WordlPoint[3];
365
366private:
367 void ResetCellPickerInfo();
368
369 vtkGenericCell* Cell; // used to accelerate picking
370 vtkIdList* PointIds; // used to accelerate picking
371 vtkDoubleArray* Gradients; // used in volume picking
372
373 vtkCellPicker(const vtkCellPicker&) = delete;
374 void operator=(const vtkCellPicker&) = delete;
375};
376
377VTK_ABI_NAMESPACE_END
378#endif
RealT t2
Definition PyrC2Basis.h:22
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
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()
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
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.
~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
abstract superclass for arrays of numeric data
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:133
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:108
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:98
represent and manipulate 4x4 transformation matrices
superclass for 3D geometric pickers (uses ray cast)
Definition vtkPicker.h:52
Defines a 1D piecewise function.
maintain a list of planes
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:89
abstract specification for renderers
handles properties associated with a texture map
Definition vtkTexture.h:168
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:332
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)