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 
192 
194 
196  void Initialize();
198  void BuildLocator();
201 
202 protected:
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 
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkPointLocator::InsertionPointId
vtkIdType InsertionPointId
Definition: vtkPointLocator.h:235
vtkPointLocator::GenerateRepresentation
void GenerateRepresentation(int level, vtkPolyData *pd)
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:132
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkIncrementalPointLocator::IsInsertedPoint
virtual vtkIdType IsInsertedPoint(double x, double y, double z)=0
vtkPointLocator::GenerateFace
void GenerateFace(int face, int i, int j, int k, vtkPoints *pts, vtkCellArray *polys)
vtkPointLocator::HashTable
vtkIdList ** HashTable
Definition: vtkPointLocator.h:230
vtkPointLocator::InsertionLevel
double InsertionLevel
Definition: vtkPointLocator.h:237
vtkPointLocator::FindClosestNPoints
virtual void FindClosestNPoints(int N, const double x[3], vtkIdList *result)
vtkSetVector3Macro
#define vtkSetVector3Macro(name, type)
Definition: vtkSetGet.h:287
vtkPointLocator::InsertNextPoint
virtual vtkIdType InsertNextPoint(const double x[3])
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkCommonDataModelModule.h
vtkPointLocator::~vtkPointLocator
virtual ~vtkPointLocator()
vtkPointLocator::GetBucketIndices
void GetBucketIndices(const double x[3], int ijk[3])
vtkPointLocator
quickly locate points in 3-space
Definition: vtkPointLocator.h:53
vtkPointLocator::FindDistributedPoints
virtual void FindDistributedPoints(int N, double x, double y, double z, vtkIdList *result, int M)
vtkPointLocator::GetOverlappingBuckets
void GetOverlappingBuckets(vtkNeighborPoints *buckets, const double x[3], const int ijk[3], double dist, int level)
vtkPointLocator::FindClosestPoint
virtual vtkIdType FindClosestPoint(const double x[3])
vtkPointLocator::Points
vtkPoints * Points
Definition: vtkPointLocator.h:227
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkPointLocator::GetPointsInBucket
virtual vtkIdList * GetPointsInBucket(const double x[3], int ijk[3])
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkPointLocator::GetBucketNeighbors
void GetBucketNeighbors(vtkNeighborPoints *buckets, const int ijk[3], const int ndivs[3], int level)
vtkGetVectorMacro
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:424
vtkPointLocator::NumberOfPointsPerBucket
int NumberOfPointsPerBucket
Definition: vtkPointLocator.h:229
vtkPointLocator::FindDistributedPoints
virtual void FindDistributedPoints(int N, const double x[3], vtkIdList *result, int M)
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkIncrementalPointLocator.h
vtkPointLocator::Initialize
void Initialize()
vtkPointLocator::IsInsertedPoint
vtkIdType IsInsertedPoint(double x, double y, double z)
Definition: vtkPointLocator.h:128
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkPointLocator::NumberOfBuckets
vtkIdType NumberOfBuckets
Definition: vtkPointLocator.h:231
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkPointLocator::FindClosestInsertedPoint
virtual vtkIdType FindClosestInsertedPoint(const double x[3])
vtkPointLocator::InitPointInsertion
virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6], vtkIdType estSize)
vtkPointLocator::FindPointsWithinRadius
virtual void FindPointsWithinRadius(double R, const double x[3], vtkIdList *result)
vtkIncrementalPointLocator
Abstract class in support of both point location and point insertion.
Definition: vtkIncrementalPointLocator.h:54
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkPointLocator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkPointLocator::FindClosestPointWithinRadius
virtual vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double &dist2)
vtkgl::level
GLint level
Definition: vtkgl.h:11316
vtkPointLocator::New
static vtkPointLocator * New()
M
#define M(row, col)
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkgl::result
GLuint64EXT * result
Definition: vtkgl.h:18868
vtkPointLocator::vtkPointLocator
vtkPointLocator()
vtkPointLocator::FreeSearchStructure
void FreeSearchStructure()
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
vtkgl::face
GLenum GLuint GLint GLenum face
Definition: vtkgl.h:13568
vtkPointLocator::BuildLocator
void BuildLocator()
VTKCOMMONDATAMODEL_EXPORT
#define VTKCOMMONDATAMODEL_EXPORT
Definition: vtkCommonDataModelModule.h:15
vtkPointLocator::InsertionTol2
double InsertionTol2
Definition: vtkPointLocator.h:234
vtkX3D::radius
@ radius
Definition: vtkX3D.h:252
vtkPointLocator::InsertUniquePoint
virtual int InsertUniquePoint(const double x[3], vtkIdType &ptId)
vtkPointLocator::Distance2ToBucket
double Distance2ToBucket(const double x[3], const int nei[3])
vtkPointLocator::InitPointInsertion
virtual int InitPointInsertion(vtkPoints *newPts, const double bounds[6])
vtkPointLocator::InsertPoint
virtual void InsertPoint(vtkIdType ptId, const double x[3])
vtkPointLocator::GetOverlappingBuckets
void GetOverlappingBuckets(vtkNeighborPoints *buckets, const double x[3], double dist, int prevMinLevel[3], int prevMaxLevel[3])
vtkPointLocator::GetBucketIndex
vtkIdType GetBucketIndex(const double x[3])
vtkPointLocator::Distance2ToBounds
double Distance2ToBounds(const double x[3], const double bounds[6])
vtkPointLocator::FindClosestPointWithinRadius
virtual vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double inputDataLength, double &dist2)
vtkPointLocator::IsInsertedPoint
virtual vtkIdType IsInsertedPoint(const double x[3])