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 
94  void AddLocator(vtkAbstractCellLocator *locator);
95 
101  void RemoveLocator(vtkAbstractCellLocator *locator);
102 
106  void RemoveAllLocators();
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:
252  vtkCellPicker();
253  ~vtkCellPicker();
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 
285  static int ClipLineWithPlanes(vtkAbstractMapper3D *mapper,
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 
294  static int ComputeSurfaceNormal(vtkDataSet *data, vtkCell *cell,
295  const double *weights, double normal[3]);
296 
297  static int ComputeSurfaceTCoord(vtkDataSet *data, vtkCell *cell,
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 
int UseVolumeGradientOpacity
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
Defines a 1D piecewise function.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
maintain a list of planes
an abstract base class for locators which find cells
Abstract class for a volume mapper.
abstract specification for renderers
Definition: vtkRenderer.h:63
double VolumeOpacityIsovalue
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:46
int vtkIdType
Definition: vtkType.h:287
provides thread-safe access to cells
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:57
vtkTexture * GetTexture()
Get the texture that was picked.
dynamic, self-adjusting array of double
vtkIdType CellId
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkTexture * Texture
a list of nodes that form an assembly path
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract class for mapping images to the screen
vtkIdType PointId
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
list of point or cell ids
Definition: vtkIdList.h:36
static vtkPicker * New()
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual void Initialize()
handles properties associated with a texture map
Definition: vtkTexture.h:70
virtual int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer)
Perform pick operation with selection point provided.
abstract class specifies interface to map 3D data
virtual double IntersectWithLine(double p1[3], double p2[3], double tol, vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m)
vtkCollection * Locators
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:91
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
CellTypeInDataSet cellType(vtkDataSet *input)
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
create and manipulate unsorted lists of objects
Definition: vtkCollection.h:51
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.