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
00069 #ifndef __vtkPointLocator_h
00070 #define __vtkPointLocator_h
00071
00072 #include "vtkLocator.h"
00073 #include "vtkPoints.h"
00074
00075 class vtkIdList;
00076 class vtkNeighborPoints;
00077
00078 class VTK_COMMON_EXPORT vtkPointLocator : public vtkLocator
00079 {
00080 public:
00083 static vtkPointLocator *New();
00084
00085 vtkTypeMacro(vtkPointLocator,vtkLocator);
00086 void PrintSelf(ostream& os, vtkIndent indent);
00087
00089
00090 vtkSetVector3Macro(Divisions,int);
00091 vtkGetVectorMacro(Divisions,int,3);
00093
00095
00096 vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_LARGE_INTEGER);
00097 vtkGetMacro(NumberOfPointsPerBucket,int);
00099
00101
00105 virtual vtkIdType FindClosestPoint(const float x[3]);
00106 vtkIdType FindClosestPoint(float x, float y, float z);
00108
00110
00114 vtkIdType FindClosestPointWithinRadius(float radius, const float x[3],
00115 float& dist2);
00116 vtkIdType FindClosestPointWithinRadius(float radius, const float x[3],
00117 float inputDataLength, float& dist2);
00119
00124 virtual int InitPointInsertion(vtkPoints *newPts, const float bounds[6]);
00125
00127
00131 virtual int InitPointInsertion(vtkPoints *newPts, const float bounds[6],
00132 vtkIdType estSize);
00134
00142 virtual void InsertPoint(vtkIdType ptId, const float x[3]);
00143
00151 virtual vtkIdType InsertNextPoint(const float x[3]);
00152
00154
00157 vtkIdType IsInsertedPoint(float x, float y, float z)
00158 {
00159 float xyz[3];
00160 xyz[0] = x; xyz[1] = y; xyz[2] = z;
00161 return this->IsInsertedPoint (xyz);
00162 };
00163 virtual vtkIdType IsInsertedPoint(const float x[3]);
00165
00173 virtual int InsertUniquePoint(const float x[3], vtkIdType &ptId);
00174
00180 virtual vtkIdType FindClosestInsertedPoint(const float x[3]);
00181
00183
00189 virtual void FindClosestNPoints(int N, const float x[3], vtkIdList *result);
00190 virtual void FindClosestNPoints(int N, float x, float y, float z,
00191 vtkIdList *result);
00193
00195
00200 virtual void FindDistributedPoints(int N, const float x[3],
00201 vtkIdList *result, int M);
00202 virtual void FindDistributedPoints(int N, float x, float y,
00203 float z, vtkIdList *result, int M);
00205
00207
00211 virtual void FindPointsWithinRadius(float R, const float x[3],
00212 vtkIdList *result);
00213 virtual void FindPointsWithinRadius(float R, float x, float y, float z,
00214 vtkIdList *result);
00216
00221 virtual vtkIdList *GetPointsInBucket(const float x[3], int ijk[3]);
00222
00224
00226 void Initialize();
00227 void FreeSearchStructure();
00228 void BuildLocator();
00229 void GenerateRepresentation(int level, vtkPolyData *pd);
00231
00232 protected:
00233 vtkPointLocator();
00234 ~vtkPointLocator();
00235
00236
00237 void GetBucketNeighbors(vtkNeighborPoints* buckets,
00238 const int ijk[3], const int ndivs[3], int level);
00239 void GetOverlappingBuckets(vtkNeighborPoints* buckets,
00240 const float x[3], const int ijk[3], float dist,
00241 int level);
00242 void GetOverlappingBuckets(vtkNeighborPoints* buckets,
00243 const float x[3], float dist,
00244 int prevMinLevel[3],
00245 int prevMaxLevel[3]);
00246 void GenerateFace(int face, int i, int j, int k,
00247 vtkPoints *pts, vtkCellArray *polys);
00248 float Distance2ToBucket(const float x[3], const int nei[3]);
00249 float Distance2ToBounds(const float x[3], const float bounds[6]);
00250
00251 vtkPoints *Points;
00252 int Divisions[3];
00253 int NumberOfPointsPerBucket;
00254 float Bounds[6];
00255 vtkIdList **HashTable;
00256 vtkIdType NumberOfBuckets;
00257 float H[3];
00258
00259 float InsertionTol2;
00260 vtkIdType InsertionPointId;
00261
00262 float InsertionLevel;
00263 private:
00264 vtkPointLocator(const vtkPointLocator&);
00265 void operator=(const vtkPointLocator&);
00266 };
00267
00268 #endif
00269
00270