Common/vtkPointLocator.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Common/vtkPointLocator.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkPointLocator.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00060 #ifndef __vtkPointLocator_h
    00061 #define __vtkPointLocator_h
    00062
    00063 #include "vtkLocator.h"
    00064
    00065 class vtkCellArray;
    00066 class vtkIdList;
    00067 class vtkNeighborPoints;
    00068 class vtkPoints;
    00069
    00070 class VTK_COMMON_EXPORT vtkPointLocator : public vtkLocator
    00071 {
    00072 public:
    00075   static vtkPointLocator *New();
    00076
    00077   vtkTypeRevisionMacro(vtkPointLocator,vtkLocator);
    00078   void PrintSelf(ostream& os, vtkIndent indent);
    00079
    00081
    00082   vtkSetVector3Macro(Divisions,int);
    00083   vtkGetVectorMacro(Divisions,int,3);
    00085
    00087
    00088   vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_LARGE_INTEGER);
    00089   vtkGetMacro(NumberOfPointsPerBucket,int);
    00091
    00093
    00097   virtual vtkIdType FindClosestPoint(const float x[3]);
    00098   vtkIdType FindClosestPoint(float x, float y, float z);
    00100
    00102
    00106   vtkIdType FindClosestPointWithinRadius(float radius, const float x[3],
    00107                                          float& dist2);
    00108   vtkIdType FindClosestPointWithinRadius(float radius, const float x[3],
    00109                                          float inputDataLength, float& dist2);
    00111
    00116   virtual int InitPointInsertion(vtkPoints *newPts, const float bounds[6]);
    00117
    00119
    00123   virtual int InitPointInsertion(vtkPoints *newPts, const float bounds[6],
    00124                                  vtkIdType estSize);
    00126
    00134   virtual void InsertPoint(vtkIdType ptId, const float x[3]);
    00135
    00143   virtual vtkIdType InsertNextPoint(const float x[3]);
    00144
    00146
    00149   vtkIdType IsInsertedPoint(float x, float  y, float z)
    00150     {
    00151     float xyz[3];
    00152     xyz[0] = x; xyz[1] = y; xyz[2] = z;
    00153     return this->IsInsertedPoint (xyz);
    00154     };
    00155   virtual vtkIdType IsInsertedPoint(const float x[3]);
    00157
    00165   virtual int InsertUniquePoint(const float x[3], vtkIdType &ptId);
    00166
    00172   virtual vtkIdType FindClosestInsertedPoint(const float x[3]);
    00173
    00175
    00181   virtual void FindClosestNPoints(int N, const float x[3], vtkIdList *result);
    00182   virtual void FindClosestNPoints(int N, float x, float y, float z,
    00183                                   vtkIdList *result);
    00185
    00187
    00192   virtual void FindDistributedPoints(int N, const float x[3],
    00193                                      vtkIdList *result, int M);
    00194   virtual void FindDistributedPoints(int N, float x, float y,
    00195                                      float z, vtkIdList *result, int M);
    00197
    00199
    00203   virtual void FindPointsWithinRadius(float R, const float x[3],
    00204                                       vtkIdList *result);
    00205   virtual void FindPointsWithinRadius(float R, float x, float y, float z,
    00206                                       vtkIdList *result);
    00208
    00213   virtual vtkIdList *GetPointsInBucket(const float x[3], int ijk[3]);
    00214
    00216
    00218   void Initialize();
    00219   void FreeSearchStructure();
    00220   void BuildLocator();
    00221   void GenerateRepresentation(int level, vtkPolyData *pd);
    00223
    00224 protected:
    00225   vtkPointLocator();
    00226   ~vtkPointLocator();
    00227
    00228   // place points in appropriate buckets
    00229   void GetBucketNeighbors(vtkNeighborPoints* buckets,
    00230                           const int ijk[3], const int ndivs[3], int level);
    00231   void GetOverlappingBuckets(vtkNeighborPoints* buckets,
    00232                              const float x[3], const int ijk[3], float dist,
    00233                              int level);
    00234   void GetOverlappingBuckets(vtkNeighborPoints* buckets,
    00235                              const float x[3], float dist,
    00236                              int prevMinLevel[3],
    00237                              int prevMaxLevel[3]);
    00238   void GenerateFace(int face, int i, int j, int k,
    00239                     vtkPoints *pts, vtkCellArray *polys);
    00240   float Distance2ToBucket(const float x[3], const int nei[3]);
    00241   float Distance2ToBounds(const float x[3], const float bounds[6]);
    00242
    00243   vtkPoints *Points; // Used for merging points
    00244   int Divisions[3]; // Number of sub-divisions in x-y-z directions
    00245   int NumberOfPointsPerBucket; //Used with previous boolean to control subdivide
    00246   float Bounds[6]; // bounds of points
    00247   vtkIdList **HashTable; // lists of point ids in buckets
    00248   vtkIdType NumberOfBuckets; // total size of hash table
    00249   float H[3]; // width of each bucket in x-y-z directions
    00250
    00251   float InsertionTol2;
    00252   vtkIdType InsertionPointId;
    00253
    00254   float InsertionLevel;
    00255 private:
    00256   vtkPointLocator(const vtkPointLocator&);  // Not implemented.
    00257   void operator=(const vtkPointLocator&);  // Not implemented.
    00258 };
    00259
    00260 #endif
    00261
    00262