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_COMMON_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
00199 void Initialize();
00200 void FreeSearchStructure();
00201 void BuildLocator();
00202 void GenerateRepresentation(int level, vtkPolyData *pd);
00204
00205 protected:
00206 vtkPointLocator();
00207 ~vtkPointLocator();
00208
00209
00210 void GetBucketNeighbors(vtkNeighborPoints* buckets,
00211 const int ijk[3], const int ndivs[3], int level);
00212 void GetOverlappingBuckets(vtkNeighborPoints* buckets,
00213 const double x[3], const int ijk[3], double dist,
00214 int level);
00215 void GetOverlappingBuckets(vtkNeighborPoints* buckets,
00216 const double x[3], double dist,
00217 int prevMinLevel[3],
00218 int prevMaxLevel[3]);
00219 void GenerateFace(int face, int i, int j, int k,
00220 vtkPoints *pts, vtkCellArray *polys);
00221 double Distance2ToBucket(const double x[3], const int nei[3]);
00222 double Distance2ToBounds(const double x[3], const double bounds[6]);
00223
00224 vtkPoints *Points;
00225 int Divisions[3];
00226 int NumberOfPointsPerBucket;
00227 double Bounds[6];
00228 vtkIdList **HashTable;
00229 vtkIdType NumberOfBuckets;
00230 double H[3];
00231
00232 double InsertionTol2;
00233 vtkIdType InsertionPointId;
00234
00235 double InsertionLevel;
00236 private:
00237 vtkPointLocator(const vtkPointLocator&);
00238 void operator=(const vtkPointLocator&);
00239 };
00240
00241 #endif
00242
00243