VTK
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 =========================================================================*/
47 #ifndef vtkCellPicker_h
48 #define vtkCellPicker_h
49 
50 #include "vtkRenderingCoreModule.h" // For export macro
51 #include "vtkPicker.h"
52 
53 class vtkMapper;
54 class vtkTexture;
56 class vtkImageMapper3D;
57 class vtkPlaneCollection;
59 class vtkDataArray;
60 class vtkDoubleArray;
61 class vtkIdList;
62 class vtkCell;
63 class vtkGenericCell;
64 class vtkImageData;
66 class vtkCollection;
67 class vtkMatrix4x4;
68 
69 class VTKRENDERINGCORE_EXPORT vtkCellPicker : public vtkPicker
70 {
71 public:
72  static vtkCellPicker *New();
73  vtkTypeMacro(vtkCellPicker, vtkPicker);
74  void PrintSelf(ostream& os, vtkIndent indent);
75 
82  virtual int Pick(double selectionX, double selectionY, double selectionZ,
83  vtkRenderer *renderer);
84 
95 
102 
107 
109 
117  vtkSetMacro(VolumeOpacityIsovalue, double);
118  vtkGetMacro(VolumeOpacityIsovalue, double);
120 
122 
128  vtkSetMacro(UseVolumeGradientOpacity, int);
129  vtkBooleanMacro(UseVolumeGradientOpacity, int);
130  vtkGetMacro(UseVolumeGradientOpacity, int);
132 
134 
146  vtkSetMacro(PickClippingPlanes, int);
147  vtkBooleanMacro(PickClippingPlanes, int);
148  vtkGetMacro(PickClippingPlanes, int);
150 
152 
160  vtkGetMacro(ClippingPlaneId, int);
162 
164 
169  vtkGetVectorMacro(PickNormal, double, 3);
171 
173 
177  vtkGetVector3Macro(MapperNormal, double);
179 
181 
185  vtkGetVector3Macro(PointIJK, int);
187 
189 
194  vtkGetVector3Macro(CellIJK, int);
196 
198 
202  vtkGetMacro(PointId, vtkIdType);
204 
206 
209  vtkGetMacro(CellId, vtkIdType);
211 
213 
217  vtkGetMacro(SubId, int);
219 
221 
226  vtkGetVector3Macro(PCoords, double);
228 
233  vtkTexture *GetTexture() { return this->Texture; };
234 
236 
246  vtkSetMacro(PickTextureData, int);
247  vtkBooleanMacro(PickTextureData, int);
248  vtkGetMacro(PickTextureData, int);
250 
251 protected:
254 
255  void Initialize();
256 
257  virtual void ResetPickInfo();
258 
259  virtual double IntersectWithLine(double p1[3], double p2[3], double tol,
260  vtkAssemblyPath *path, vtkProp3D *p,
262 
263  virtual double IntersectActorWithLine(const double p1[3], const double p2[3],
264  double t1, double t2, double tol,
265  vtkProp3D *prop, vtkMapper *mapper);
266 
267  virtual double IntersectVolumeWithLine(const double p1[3],
268  const double p2[3],
269  double t1, double t2,
270  vtkProp3D *prop,
271  vtkAbstractVolumeMapper *mapper);
272 
273  virtual double IntersectImageWithLine(const double p1[3],
274  const double p2[3],
275  double t1, double t2,
276  vtkProp3D *prop,
277  vtkImageMapper3D *mapper);
278 
279  virtual double IntersectProp3DWithLine(const double p1[3],
280  const double p2[3],
281  double t1, double t2, double tol,
282  vtkProp3D *prop,
283  vtkAbstractMapper3D *mapper);
284 
286  vtkMatrix4x4 *propMatrix,
287  const double p1[3], const double p2[3],
288  double &t1, double &t2, int& planeId);
289 
290  static int ClipLineWithExtent(const int extent[6],
291  const double x1[3], const double x2[3],
292  double &t1, double &t2, int &planeId);
293 
295  const double *weights, double normal[3]);
296 
298  const double *weights, double tcoord[3]);
299 
300  static int HasSubCells(int cellType);
301 
302  static int GetNumberOfSubCells(vtkIdList *pointIds, int cellType);
303 
304  static void GetSubCell(vtkDataSet *data, vtkIdList *pointIds, int subId,
305  int cellType, vtkGenericCell *cell);
306 
307  static void SubCellFromCell(vtkGenericCell *cell, int subId);
308 
309  void SetImageDataPickInfo(const double x[3], const int extent[6]);
310 
311  double ComputeVolumeOpacity(const int xi[3], const double pcoords[3],
312  vtkImageData *data, vtkDataArray *scalars,
313  vtkPiecewiseFunction *scalarOpacity,
314  vtkPiecewiseFunction *gradientOpacity);
315 
317 
322 
325  int SubId;
326  double PCoords[3];
327 
328  int PointIJK[3];
329  int CellIJK[3];
330 
331  double PickNormal[3];
332  double MapperNormal[3];
333 
336 
337 private:
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 private:
345  vtkCellPicker(const vtkCellPicker&) VTK_DELETE_FUNCTION;
346  void operator=(const vtkCellPicker&) VTK_DELETE_FUNCTION;
347 };
348 
349 #endif
350 
351 
vtkCellPicker::ClipLineWithPlanes
static int ClipLineWithPlanes(vtkAbstractMapper3D *mapper, vtkMatrix4x4 *propMatrix, const double p1[3], const double p2[3], double &t1, double &t2, int &planeId)
vtkCellPicker::IntersectWithLine
virtual double IntersectWithLine(double p1[3], double p2[3], double tol, vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m)
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:47
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkCellPicker::HasSubCells
static int HasSubCells(int cellType)
vtkCellPicker::ComputeSurfaceNormal
static int ComputeSurfaceNormal(vtkDataSet *data, vtkCell *cell, const double *weights, double normal[3])
vtkCellPicker::PickClippingPlanes
int PickClippingPlanes
Definition: vtkCellPicker.h:320
vtkCellPicker::PickTextureData
int PickTextureData
Definition: vtkCellPicker.h:335
vtkCellPicker::GetTexture
vtkTexture * GetTexture()
Get the texture that was picked.
Definition: vtkCellPicker.h:233
vtkCellPicker::Pick
virtual int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer)
Perform pick operation with selection point provided.
vtkCellPicker::ClipLineWithExtent
static int ClipLineWithExtent(const int extent[6], const double x1[3], const double x2[3], double &t1, double &t2, int &planeId)
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkPicker
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:58
vtkCellPicker::New
static vtkCellPicker * New()
vtkAssemblyPath
a list of nodes that form an assembly path
Definition: vtkAssemblyPath.h:42
vtkCellPicker::IntersectVolumeWithLine
virtual double IntersectVolumeWithLine(const double p1[3], const double p2[3], double t1, double t2, vtkProp3D *prop, vtkAbstractVolumeMapper *mapper)
vtkCellPicker::ComputeSurfaceTCoord
static int ComputeSurfaceTCoord(vtkDataSet *data, vtkCell *cell, const double *weights, double tcoord[3])
vtkCellPicker::UseVolumeGradientOpacity
int UseVolumeGradientOpacity
Definition: vtkCellPicker.h:319
vtkCellPicker::VolumeOpacityIsovalue
double VolumeOpacityIsovalue
Definition: vtkCellPicker.h:318
vtkCellPicker::AddLocator
void AddLocator(vtkAbstractCellLocator *locator)
Add a locator for one of the data sets that will be included in the scene.
vtkCellPicker::PointId
vtkIdType PointId
Definition: vtkCellPicker.h:323
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:71
vtkCollection
create and manipulate unsorted lists of objects
Definition: vtkCollection.h:52
vtkCellPicker::ResetPickInfo
virtual void ResetPickInfo()
vtkCellPicker::vtkCellPicker
vtkCellPicker()
vtkCellPicker::IntersectImageWithLine
virtual double IntersectImageWithLine(const double p1[3], const double p2[3], double t1, double t2, vtkProp3D *prop, vtkImageMapper3D *mapper)
vtkMapper
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:92
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:60
vtkCellPicker::IntersectProp3DWithLine
virtual double IntersectProp3DWithLine(const double p1[3], const double p2[3], double t1, double t2, double tol, vtkProp3D *prop, vtkAbstractMapper3D *mapper)
vtkCellPicker::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:37
vtkCellPicker::RemoveAllLocators
void RemoveAllLocators()
Remove all locators associated with this picker.
vtkCellPicker::Texture
vtkTexture * Texture
Definition: vtkCellPicker.h:334
vtkDax::detail::cellType
CellTypeInDataSet cellType(vtkDataSet *input)
Definition: vtkDaxDetailCommon.h:36
vtkAbstractCellLocator
an abstract base class for locators which find cells
Definition: vtkAbstractCellLocator.h:49
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:52
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
vtkCellPicker::CellId
vtkIdType CellId
Definition: vtkCellPicker.h:324
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkPicker.h
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkCellPicker::Locators
vtkCollection * Locators
Definition: vtkCellPicker.h:316
vtkImageMapper3D
abstract class for mapping images to the screen
Definition: vtkImageMapper3D.h:51
vtkAbstractMapper3D
abstract class specifies interface to map 3D data
Definition: vtkAbstractMapper3D.h:46
vtkCellPicker::IntersectActorWithLine
virtual double IntersectActorWithLine(const double p1[3], const double p2[3], double t1, double t2, double tol, vtkProp3D *prop, vtkMapper *mapper)
vtkCellPicker::RemoveLocator
void RemoveLocator(vtkAbstractCellLocator *locator)
Remove a locator that was previously added.
vtkAbstractVolumeMapper
Abstract class for a volume mapper.
Definition: vtkAbstractVolumeMapper.h:39
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkCellPicker::GetSubCell
static void GetSubCell(vtkDataSet *data, vtkIdList *pointIds, int subId, int cellType, vtkGenericCell *cell)
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:40
vtkCellPicker::ComputeVolumeOpacity
double ComputeVolumeOpacity(const int xi[3], const double pcoords[3], vtkImageData *data, vtkDataArray *scalars, vtkPiecewiseFunction *scalarOpacity, vtkPiecewiseFunction *gradientOpacity)
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:42
vtkCellPicker::SubId
int SubId
Definition: vtkCellPicker.h:325
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:37
vtkCellPicker::Initialize
void Initialize()
vtkCellPicker::SetImageDataPickInfo
void SetImageDataPickInfo(const double x[3], const int extent[6])
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
vtkCellPicker::ClippingPlaneId
int ClippingPlaneId
Definition: vtkCellPicker.h:321
vtkCellPicker::GetNumberOfSubCells
static int GetNumberOfSubCells(vtkIdList *pointIds, int cellType)
vtkCellPicker::~vtkCellPicker
~vtkCellPicker()
vtkCellPicker::SubCellFromCell
static void SubCellFromCell(vtkGenericCell *cell, int subId)