00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00041 #ifndef __vtkPointLocator_h
00042 #define __vtkPointLocator_h
00043
00044 #include "vtkLocator.h"
00045
00046 class vtkCellArray;
00047 class vtkIdList;
00048 class vtkNeighborPoints;
00049 class vtkPoints;
00050
00051 class VTK_FILTERING_EXPORT vtkPointLocator : public vtkLocator
00052 {
00053 public:
00056 static vtkPointLocator *New();
00057
00058 vtkTypeRevisionMacro(vtkPointLocator,vtkLocator);
00059 void PrintSelf(ostream& os, vtkIndent indent);
00060
00062
00063 vtkSetVector3Macro(Divisions,int);
00064 vtkGetVectorMacro(Divisions,int,3);
00066
00068
00069 vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_LARGE_INTEGER);
00070 vtkGetMacro(NumberOfPointsPerBucket,int);
00072
00074
00078 virtual vtkIdType FindClosestPoint(const double x[3]);
00079 vtkIdType FindClosestPoint(double x, double y, double z);
00081
00083
00087 vtkIdType FindClosestPointWithinRadius(double radius, const double x[3],
00088 double& dist2);
00089 vtkIdType FindClosestPointWithinRadius(double radius, const double x[3],
00090 double inputDataLength, double& dist2);
00092
00097 virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6]);
00098
00100
00104 virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6],
00105 vtkIdType estSize);
00107
00115 virtual void InsertPoint(vtkIdType ptId, const double x[3]);
00116
00124 virtual vtkIdType InsertNextPoint(const double x[3]);
00125
00127
00130 vtkIdType IsInsertedPoint(double x, double y, double z)
00131 {
00132 double xyz[3];
00133 xyz[0] = x; xyz[1] = y; xyz[2] = z;
00134 return this->IsInsertedPoint (xyz);
00135 };
00136 virtual vtkIdType IsInsertedPoint(const double x[3]);
00138
00146 virtual int InsertUniquePoint(const double x[3], vtkIdType &ptId);
00147
00153 virtual vtkIdType FindClosestInsertedPoint(const double x[3]);
00154
00156
00162 virtual void FindClosestNPoints(int N, const double x[3], vtkIdList *result);
00163 virtual void FindClosestNPoints(int N, double x, double y, double z,
00164 vtkIdList *result);
00166
00168
00173 virtual void FindDistributedPoints(int N, const double x[3],
00174 vtkIdList *result, int M);
00175 virtual void FindDistributedPoints(int N, double x, double y,
00176 double z, vtkIdList *result, int M);
00178
00180
00184 virtual void FindPointsWithinRadius(double R, const double x[3],
00185 vtkIdList *result);
00186 virtual void FindPointsWithinRadius(double R, double x, double y, double z,
00187 vtkIdList *result);
00189
00194 virtual vtkIdList *GetPointsInBucket(const double x[3], int ijk[3]);
00195
00197
00198 vtkGetObjectMacro(Points, vtkPoints);
00200
00202 double *GetBounds() { return this->Bounds; };
00203
00205
00207 void Initialize();
00208 void FreeSearchStructure();
00209 void BuildLocator();
00210 void GenerateRepresentation(int level, vtkPolyData *pd);
00212
00213 protected:
00214 vtkPointLocator();
00215 ~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 double x[3], const int ijk[3], double dist,
00222 int level);
00223 void GetOverlappingBuckets(vtkNeighborPoints* buckets,
00224 const double x[3], double 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 double Distance2ToBucket(const double x[3], const int nei[3]);
00230 double Distance2ToBounds(const double x[3], const double bounds[6]);
00231
00232 vtkPoints *Points;
00233 int Divisions[3];
00234 int NumberOfPointsPerBucket;
00235 double Bounds[6];
00236 vtkIdList **HashTable;
00237 vtkIdType NumberOfBuckets;
00238 double H[3];
00239
00240 double InsertionTol2;
00241 vtkIdType InsertionPointId;
00242
00243 double InsertionLevel;
00244 private:
00245 vtkPointLocator(const vtkPointLocator&);
00246 void operator=(const vtkPointLocator&);
00247 };
00248
00249 #endif
00250
00251