VTK  9.6.20260404
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
63
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(VTK_FUTURE_CONST double selectionPt[3], VTK_FUTURE_CONST double orient[4],
112 vtkRenderer* ren) override;
113
123
131
136
138
146 vtkSetMacro(VolumeOpacityIsovalue, double);
147 vtkGetMacro(VolumeOpacityIsovalue, double);
149
151
161
163
179
181
189 vtkGetMacro(ClippingPlaneId, int);
191
193
198 vtkGetVectorMacro(PickNormal, double, 3);
200
202
206 vtkGetVector3Macro(MapperNormal, double);
208
210
214 vtkGetVector3Macro(PointIJK, int);
216
218
223 vtkGetVector3Macro(CellIJK, int);
225
227
231 vtkGetMacro(PointId, vtkIdType);
233
235
238 vtkGetMacro(CellId, vtkIdType);
240
242
246 vtkGetMacro(SubId, int);
248
250
255 vtkGetVector3Macro(PCoords, double);
257
262 vtkTexture* GetTexture() { return this->Texture; }
263
265
276 vtkBooleanMacro(PickTextureData, vtkTypeBool);
279
280protected:
282 ~vtkCellPicker() override;
283
284 void Initialize() override;
285
286 virtual void ResetPickInfo();
287
288 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
289 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
290
291 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
292 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
293
294 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
295 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
296 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
297
299
303 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
306
307 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
308 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
309
310 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
311 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
312
313 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
314 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
315
316 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
317 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
318
319 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
320 double& t1, double& t2, int& planeId);
321
323 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
324
326 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
327
328 static vtkTypeBool HasSubCells(int cellType);
329
330 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
331
332 static void GetSubCell(
333 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
334
335 static void SubCellFromCell(vtkGenericCell* cell, int subId);
336
337 void SetImageDataPickInfo(const double x[3], const int extent[6]);
338
339 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
340 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
341 vtkPiecewiseFunction* gradientOpacity);
342
344
349
352 int SubId;
353 double PCoords[3];
354
355 int PointIJK[3];
356 int CellIJK[3];
357
358 double PickNormal[3];
359 double MapperNormal[3];
360
363
365 double WordlPoint[3];
366
367private:
368 void ResetCellPickerInfo();
369
370 vtkGenericCell* Cell; // used to accelerate picking
371 vtkIdList* PointIds; // used to accelerate picking
372 vtkDoubleArray* Gradients; // used in volume picking
373
374 vtkCellPicker(const vtkCellPicker&) = delete;
375 void operator=(const vtkCellPicker&) = delete;
376};
377
378VTK_ABI_NAMESPACE_END
379#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:33
vtkTexture * Texture
vtkCollection * Locators
static vtkCellPicker * New()
double PCoords[3]
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.
double WordlPoint[3]
void SetImageDataPickInfo(const double x[3], const int extent[6])
double MapperNormal[3]
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.
int Pick3DRay(VTK_FUTURE_CONST double selectionPt[3], VTK_FUTURE_CONST double orient[4], vtkRenderer *ren) override
Perform pick operation with selection point provided.
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])
double PickNormal[3]
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
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:135
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:97
represent and manipulate 4x4 transformation matrices
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
#define vtkDataArray
int vtkIdType
Definition vtkType.h:363
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)