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();
73  void PrintSelf(ostream& os, vtkIndent indent);
74 
76 
80  virtual int Pick(double selectionX, double selectionY, double selectionZ,
81  vtkRenderer *renderer);
83 
92 
97 
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 
178 
180 
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:
218 
219  void Initialize();
220 
221  virtual void ResetPickInfo();
222 
223  virtual double IntersectWithLine(double p1[3], double p2[3], double tol,
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 
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 
259  const double *weights, double normal[3]);
260 
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 
vtkgl::data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
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)
vtkgl::weights
const GLbyte * weights
Definition: vtkgl.h:12766
vtkgl::m
const GLfloat * m
Definition: vtkgl.h:18169
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:43
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:284
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkCellPicker::PickTextureData
int PickTextureData
Definition: vtkCellPicker.h:299
vtkCellPicker::GetTexture
vtkTexture * GetTexture()
Definition: vtkCellPicker.h:199
vtkCellPicker::Pick
virtual int Pick(double selectionX, double selectionY, double selectionZ, vtkRenderer *renderer)
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
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:60
vtkGetVectorMacro
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:424
vtkCellPicker::New
static vtkCellPicker * New()
vtkAssemblyPath
a list of nodes that form an assembly path
Definition: vtkAssemblyPath.h:41
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:283
vtkCellPicker::VolumeOpacityIsovalue
double VolumeOpacityIsovalue
Definition: vtkCellPicker.h:282
vtkCellPicker::AddLocator
void AddLocator(vtkAbstractCellLocator *locator)
vtkCellPicker::PointId
vtkIdType PointId
Definition: vtkCellPicker.h:287
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:70
vtkCollection
create and manipulate unsorted lists of objects
Definition: vtkCollection.h:53
vtkGetVector3Macro
#define vtkGetVector3Macro(name, type)
Definition: vtkSetGet.h:304
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:90
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:62
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)
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:39
vtkRenderingCoreModule.h
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkCellPicker::RemoveAllLocators
void RemoveAllLocators()
vtkgl::path
GLsizei const GLchar ** path
Definition: vtkgl.h:13835
vtkCellPicker::Texture
vtkTexture * Texture
Definition: vtkCellPicker.h:298
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkDax::detail::cellType
CellTypeInDataSet cellType(vtkDataSet *input)
Definition: vtkDaxDetailCommon.h:36
vtkAbstractCellLocator
an abstract base class for locators which find cells
Definition: vtkAbstractCellLocator.h:50
vtkPiecewiseFunction
Defines a 1D piecewise function.
Definition: vtkPiecewiseFunction.h:51
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkCellPicker::CellId
vtkIdType CellId
Definition: vtkCellPicker.h:288
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkPicker.h
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkCellPicker::Locators
vtkCollection * Locators
Definition: vtkCellPicker.h:280
vtkImageMapper3D
abstract class for mapping images to the screen
Definition: vtkImageMapper3D.h:50
vtkAbstractMapper3D
abstract class specifies interface to map 3D data
Definition: vtkAbstractMapper3D.h:42
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)
vtkAbstractVolumeMapper
Abstract class for a volume mapper.
Definition: vtkAbstractVolumeMapper.h:38
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:42
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
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:49
vtkCellPicker::SubId
int SubId
Definition: vtkCellPicker.h:289
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
VTKRENDERINGCORE_EXPORT
#define VTKRENDERINGCORE_EXPORT
Definition: vtkRenderingCoreModule.h:15
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:36
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:69
vtkCellPicker::ClippingPlaneId
int ClippingPlaneId
Definition: vtkCellPicker.h:285
vtkCellPicker::GetNumberOfSubCells
static int GetNumberOfSubCells(vtkIdList *pointIds, int cellType)
vtkCellPicker::~vtkCellPicker
~vtkCellPicker()
vtkCellPicker::SubCellFromCell
static void SubCellFromCell(vtkGenericCell *cell, int subId)