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 =========================================================================*/
46 #ifndef vtkCellPicker_h
47 #define vtkCellPicker_h
48 
49 #include "vtkRenderingCoreModule.h" // For export macro
50 #include "vtkPicker.h"
51 
52 class vtkMapper;
53 class vtkTexture;
55 class vtkImageMapper3D;
56 class vtkPlaneCollection;
58 class vtkDataArray;
59 class vtkDoubleArray;
60 class vtkIdList;
61 class vtkCell;
62 class vtkGenericCell;
63 class vtkImageData;
65 class vtkCollection;
66 class vtkMatrix4x4;
67 
69 {
70 public:
71  static vtkCellPicker *New();
72  vtkTypeMacro(vtkCellPicker, vtkPicker);
73  void PrintSelf(ostream& os, vtkIndent indent);
74 
76 
80  virtual int Pick(double selectionX, double selectionY, double selectionZ,
81  vtkRenderer *renderer);
83 
91  void AddLocator(vtkAbstractCellLocator *locator);
92 
96  void RemoveLocator(vtkAbstractCellLocator *locator);
97 
99  void RemoveAllLocators();
100 
102 
108  vtkSetMacro(VolumeOpacityIsovalue, double);
109  vtkGetMacro(VolumeOpacityIsovalue, double);
111 
113 
117  vtkSetMacro(UseVolumeGradientOpacity, int);
118  vtkBooleanMacro(UseVolumeGradientOpacity, int);
119  vtkGetMacro(UseVolumeGradientOpacity, int);
121 
123 
132  vtkSetMacro(PickClippingPlanes, int);
133  vtkBooleanMacro(PickClippingPlanes, int);
134  vtkGetMacro(PickClippingPlanes, int);
136 
138 
144  vtkGetMacro(ClippingPlaneId, int);
146 
148 
151  vtkGetVectorMacro(PickNormal, double, 3);
153 
155 
157  vtkGetVector3Macro(MapperNormal, double);
159 
161 
163  vtkGetVector3Macro(PointIJK, int);
165 
167 
170  vtkGetVector3Macro(CellIJK, int);
172 
174 
176  vtkGetMacro(PointId, vtkIdType);
178 
180 
181  vtkGetMacro(CellId, vtkIdType);
183 
185 
187  vtkGetMacro(SubId, int);
189 
191 
194  vtkGetVector3Macro(PCoords, double);
196 
199  vtkTexture *GetTexture() { return this->Texture; };
200 
202 
210  vtkSetMacro(PickTextureData, int);
211  vtkBooleanMacro(PickTextureData, int);
212  vtkGetMacro(PickTextureData, int);
214 
215 protected:
216  vtkCellPicker();
217  ~vtkCellPicker();
218 
219  void Initialize();
220 
221  virtual void ResetPickInfo();
222 
223  virtual double IntersectWithLine(double p1[3], double p2[3], double tol,
224  vtkAssemblyPath *path, vtkProp3D *p,
226 
227  virtual double IntersectActorWithLine(const double p1[3], const double p2[3],
228  double t1, double t2, double tol,
229  vtkProp3D *prop, vtkMapper *mapper);
230 
231  virtual double IntersectVolumeWithLine(const double p1[3],
232  const double p2[3],
233  double t1, double t2,
234  vtkProp3D *prop,
235  vtkAbstractVolumeMapper *mapper);
236 
237  virtual double IntersectImageWithLine(const double p1[3],
238  const double p2[3],
239  double t1, double t2,
240  vtkProp3D *prop,
241  vtkImageMapper3D *mapper);
242 
243  virtual double IntersectProp3DWithLine(const double p1[3],
244  const double p2[3],
245  double t1, double t2, double tol,
246  vtkProp3D *prop,
247  vtkAbstractMapper3D *mapper);
248 
249  static int ClipLineWithPlanes(vtkAbstractMapper3D *mapper,
250  vtkMatrix4x4 *propMatrix,
251  const double p1[3], const double p2[3],
252  double &t1, double &t2, int& planeId);
253 
254  static int ClipLineWithExtent(const int extent[6],
255  const double x1[3], const double x2[3],
256  double &t1, double &t2, int &planeId);
257 
258  static int ComputeSurfaceNormal(vtkDataSet *data, vtkCell *cell,
259  const double *weights, double normal[3]);
260 
261  static int ComputeSurfaceTCoord(vtkDataSet *data, vtkCell *cell,
262  const double *weights, double tcoord[3]);
263 
264  static int HasSubCells(int cellType);
265 
266  static int GetNumberOfSubCells(vtkIdList *pointIds, int cellType);
267 
268  static void GetSubCell(vtkDataSet *data, vtkIdList *pointIds, int subId,
269  int cellType, vtkGenericCell *cell);
270 
271  static void SubCellFromCell(vtkGenericCell *cell, int subId);
272 
273  void SetImageDataPickInfo(const double x[3], const int extent[6]);
274 
275  double ComputeVolumeOpacity(const int xi[3], const double pcoords[3],
276  vtkImageData *data, vtkDataArray *scalars,
277  vtkPiecewiseFunction *scalarOpacity,
278  vtkPiecewiseFunction *gradientOpacity);
279 
281 
286 
289  int SubId;
290  double PCoords[3];
291 
292  int PointIJK[3];
293  int CellIJK[3];
294 
295  double PickNormal[3];
296  double MapperNormal[3];
297 
300 
301 private:
302  void ResetCellPickerInfo();
303 
304  vtkGenericCell *Cell; //used to accelerate picking
305  vtkIdList *PointIds; // used to accelerate picking
306  vtkDoubleArray *Gradients; //used in volume picking
307 
308 private:
309  vtkCellPicker(const vtkCellPicker&); // Not implemented.
310  void operator=(const vtkCellPicker&); // Not implemented.
311 };
312 
313 #endif
314 
315 
int UseVolumeGradientOpacity
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
Defines a 1D piecewise function.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
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:62
double VolumeOpacityIsovalue
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:42
int vtkIdType
Definition: vtkType.h:247
provides thread-safe access to cells
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:59
vtkTexture * GetTexture()
dynamic, self-adjusting array of double
vtkIdType CellId
abstract class to specify cell behavior
Definition: vtkCell.h:58
vtkTexture * Texture
a list of nodes that form an assembly path
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract class for mapping images to the screen
vtkIdType PointId
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
list of point or cell ids
Definition: vtkIdList.h:35
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:69
virtual int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer)
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:89
CellTypeInDataSet cellType(vtkDataSet *input)
void PrintSelf(ostream &os, vtkIndent indent)
create and manipulate unsorted lists of objects
Definition: vtkCollection.h:52
#define VTKRENDERINGCORE_EXPORT
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:68