Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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 =========================================================================*/
00057 #ifndef __vtkPointLocator2D_h
00058 #define __vtkPointLocator2D_h
00059 
00060 #include "vtkLocator.h"
00061 
00062 class vtkCellArray;
00063 class vtkIdList;
00064 class vtkNeighborPoints2D;
00065 class vtkPoints;
00066 
00067 class VTK_COMMON_EXPORT vtkPointLocator2D : public vtkLocator
00068 {
00069 public:
00072   static vtkPointLocator2D *New();
00073 
00074   vtkTypeRevisionMacro(vtkPointLocator2D,vtkLocator);
00075   void PrintSelf(ostream& os, vtkIndent indent);
00076 
00078 
00079   vtkSetVector2Macro(Divisions,int);
00080   vtkGetVectorMacro(Divisions,int,2);
00082 
00084 
00085   vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_LARGE_INTEGER);
00086   vtkGetMacro(NumberOfPointsPerBucket,int);
00088 
00090   virtual int FindClosestPoint(float x[2]);
00091 
00095   virtual int IsInsertedPoint(float x[2]);
00096 
00098 
00102   virtual void FindClosestNPoints(int N, float x[2], vtkIdList *result);
00103   virtual void FindClosestNPoints(int N, float x, float y,
00104                                   vtkIdList *result);
00106 
00108 
00111   virtual void FindDistributedPoints(int N, float x[2], 
00112                                      vtkIdList *result, int M);
00113   virtual void FindDistributedPoints(int N, float x, float y, 
00114                                      vtkIdList *result, int M);
00116 
00118 
00120   virtual void FindPointsWithinRadius(float R, float x[2], vtkIdList *result);
00121   virtual void FindPointsWithinRadius(float R, float x, float y,
00122                                       vtkIdList *result);
00123   // Description:
00124   // See vtkLocator interface documentation.
00125   void Initialize();
00126   void FreeSearchStructure();
00127   void BuildLocator();
00128   void GenerateRepresentation(int level, vtkPolyData *pd);
00130 
00132 
00133   virtual void SetPoints(vtkPoints*);
00134   vtkGetObjectMacro(Points,vtkPoints);
00136   
00137 protected:
00138   vtkPointLocator2D();
00139   ~vtkPointLocator2D();
00140 
00141   // place points in appropriate buckets
00142   void GetBucketNeighbors(int ijk[2], int ndivs[2], int level);
00143   void GetOverlappingBuckets(float x[2], int ijk[2], float dist, int level);
00144   void GenerateFace(int face, int i, int j, int k, 
00145                     vtkPoints *pts, vtkCellArray *polys);
00146 
00147   vtkPoints *Points; // Used for merging points
00148   int Divisions[2]; // Number of sub-divisions in x-y-z directions
00149   int NumberOfPointsPerBucket; //Used with previous boolean to control subdivide
00150   float Bounds[4]; // bounds of points
00151   vtkIdList **HashTable; // lists of point ids in buckets
00152   int NumberOfBuckets; // total size of hash table
00153   float H[2]; // width of each bucket in x-y-z directions
00154   vtkNeighborPoints2D *Buckets;
00155   float InsertionTol2;
00156 private:
00157   vtkPointLocator2D(const vtkPointLocator2D&);  // Not implemented.
00158   void operator=(const vtkPointLocator2D&);  // Not implemented.
00159 };
00160 
00161 #endif
00162 
00163