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

Common/vtkPointLocator2D.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkPointLocator2D.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 =========================================================================*/
00056 #ifndef __vtkPointLocator2D_h
00057 #define __vtkPointLocator2D_h
00058 
00059 #include "vtkLocator.h"
00060 
00061 class vtkCellArray;
00062 class vtkIdList;
00063 class vtkNeighborPoints2D;
00064 class vtkPoints;
00065 
00066 class VTK_COMMON_EXPORT vtkPointLocator2D : public vtkLocator
00067 {
00068 public:
00071   static vtkPointLocator2D *New();
00072 
00073   vtkTypeRevisionMacro(vtkPointLocator2D,vtkLocator);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075 
00077 
00078   vtkSetVector2Macro(Divisions,int);
00079   vtkGetVectorMacro(Divisions,int,2);
00081 
00083 
00084   vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_LARGE_INTEGER);
00085   vtkGetMacro(NumberOfPointsPerBucket,int);
00087 
00089   virtual int FindClosestPoint(float x[2]);
00090 
00094   virtual int IsInsertedPoint(float x[2]);
00095 
00097 
00101   virtual void FindClosestNPoints(int N, float x[2], vtkIdList *result);
00102   virtual void FindClosestNPoints(int N, float x, float y,
00103                                   vtkIdList *result);
00105 
00107 
00110   virtual void FindDistributedPoints(int N, float x[2], 
00111                                      vtkIdList *result, int M);
00112   virtual void FindDistributedPoints(int N, float x, float y, 
00113                                      vtkIdList *result, int M);
00115 
00117 
00119   virtual void FindPointsWithinRadius(float R, float x[2], vtkIdList *result);
00120   virtual void FindPointsWithinRadius(float R, float x, float y,
00121                                       vtkIdList *result);
00122   // Description:
00123   // See vtkLocator interface documentation.
00124   void Initialize();
00125   void FreeSearchStructure();
00126   void BuildLocator();
00127   void GenerateRepresentation(int level, vtkPolyData *pd);
00129 
00131 
00132   virtual void SetPoints(vtkPoints*);
00133   vtkGetObjectMacro(Points,vtkPoints);
00135   
00136 protected:
00137   vtkPointLocator2D();
00138   ~vtkPointLocator2D();
00139 
00140   // place points in appropriate buckets
00141   void GetBucketNeighbors(int ijk[2], int ndivs[2], int level);
00142   void GetOverlappingBuckets(float x[2], int ijk[2], float dist, int level);
00143   void GenerateFace(int face, int i, int j, int k, 
00144                     vtkPoints *pts, vtkCellArray *polys);
00145 
00146   vtkPoints *Points; // Used for merging points
00147   int Divisions[2]; // Number of sub-divisions in x-y-z directions
00148   int NumberOfPointsPerBucket; //Used with previous boolean to control subdivide
00149   float Bounds[4]; // bounds of points
00150   vtkIdList **HashTable; // lists of point ids in buckets
00151   int NumberOfBuckets; // total size of hash table
00152   float H[2]; // width of each bucket in x-y-z directions
00153   vtkNeighborPoints2D *Buckets;
00154   float InsertionTol2;
00155 private:
00156   vtkPointLocator2D(const vtkPointLocator2D&);  // Not implemented.
00157   void operator=(const vtkPointLocator2D&);  // Not implemented.
00158 };
00159 
00160 #endif
00161 
00162