VTK
vtkStaticPointLocator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStaticPointLocator.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 =========================================================================*/
50 #ifndef vtkStaticPointLocator_h
51 #define vtkStaticPointLocator_h
52 
53 #include "vtkCommonDataModelModule.h" // For export macro
55 
56 class vtkIdList;
57 struct vtkBucketList;
58 
59 
60 class VTKCOMMONDATAMODEL_EXPORT vtkStaticPointLocator : public vtkAbstractPointLocator
61 {
62 public:
67  static vtkStaticPointLocator *New();
68 
70 
74  void PrintSelf(ostream& os, vtkIndent indent) override;
76 
78 
83  vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_INT_MAX);
84  vtkGetMacro(NumberOfPointsPerBucket,int);
86 
88 
94  vtkSetVector3Macro(Divisions,int);
95  vtkGetVectorMacro(Divisions,int,3);
97 
98  // Re-use any superclass signatures that we don't override.
103 
110  vtkIdType FindClosestPoint(const double x[3]) override;
111 
113 
122  double radius, const double x[3], double& dist2) override;
123  virtual vtkIdType FindClosestPointWithinRadius(double radius, const double x[3],
124  double inputDataLength,
125  double& dist2);
127 
136  void FindClosestNPoints(int N, const double x[3], vtkIdList *result) override;
137 
144  void FindPointsWithinRadius(double R, const double x[3],
145  vtkIdList *result) override;
146 
156  int IntersectWithLine(double a0[3], double a1[3], double tol, double& t,
157  double lineX[3], double ptX[3], vtkIdType &ptId);
158 
166  void MergePoints(double tol, vtkIdType *mergeMap);
167 
169 
173  void Initialize() override;
174  void FreeSearchStructure() override;
175  void BuildLocator() override;
177 
183  void GenerateRepresentation(int level, vtkPolyData *pd) override;
184 
189  vtkIdType GetNumberOfPointsInBucket(vtkIdType bNum);
190 
196  void GetBucketIds(vtkIdType bNum, vtkIdList *bList);
197 
199 
213  vtkSetClampMacro(MaxNumberOfBuckets,vtkIdType,1000,VTK_ID_MAX);
214  vtkGetMacro(MaxNumberOfBuckets,vtkIdType);
216 
224  bool GetLargeIds() {return this->LargeIds;}
225 
227 
231  virtual double *GetSpacing() { return this->H; }
232  virtual void GetSpacing(double spacing[3])
233  { spacing[0] = this->H[0]; spacing[1] = this->H[1]; spacing[2] = this->H[2]; }
235 
236 protected:
238  ~vtkStaticPointLocator() override;
239 
240  int NumberOfPointsPerBucket; // Used with AutomaticOn to control subdivide
241  int Divisions[3]; // Number of sub-divisions in x-y-z directions
242  double H[3]; // Width of each bucket in x-y-z directions
243  vtkBucketList *Buckets; // Lists of point ids in each bucket
244  vtkIdType MaxNumberOfBuckets; // Maximum number of buckets in locator
245  bool LargeIds; //indicate whether integer ids are small or large
246 
247 private:
249  void operator=(const vtkStaticPointLocator&) = delete;
250 
251 };
252 
253 #endif
vtkStaticPointLocator::GetSpacing
virtual void GetSpacing(double spacing[3])
Definition: vtkStaticPointLocator.h:232
vtkStaticPointLocator::GetSpacing
virtual double * GetSpacing()
Provide an accessor to the bucket spacing.
Definition: vtkStaticPointLocator.h:231
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:159
vtkStaticPointLocator::Buckets
vtkBucketList * Buckets
Definition: vtkStaticPointLocator.h:243
vtkStaticPointLocator::NumberOfPointsPerBucket
int NumberOfPointsPerBucket
Definition: vtkStaticPointLocator.h:240
vtkAbstractPointLocator.h
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkAbstractPointLocator::GetBounds
virtual double * GetBounds()
Provide an accessor to the bounds.
Definition: vtkAbstractPointLocator.h:100
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkAbstractPointLocator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkX3D::level
Definition: vtkX3D.h:395
vtkLocator::Initialize
virtual void Initialize()
Initialize locator.
vtkStaticPointLocator::LargeIds
bool LargeIds
Definition: vtkStaticPointLocator.h:245
vtkLocator::GenerateRepresentation
virtual void GenerateRepresentation(int level, vtkPolyData *pd)=0
Method to build a representation at a particular level.
vtkAbstractPointLocator::FindPointsWithinRadius
virtual void FindPointsWithinRadius(double R, const double x[3], vtkIdList *result)=0
Find all points within a specified radius R of position x.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkStaticPointLocator::GetLargeIds
bool GetLargeIds()
Inform the user as to whether large ids are being used.
Definition: vtkStaticPointLocator.h:224
vtkLocator::BuildLocator
virtual void BuildLocator()=0
Build the locator from the input dataset.
vtkX3D::spacing
Definition: vtkX3D.h:481
vtkAbstractPointLocator::FindClosestNPoints
virtual void FindClosestNPoints(int N, const double x[3], vtkIdList *result)=0
Find the closest N points to a position.
vtkStaticPointLocator
quickly locate points in 3-space
Definition: vtkStaticPointLocator.h:60
vtkStaticPointLocator::MaxNumberOfBuckets
vtkIdType MaxNumberOfBuckets
Definition: vtkStaticPointLocator.h:244
VTK_ID_MAX
#define VTK_ID_MAX
Definition: vtkType.h:351
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkAbstractPointLocator
abstract class to quickly locate points in 3-space
Definition: vtkAbstractPointLocator.h:38
vtkAbstractPointLocator::FindClosestPoint
virtual vtkIdType FindClosestPoint(const double x[3])=0
Given a position x, return the id of the point closest to it.
vtkLocator::FreeSearchStructure
virtual void FreeSearchStructure()=0
Free the memory required for the spatial data structure.
vtkX3D::radius
Definition: vtkX3D.h:252
vtkAbstractPointLocator::FindClosestPointWithinRadius
virtual vtkIdType FindClosestPointWithinRadius(double radius, const double x[3], double &dist2)=0
Given a position x and a radius r, return the id of the point closest to the point in that radius.