OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / ALPHALINUX5 / util / ALPHALINUX5 / include / vtk / vtkPointLocator.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkPointLocator.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:35:45 $
7   Version:   $Revision: 1.1.1.1 $
8
9
10 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
11
12 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
13 The following terms apply to all files associated with the software unless
14 explicitly disclaimed in individual files. This copyright specifically does
15 not apply to the related textbook "The Visualization Toolkit" ISBN
16 013199837-4 published by Prentice Hall which is covered by its own copyright.
17
18 The authors hereby grant permission to use, copy, and distribute this
19 software and its documentation for any purpose, provided that existing
20 copyright notices are retained in all copies and that this notice is included
21 verbatim in any distributions. Additionally, the authors grant permission to
22 modify this software and its documentation for any purpose, provided that
23 such modifications are not distributed without the explicit consent of the
24 authors and that existing copyright notices are retained in all copies. Some
25 of the algorithms implemented by this software are patented, observe all
26 applicable patent law.
27
28 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
29 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
30 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
31 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
34 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
35 PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
36 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
37 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
38
39
40 =========================================================================*/
41 // .NAME vtkPointLocator - quickly locate points in 3-space
42 // .SECTION Description
43 // vtkPointLocator is a spatial search object to quickly locate points in 3D.
44 // vtkPointLocator works by dividing a specified region of space into a regular
45 // array of "rectangular" buckets, and then keeping a list of points that 
46 // lie in each bucket. Typical operation involves giving a position in 3D 
47 // and finding the closest point.
48 //
49 // vtkPointLocator has two distinct methods of interaction. In the first
50 // method, you suppy it with a dataset, and it operates on the points in 
51 // the dataset. In the second method, you supply it with an array of points,
52 // and the object operates on the array.
53
54 // .SECTION Caveats
55 // Many other types of spatial locators have been developed such as 
56 // octrees and kd-trees. These are often more efficient for the 
57 // operations described here.
58
59 // .SECTION See Also
60 // vtkCellPicker vtkPointPicker
61
62 #ifndef __vtkPointLocator_h
63 #define __vtkPointLocator_h
64
65 #include "vtkLocator.h"
66 #include "vtkPoints.h"
67 #include "vtkIdList.h"
68
69 class VTK_EXPORT vtkPointLocator : public vtkLocator
70 {
71 public:
72   vtkPointLocator();
73   ~vtkPointLocator();
74   static vtkPointLocator *New() {return new vtkPointLocator;};
75   const char *GetClassName() {return "vtkPointLocator";};
76   void PrintSelf(ostream& os, vtkIndent indent);
77
78   // Description:
79   // Set the number of divisions in x-y-z directions.
80   vtkSetVector3Macro(Divisions,int);
81   vtkGetVectorMacro(Divisions,int,3);
82
83   // Description:
84   // Specify the average number of points in each bucket.
85   vtkSetClampMacro(NumberOfPointsPerBucket,int,1,VTK_LARGE_INTEGER);
86   vtkGetMacro(NumberOfPointsPerBucket,int);
87
88   // these operate with specified dataset
89   virtual int FindClosestPoint(float x[3]);
90   virtual int *MergePoints();
91
92   // these all operate on array of points from InitPointInsertion()
93   virtual int InitPointInsertion(vtkPoints *newPts, float bounds[6]);
94   virtual void InsertPoint(int ptId, float x[3]);
95   virtual int InsertNextPoint(float x[3]);
96   virtual int IsInsertedPoint(float x[3]);
97   virtual int FindClosestInsertedPoint(float x[3]);
98   
99   // satisfy vtkLocator abstract interface
100   void Initialize();
101   void FreeSearchStructure();
102   void BuildLocator();
103   void GenerateRepresentation(int level, vtkPolyData *pd);
104
105 protected:
106   // place points in appropriate buckets
107   void GetBucketNeighbors(int ijk[3], int ndivs[3], int level);
108   void GetOverlappingBuckets(float x[3], int ijk[3], float dist);
109   void GenerateFace(int face, int i, int j, int k, 
110                     vtkPoints *pts, vtkCellArray *polys);
111
112   vtkPoints *Points; // Used for merging points
113   int Divisions[3]; // Number of sub-divisions in x-y-z directions
114   int NumberOfPointsPerBucket; //Used with previous boolean to control subdivide
115   float Bounds[6]; // bounds of points
116   vtkIdList **HashTable; // lists of point ids in buckets
117   int NumberOfBuckets; // total size of hash table
118   float H[3]; // width of each bucket in x-y-z directions
119
120   float InsertionTol2;
121   int InsertionPointId;
122 };
123
124 #endif
125
126