VTK
vtkPointLocator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointLocator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
41 #ifndef __vtkPointLocator_h
42 #define __vtkPointLocator_h
43 
45 
46 class vtkCellArray;
47 class vtkIdList;
48 class vtkNeighborPoints;
49 class vtkPoints;
50 
52 {
53 public:
56  static vtkPointLocator *New();
57 
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
62 
63  vtkSetVector3Macro(Divisions,int);
64  vtkGetVectorMacro(Divisions,int,3);
66 
68 
69  vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_LARGE_INTEGER);
70  vtkGetMacro(NumberOfPointsPerBucket,int);
72 
77  virtual vtkIdType FindClosestPoint(const double x[3]);
78 
80 
85  double radius, const double x[3], double& dist2);
86  virtual vtkIdType FindClosestPointWithinRadius(double radius, const double x[3],
87  double inputDataLength, double& dist2);
89 
94  virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6]);
95 
97 
101  virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6],
102  vtkIdType estSize);
104 
112  virtual void InsertPoint(vtkIdType ptId, const double x[3]);
113 
121  virtual vtkIdType InsertNextPoint(const double x[3]);
122 
124 
127  vtkIdType IsInsertedPoint(double x, double y, double z)
128  {
129  double xyz[3];
130  xyz[0] = x; xyz[1] = y; xyz[2] = z;
131  return this->IsInsertedPoint (xyz);
132  };
133  virtual vtkIdType IsInsertedPoint(const double x[3]);
135 
143  virtual int InsertUniquePoint(const double x[3], vtkIdType &ptId);
144 
150  virtual vtkIdType FindClosestInsertedPoint(const double x[3]);
151 
158  virtual void FindClosestNPoints(int N, const double x[3], vtkIdList *result);
159 
161 
166  virtual void FindDistributedPoints(int N, const double x[3],
167  vtkIdList *result, int M);
168  virtual void FindDistributedPoints(int N, double x, double y,
169  double z, vtkIdList *result, int M);
171 
173 
177  virtual void FindPointsWithinRadius(double R, const double x[3],
178  vtkIdList *result);
180 
185  virtual vtkIdList *GetPointsInBucket(const double x[3], int ijk[3]);
186 
188 
189  vtkGetObjectMacro(Points, vtkPoints);
191 
193 
195  void Initialize();
196  void FreeSearchStructure();
197  void BuildLocator();
198  void GenerateRepresentation(int level, vtkPolyData *pd);
200 
201 protected:
202  vtkPointLocator();
203  virtual ~vtkPointLocator();
204 
205  // place points in appropriate buckets
206  void GetBucketNeighbors(vtkNeighborPoints* buckets,
207  const int ijk[3], const int ndivs[3], int level);
208  void GetOverlappingBuckets(vtkNeighborPoints* buckets,
209  const double x[3], const int ijk[3], double dist,
210  int level);
211  void GetOverlappingBuckets(vtkNeighborPoints* buckets,
212  const double x[3], double dist,
213  int prevMinLevel[3],
214  int prevMaxLevel[3]);
215  void GenerateFace(int face, int i, int j, int k,
216  vtkPoints *pts, vtkCellArray *polys);
217  double Distance2ToBucket(const double x[3], const int nei[3]);
218  double Distance2ToBounds(const double x[3], const double bounds[6]);
219 
220  vtkPoints *Points; // Used for merging points
221  int Divisions[3]; // Number of sub-divisions in x-y-z directions
222  int NumberOfPointsPerBucket; //Used with previous boolean to control subdivide
223  vtkIdList **HashTable; // lists of point ids in buckets
224  vtkIdType NumberOfBuckets; // total size of hash table
225  double H[3]; // width of each bucket in x-y-z directions
226 
229 
230  double InsertionLevel;
231 private:
232  vtkPointLocator(const vtkPointLocator&); // Not implemented.
233  void operator=(const vtkPointLocator&); // Not implemented.
234 };
235 
236 #endif
237 
238 
virtual void FreeSearchStructure()=0
virtual void Initialize()=0
virtual vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double &dist2)=0
quickly locate points in 3-space
virtual int InsertUniquePoint(const double x[3], vtkIdType &ptId)=0
vtkIdType InsertionPointId
virtual vtkIdType IsInsertedPoint(double x, double y, double z)=0
#define VTK_FILTERING_EXPORT
vtkIdType IsInsertedPoint(double x, double y, double z)
vtkIdList ** HashTable
Abstract class in support of both point location and point insertion.
vtkIdType NumberOfBuckets
void PrintSelf(ostream &os, vtkIndent indent)
int vtkIdType
Definition: vtkType.h:255
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:81
virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6])=0
a simple class to control print indentation
Definition: vtkIndent.h:37
list of point or cell ids
Definition: vtkIdList.h:34
vtkPoints * Points
virtual void FindPointsWithinRadius(double R, const double x[3], vtkIdList *result)=0
virtual void FindClosestNPoints(int N, const double x[3], vtkIdList *result)=0
object to represent cell connectivity
Definition: vtkCellArray.h:48
virtual vtkIdType InsertNextPoint(const double x[3])=0
virtual vtkIdType FindClosestInsertedPoint(const double x[3])=0
virtual vtkIdType FindClosestPoint(const double x[3])=0
virtual void BuildLocator()=0
#define VTK_LARGE_INTEGER
Definition: vtkType.h:148
static vtkObject * New()
virtual void InsertPoint(vtkIdType ptId, const double x[3])=0
virtual void GenerateRepresentation(int level, vtkPolyData *pd)=0
represent and manipulate 3D points
Definition: vtkPoints.h:38