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 
44 #include "vtkCommonDataModelModule.h" // For export macro
46 
47 class vtkCellArray;
48 class vtkIdList;
49 class vtkNeighborPoints;
50 class vtkPoints;
51 
53 {
54 public:
57  static vtkPointLocator *New();
58 
60  void PrintSelf(ostream& os, vtkIndent indent);
61 
63 
64  vtkSetVector3Macro(Divisions,int);
65  vtkGetVectorMacro(Divisions,int,3);
67 
69 
70  vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_INT_MAX);
71  vtkGetMacro(NumberOfPointsPerBucket,int);
73 
78  virtual vtkIdType FindClosestPoint(const double x[3]);
79 
81 
86  double radius, const double x[3], double& dist2);
87  virtual vtkIdType FindClosestPointWithinRadius(double radius, const double x[3],
88  double inputDataLength, double& dist2);
90 
95  virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6]);
96 
98 
102  virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6],
103  vtkIdType estSize);
105 
113  virtual void InsertPoint(vtkIdType ptId, const double x[3]);
114 
122  virtual vtkIdType InsertNextPoint(const double x[3]);
123 
125 
128  vtkIdType IsInsertedPoint(double x, double y, double z)
129  {
130  double xyz[3];
131  xyz[0] = x; xyz[1] = y; xyz[2] = z;
132  return this->IsInsertedPoint (xyz);
133  };
134  virtual vtkIdType IsInsertedPoint(const double x[3]);
136 
144  virtual int InsertUniquePoint(const double x[3], vtkIdType &ptId);
145 
151  virtual vtkIdType FindClosestInsertedPoint(const double x[3]);
152 
159  virtual void FindClosestNPoints(int N, const double x[3], vtkIdList *result);
160 
162 
167  virtual void FindDistributedPoints(int N, const double x[3],
168  vtkIdList *result, int M);
169  virtual void FindDistributedPoints(int N, double x, double y,
170  double z, vtkIdList *result, int M);
172 
174 
178  virtual void FindPointsWithinRadius(double R, const double x[3],
179  vtkIdList *result);
181 
186  virtual vtkIdList *GetPointsInBucket(const double x[3], int ijk[3]);
187 
189 
190  vtkGetObjectMacro(Points, vtkPoints);
192 
194 
196  void Initialize();
197  void FreeSearchStructure();
198  void BuildLocator();
201 
202 protected:
203  vtkPointLocator();
204  virtual ~vtkPointLocator();
205 
206  // place points in appropriate buckets
207  void GetBucketNeighbors(vtkNeighborPoints* buckets,
208  const int ijk[3], const int ndivs[3], int level);
209  void GetOverlappingBuckets(vtkNeighborPoints* buckets,
210  const double x[3], const int ijk[3], double dist,
211  int level);
212  void GetOverlappingBuckets(vtkNeighborPoints* buckets,
213  const double x[3], double dist,
214  int prevMinLevel[3],
215  int prevMaxLevel[3]);
216  void GenerateFace(int face, int i, int j, int k,
217  vtkPoints *pts, vtkCellArray *polys);
218  double Distance2ToBucket(const double x[3], const int nei[3]);
219  double Distance2ToBounds(const double x[3], const double bounds[6]);
220 
222 
223  vtkIdType GetBucketIndex(const double x[3]);
224  void GetBucketIndices(const double x[3], int ijk[3]);
226 
227  vtkPoints *Points; // Used for merging points
228  int Divisions[3]; // Number of sub-divisions in x-y-z directions
229  int NumberOfPointsPerBucket; //Used with previous boolean to control subdivide
230  vtkIdList **HashTable; // lists of point ids in buckets
231  vtkIdType NumberOfBuckets; // total size of hash table
232  double H[3]; // width of each bucket in x-y-z directions
233 
236 
238 private:
239  vtkPointLocator(const vtkPointLocator&); // Not implemented.
240  void operator=(const vtkPointLocator&); // Not implemented.
241 };
242 
243 #endif
244 
245 
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_INT_MAX
Definition: vtkType.h:132
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:275
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6])=0
a simple class to control print indentation
Definition: vtkIndent.h:38
list of point or cell ids
Definition: vtkIdList.h:35
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:49
virtual vtkIdType InsertNextPoint(const double x[3])=0
#define M(row, col)
virtual vtkIdType FindClosestInsertedPoint(const double x[3])=0
virtual vtkIdType FindClosestPoint(const double x[3])=0
virtual void BuildLocator()=0
static vtkObject * New()
virtual void InsertPoint(vtkIdType ptId, const double x[3])=0
virtual void GenerateRepresentation(int level, vtkPolyData *pd)=0
#define VTKCOMMONDATAMODEL_EXPORT
represent and manipulate 3D points
Definition: vtkPoints.h:38