00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00068 #ifndef __vtkCellLocator_h
00069 #define __vtkCellLocator_h
00070
00071 #include "vtkLocator.h"
00072
00073 class vtkNeighborCells;
00074
00075 class VTK_FILTERING_EXPORT vtkCellLocator : public vtkLocator
00076 {
00077 public:
00078 vtkTypeMacro(vtkCellLocator,vtkLocator);
00079 void PrintSelf(ostream& os, vtkIndent indent);
00080
00083 static vtkCellLocator *New();
00084
00086
00087 vtkSetClampMacro(NumberOfCellsPerBucket,int,1,VTK_LARGE_INTEGER);
00088 vtkGetMacro(NumberOfCellsPerBucket,int);
00090
00092
00097 vtkSetMacro(CacheCellBounds,int);
00098 vtkGetMacro(CacheCellBounds,int);
00099 vtkBooleanMacro(CacheCellBounds,int);
00101
00103
00105 virtual int IntersectWithLine(float a0[3], float a1[3], float tol,
00106 float& t, float x[3], float pcoords[3],
00107 int &subId);
00109
00111
00113 virtual int IntersectWithLine(float a0[3], float a1[3], float tol,
00114 float& t, float x[3], float pcoords[3],
00115 int &subId, vtkIdType &cellId);
00117
00119
00122 virtual int IntersectWithLine(float a0[3], float a1[3], float tol,
00123 float& t, float x[3], float pcoords[3],
00124 int &subId, vtkIdType &cellId,
00125 vtkGenericCell *cell);
00127
00129
00132 void FindClosestPoint(float x[3], float closestPoint[3], vtkIdType &cellId,
00133 int &subId, float& dist2);
00135
00137
00146 void FindClosestPoint(float x[3], float closestPoint[3],
00147 vtkGenericCell *cell, vtkIdType &cellId, int &subId,
00148 float& dist2);
00150
00152
00158 int FindClosestPointWithinRadius(float x[3], float radius,
00159 float closestPoint[3], vtkIdType &cellId,
00160 int &subId, float& dist2);
00162
00164
00177 int FindClosestPointWithinRadius(float x[3], float radius,
00178 float closestPoint[3],
00179 vtkGenericCell *cell, vtkIdType &cellId,
00180 int &subId, float& dist2);
00182
00184
00199 int FindClosestPointWithinRadius(float x[3], float radius,
00200 float closestPoint[3],
00201 vtkGenericCell *cell, vtkIdType &cellId,
00202 int &subId, float& dist2, int &inside);
00204
00206 virtual vtkIdList *GetCells(int bucket);
00207
00210 virtual int GetNumberOfBuckets(void);
00211
00213
00214 void FreeSearchStructure();
00215 void BuildLocator();
00216 void GenerateRepresentation(int level, vtkPolyData *pd);
00218
00219 protected:
00220 vtkCellLocator();
00221 ~vtkCellLocator();
00222
00223 void GetBucketNeighbors(int ijk[3], int ndivs, int level);
00224 void GetOverlappingBuckets(float x[3], int ijk[3], float dist,
00225 int prevMinLevel[3], int prevMaxLevel[3]);
00226
00227 void ClearCellHasBeenVisited();
00228 void ClearCellHasBeenVisited(int id);
00229
00230 float Distance2ToBucket(float x[3], int nei[3]);
00231 float Distance2ToBounds(float x[3], float bounds[6]);
00232
00233 int NumberOfCellsPerBucket;
00234 int NumberOfOctants;
00235 float Bounds[6];
00236 int NumberOfParents;
00237 float H[3];
00238 int NumberOfDivisions;
00239 vtkIdList **Tree;
00240
00241 void MarkParents(void*, int, int, int, int, int);
00242 void GetChildren(int idx, int level, int children[8]);
00243 int GenerateIndex(int offset, int numDivs, int i, int j, int k,
00244 vtkIdType &idx);
00245 void GenerateFace(int face, int numDivs, int i, int j, int k,
00246 vtkPoints *pts, vtkCellArray *polys);
00247
00248 vtkNeighborCells *Buckets;
00249 unsigned char *CellHasBeenVisited;
00250 unsigned char QueryNumber;
00251 int CacheCellBounds;
00252
00253 float (*CellBounds)[6];
00254
00255 private:
00256 vtkCellLocator(const vtkCellLocator&);
00257 void operator=(const vtkCellLocator&);
00258 };
00259
00260 #endif
00261
00262