VTK  9.6.1
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
34
35#ifndef vtkCellPicker_h
36#define vtkCellPicker_h
37
38#include "vtkPicker.h"
39#include "vtkRenderingCoreModule.h" // For export macro
40#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
41
42VTK_ABI_NAMESPACE_BEGIN
43class vtkMapper;
44class vtkTexture;
50class vtkDataArray;
51class vtkDoubleArray;
52class vtkIdList;
53class vtkCell;
54class vtkGenericCell;
55class vtkImageData;
57class vtkCollection;
58class vtkMatrix4x4;
59class vtkBitArray;
61
62class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkCellPicker : public vtkPicker
63{
64public:
65 static vtkCellPicker* New();
66 vtkTypeMacro(vtkCellPicker, vtkPicker);
67 void PrintSelf(ostream& os, vtkIndent indent) override;
68
75 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
76
82 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
83
93
101
106
108
116 vtkSetMacro(VolumeOpacityIsovalue, double);
117 vtkGetMacro(VolumeOpacityIsovalue, double);
119
121
131
133
149
151
159 vtkGetMacro(ClippingPlaneId, int);
161
163
168 vtkGetVectorMacro(PickNormal, double, 3);
170
172
176 vtkGetVector3Macro(MapperNormal, double);
178
180
184 vtkGetVector3Macro(PointIJK, int);
186
188
193 vtkGetVector3Macro(CellIJK, int);
195
197
201 vtkGetMacro(PointId, vtkIdType);
203
205
208 vtkGetMacro(CellId, vtkIdType);
210
212
216 vtkGetMacro(SubId, int);
218
220
225 vtkGetVector3Macro(PCoords, double);
227
232 vtkTexture* GetTexture() { return this->Texture; }
233
235
246 vtkBooleanMacro(PickTextureData, vtkTypeBool);
249
250protected:
252 ~vtkCellPicker() override;
253
254 void Initialize() override;
255
256 virtual void ResetPickInfo();
257
258 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
259 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
260
261 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
262 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
263
264 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
265 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
266 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
267
269
273 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
276
277 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
278 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
279
280 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
281 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
282
283 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
284 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
285
286 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
287 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
288
289 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
290 double& t1, double& t2, int& planeId);
291
293 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
294
296 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
297
298 static vtkTypeBool HasSubCells(int cellType);
299
300 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
301
302 static void GetSubCell(
303 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
304
305 static void SubCellFromCell(vtkGenericCell* cell, int subId);
306
307 void SetImageDataPickInfo(const double x[3], const int extent[6]);
308
309 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
310 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
311 vtkPiecewiseFunction* gradientOpacity);
312
314
319
322 int SubId;
323 double PCoords[3];
324
325 int PointIJK[3];
326 int CellIJK[3];
327
328 double PickNormal[3];
329 double MapperNormal[3];
330
333
335 double WordlPoint[3];
336
337private:
338 void ResetCellPickerInfo();
339
340 vtkGenericCell* Cell; // used to accelerate picking
341 vtkIdList* PointIds; // used to accelerate picking
342 vtkDoubleArray* Gradients; // used in volume picking
343
344 vtkCellPicker(const vtkCellPicker&) = delete;
345 void operator=(const vtkCellPicker&) = delete;
346};
347
348VTK_ABI_NAMESPACE_END
349#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:31
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.
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.
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:50
create and manipulate ordered lists of objects
abstract class to specify dataset behavior
Definition vtkDataSet.h:57
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:24
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:29
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:79
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:40
abstract specification for renderers
Definition vtkRenderer.h:64
handles properties associated with a texture map
Definition vtkTexture.h:59
int vtkTypeBool
Definition vtkABI.h:64
#define vtkDataArray
int vtkIdType
Definition vtkType.h:368
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)