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=========================================================================*/
76#ifndef vtkCellPicker_h
77#define vtkCellPicker_h
78
79#include "vtkPicker.h"
80#include "vtkRenderingCoreModule.h" // For export macro
81
82class vtkMapper;
83class vtkTexture;
89class vtkDataArray;
90class vtkDoubleArray;
91class vtkIdList;
92class vtkCell;
93class vtkGenericCell;
94class vtkImageData;
96class vtkCollection;
97class vtkMatrix4x4;
98class vtkBitArray;
100
101class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
102{
103public:
105 vtkTypeMacro(vtkCellPicker, vtkPicker);
106 void PrintSelf(ostream& os, vtkIndent indent) override;
107
114 int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer* renderer) override;
115
121 int Pick3DRay(double selectionPt[3], double orient[4], vtkRenderer* ren) override;
122
131
138
143
145
153 vtkSetMacro(VolumeOpacityIsovalue, double);
154 vtkGetMacro(VolumeOpacityIsovalue, double);
156
158
164 vtkSetMacro(UseVolumeGradientOpacity, vtkTypeBool);
165 vtkBooleanMacro(UseVolumeGradientOpacity, vtkTypeBool);
166 vtkGetMacro(UseVolumeGradientOpacity, vtkTypeBool);
168
170
182 vtkSetMacro(PickClippingPlanes, vtkTypeBool);
183 vtkBooleanMacro(PickClippingPlanes, vtkTypeBool);
184 vtkGetMacro(PickClippingPlanes, vtkTypeBool);
186
188
196 vtkGetMacro(ClippingPlaneId, int);
198
200
205 vtkGetVectorMacro(PickNormal, double, 3);
207
209
213 vtkGetVector3Macro(MapperNormal, double);
215
217
221 vtkGetVector3Macro(PointIJK, int);
223
225
230 vtkGetVector3Macro(CellIJK, int);
232
234
238 vtkGetMacro(PointId, vtkIdType);
240
242
245 vtkGetMacro(CellId, vtkIdType);
247
249
253 vtkGetMacro(SubId, int);
255
257
262 vtkGetVector3Macro(PCoords, double);
264
269 vtkTexture* GetTexture() { return this->Texture; }
270
272
282 vtkSetMacro(PickTextureData, vtkTypeBool);
283 vtkBooleanMacro(PickTextureData, vtkTypeBool);
284 vtkGetMacro(PickTextureData, vtkTypeBool);
286
287protected:
289 ~vtkCellPicker() override;
290
291 void Initialize() override;
292
293 virtual void ResetPickInfo();
294
295 double IntersectWithLine(const double p1[3], const double p2[3], double tol,
296 vtkAssemblyPath* path, vtkProp3D* p, vtkAbstractMapper3D* m) override;
297
298 virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1,
299 double t2, double tol, vtkProp3D* prop, vtkMapper* mapper);
300
301 virtual bool IntersectDataSetWithLine(vtkDataSet* dataSet, const double p1[3], const double p2[3],
302 double t1, double t2, double tol, vtkAbstractCellLocator*& locator, vtkIdType& cellId,
303 int& subId, double& tMin, double& pDistMin, double xyz[3], double minPCoords[3]);
304
306
310 const double[3], const double[3], double, double, vtkAbstractHyperTreeGridMapper*);
313
314 virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1,
315 double t2, vtkProp3D* prop, vtkAbstractVolumeMapper* mapper);
316
317 virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1,
318 double t2, vtkProp3D* prop, vtkImageMapper3D* mapper);
319
320 virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1,
321 double t2, double tol, vtkProp3D* prop, vtkAbstractMapper3D* mapper);
322
323 static int ClipLineWithPlanes(vtkAbstractMapper3D* mapper, vtkMatrix4x4* propMatrix,
324 const double p1[3], const double p2[3], double& t1, double& t2, int& planeId);
325
326 static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3],
327 double& t1, double& t2, int& planeId);
328
330 vtkDataSet* data, vtkCell* cell, const double* weights, double normal[3]);
331
333 vtkDataSet* data, vtkCell* cell, const double* weights, double tcoord[3]);
334
335 static int HasSubCells(int cellType);
336
337 static int GetNumberOfSubCells(vtkIdList* pointIds, int cellType);
338
339 static void GetSubCell(
340 vtkDataSet* data, vtkIdList* pointIds, int subId, int cellType, vtkGenericCell* cell);
341
342 static void SubCellFromCell(vtkGenericCell* cell, int subId);
343
344 void SetImageDataPickInfo(const double x[3], const int extent[6]);
345
346 double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData* data,
347 vtkDataArray* scalars, vtkPiecewiseFunction* scalarOpacity,
348 vtkPiecewiseFunction* gradientOpacity);
349
351
356
359 int SubId;
360 double PCoords[3];
361
362 int PointIJK[3];
363 int CellIJK[3];
364
365 double PickNormal[3];
366 double MapperNormal[3];
367
370
372 double WordlPoint[3];
373
374private:
375 void ResetCellPickerInfo();
376
377 vtkGenericCell* Cell; // used to accelerate picking
378 vtkIdList* PointIds; // used to accelerate picking
379 vtkDoubleArray* Gradients; // used in volume picking
380
381private:
382 vtkCellPicker(const vtkCellPicker&) = delete;
383 void operator=(const vtkCellPicker&) = delete;
384};
385
386#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:150
create and manipulate ordered lists of objects
Definition: vtkCollection.h:56
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
dynamic, self-adjusting array of double
provides thread-safe access to cells
list of point or cell ids
Definition: vtkIdList.h:143
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
abstract class for mapping images to the screen
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:177
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
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:99
abstract specification for renderers
Definition: vtkRenderer.h:182
handles properties associated with a texture map
Definition: vtkTexture.h:178
@ extent
Definition: vtkX3D.h:351
@ data
Definition: vtkX3D.h:321
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332