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 __vtkPointLocator_h
00069 #define __vtkPointLocator_h
00070
00071 #include "vtkLocator.h"
00072 #include "vtkPoints.h"
00073
00074 class vtkIdList;
00075 class vtkNeighborPoints;
00076
00077 class VTK_EXPORT vtkPointLocator : public vtkLocator
00078 {
00079 public:
00082 static vtkPointLocator *New();
00083
00084 vtkTypeMacro(vtkPointLocator,vtkLocator);
00085 void PrintSelf(ostream& os, vtkIndent indent);
00086
00088 vtkSetVector3Macro(Divisions,int);
00089 vtkGetVectorMacro(Divisions,int,3);
00090
00092 vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_LARGE_INTEGER);
00093 vtkGetMacro(NumberOfPointsPerBucket,int);
00094
00099 virtual int FindClosestPoint(const float x[3]);
00100 int FindClosestPoint(float x, float y, float z);
00101
00106 int FindClosestPointWithinRadius(float radius, const float x[3],
00107 float& dist2);
00108 int FindClosestPointWithinRadius(float radius, const float x[3],
00109 float inputDataLength, float& dist2);
00110
00115 virtual int InitPointInsertion(vtkPoints *newPts, const float bounds[6]);
00116
00121 virtual int InitPointInsertion(vtkPoints *newPts, const float bounds[6],
00122 int estSize);
00123
00131 virtual void InsertPoint(int ptId, const float x[3]);
00132
00140 virtual int InsertNextPoint(const float x[3]);
00141
00145 int IsInsertedPoint(float x, float y, float z)
00146 {
00147 float xyz[3];
00148 xyz[0] = x; xyz[1] = y; xyz[2] = z;
00149 return this->IsInsertedPoint (xyz);
00150 };
00151 virtual int IsInsertedPoint(const float x[3]);
00152
00160 virtual int InsertUniquePoint(const float x[3], int &ptId);
00161
00167 virtual int FindClosestInsertedPoint(const float x[3]);
00168
00175 virtual void FindClosestNPoints(int N, const float x[3], vtkIdList *result);
00176 virtual void FindClosestNPoints(int N, float x, float y, float z,
00177 vtkIdList *result);
00178
00184 virtual void FindDistributedPoints(int N, const float x[3],
00185 vtkIdList *result, int M);
00186 virtual void FindDistributedPoints(int N, float x, float y,
00187 float z, vtkIdList *result, int M);
00188
00193 virtual void FindPointsWithinRadius(float R, const float x[3],
00194 vtkIdList *result);
00195 virtual void FindPointsWithinRadius(float R, float x, float y, float z,
00196 vtkIdList *result);
00197
00202 virtual vtkIdList *GetPointsInBucket(const float x[3], int ijk[3]);
00203
00206 void Initialize();
00207 void FreeSearchStructure();
00208 void BuildLocator();
00209 void GenerateRepresentation(int level, vtkPolyData *pd);
00210
00211 protected:
00212 vtkPointLocator();
00213 ~vtkPointLocator();
00214 vtkPointLocator(const vtkPointLocator&) {};
00215 void operator=(const vtkPointLocator&) {};
00216
00217
00218 void GetBucketNeighbors(vtkNeighborPoints* buckets,
00219 const int ijk[3], const int ndivs[3], int level);
00220 void GetOverlappingBuckets(vtkNeighborPoints* buckets,
00221 const float x[3], const int ijk[3], float dist,
00222 int level);
00223 void GetOverlappingBuckets(vtkNeighborPoints* buckets,
00224 const float x[3], float dist,
00225 int prevMinLevel[3],
00226 int prevMaxLevel[3]);
00227 void GenerateFace(int face, int i, int j, int k,
00228 vtkPoints *pts, vtkCellArray *polys);
00229 float Distance2ToBucket(const float x[3], const int nei[3]);
00230 float Distance2ToBounds(const float x[3], const float bounds[6]);
00231
00232 vtkPoints *Points;
00233 int Divisions[3];
00234 int NumberOfPointsPerBucket;
00235 float Bounds[6];
00236 vtkIdList **HashTable;
00237 int NumberOfBuckets;
00238 float H[3];
00239
00240 float InsertionTol2;
00241 int InsertionPointId;
00242
00243 float InsertionLevel;
00244 };
00245
00246 #endif
00247
00248