00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00051 #ifndef __vtkPointLocator_h
00052 #define __vtkPointLocator_h
00053
00054 #include "vtkLocator.h"
00055
00056 class vtkCellArray;
00057 class vtkIdList;
00058 class vtkNeighborPoints;
00059 class vtkPoints;
00060
00061 class VTK_FILTERING_EXPORT vtkPointLocator : public vtkLocator
00062 {
00063 public:
00066 static vtkPointLocator *New();
00067
00068 vtkTypeRevisionMacro(vtkPointLocator,vtkLocator);
00069 void PrintSelf(ostream& os, vtkIndent indent);
00070
00072
00073 vtkSetVector3Macro(Divisions,int);
00074 vtkGetVectorMacro(Divisions,int,3);
00076
00078
00079 vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_LARGE_INTEGER);
00080 vtkGetMacro(NumberOfPointsPerBucket,int);
00082
00084
00088 virtual vtkIdType FindClosestPoint(const double x[3]);
00089 vtkIdType FindClosestPoint(double x, double y, double z);
00091
00093
00097 vtkIdType FindClosestPointWithinRadius(double radius, const double x[3],
00098 double& dist2);
00099 vtkIdType FindClosestPointWithinRadius(double radius, const double x[3],
00100 double inputDataLength, double& dist2);
00102
00107 virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6]);
00108
00110
00114 virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6],
00115 vtkIdType estSize);
00117
00125 virtual void InsertPoint(vtkIdType ptId, const double x[3]);
00126
00134 virtual vtkIdType InsertNextPoint(const double x[3]);
00135
00137
00140 vtkIdType IsInsertedPoint(double x, double y, double z)
00141 {
00142 double xyz[3];
00143 xyz[0] = x; xyz[1] = y; xyz[2] = z;
00144 return this->IsInsertedPoint (xyz);
00145 };
00146 virtual vtkIdType IsInsertedPoint(const double x[3]);
00148
00156 virtual int InsertUniquePoint(const double x[3], vtkIdType &ptId);
00157
00163 virtual vtkIdType FindClosestInsertedPoint(const double x[3]);
00164
00166
00172 virtual void FindClosestNPoints(int N, const double x[3], vtkIdList *result);
00173 virtual void FindClosestNPoints(int N, double x, double y, double z,
00174 vtkIdList *result);
00176
00178
00183 virtual void FindDistributedPoints(int N, const double x[3],
00184 vtkIdList *result, int M);
00185 virtual void FindDistributedPoints(int N, double x, double y,
00186 double z, vtkIdList *result, int M);
00188
00190
00194 virtual void FindPointsWithinRadius(double R, const double x[3],
00195 vtkIdList *result);
00196 virtual void FindPointsWithinRadius(double R, double x, double y, double z,
00197 vtkIdList *result);
00199
00204 virtual vtkIdList *GetPointsInBucket(const double x[3], int ijk[3]);
00205
00207
00208 vtkGetObjectMacro(Points, vtkPoints);
00210
00212 double *GetBounds() { return this->Bounds; };
00213
00215
00217 void Initialize();
00218 void FreeSearchStructure();
00219 void BuildLocator();
00220 void GenerateRepresentation(int level, vtkPolyData *pd);
00222
00223 protected:
00224 vtkPointLocator();
00225 ~vtkPointLocator();
00226
00227
00228 void GetBucketNeighbors(vtkNeighborPoints* buckets,
00229 const int ijk[3], const int ndivs[3], int level);
00230 void GetOverlappingBuckets(vtkNeighborPoints* buckets,
00231 const double x[3], const int ijk[3], double dist,
00232 int level);
00233 void GetOverlappingBuckets(vtkNeighborPoints* buckets,
00234 const double x[3], double dist,
00235 int prevMinLevel[3],
00236 int prevMaxLevel[3]);
00237 void GenerateFace(int face, int i, int j, int k,
00238 vtkPoints *pts, vtkCellArray *polys);
00239 double Distance2ToBucket(const double x[3], const int nei[3]);
00240 double Distance2ToBounds(const double x[3], const double bounds[6]);
00241
00242 vtkPoints *Points;
00243 int Divisions[3];
00244 int NumberOfPointsPerBucket;
00245 double Bounds[6];
00246 vtkIdList **HashTable;
00247 vtkIdType NumberOfBuckets;
00248 double H[3];
00249
00250 double InsertionTol2;
00251 vtkIdType InsertionPointId;
00252
00253 double InsertionLevel;
00254 private:
00255 vtkPointLocator(const vtkPointLocator&);
00256 void operator=(const vtkPointLocator&);
00257 };
00258
00259 #endif
00260
00261