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

Filtering/vtkCellLocator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkCellLocator.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00068 #ifndef __vtkCellLocator_h
00069 #define __vtkCellLocator_h
00070 
00071 #include "vtkLocator.h"
00072 
00073 class vtkNeighborCells;
00074 
00075 class VTK_FILTERING_EXPORT vtkCellLocator : public vtkLocator
00076 {
00077 public:
00078   vtkTypeMacro(vtkCellLocator,vtkLocator);
00079   void PrintSelf(ostream& os, vtkIndent indent);
00080 
00083   static vtkCellLocator *New();
00084 
00086 
00087   vtkSetClampMacro(NumberOfCellsPerBucket,int,1,VTK_LARGE_INTEGER);
00088   vtkGetMacro(NumberOfCellsPerBucket,int);
00090 
00092 
00097   vtkSetMacro(CacheCellBounds,int);
00098   vtkGetMacro(CacheCellBounds,int);
00099   vtkBooleanMacro(CacheCellBounds,int);
00101 
00103 
00105   virtual int IntersectWithLine(float a0[3], float a1[3], float tol,
00106                                 float& t, float x[3], float pcoords[3],
00107                                 int &subId);
00109 
00111 
00113   virtual int IntersectWithLine(float a0[3], float a1[3], float tol,
00114                                 float& t, float x[3], float pcoords[3],
00115                                 int &subId, vtkIdType &cellId);
00117 
00119 
00122   virtual int IntersectWithLine(float a0[3], float a1[3], float tol,
00123                                 float& t, float x[3], float pcoords[3],
00124                                 int &subId, vtkIdType &cellId,
00125                                 vtkGenericCell *cell);
00127 
00129 
00132   void FindClosestPoint(float x[3], float closestPoint[3], vtkIdType &cellId,
00133                         int &subId, float& dist2);
00135   
00137 
00146   void FindClosestPoint(float x[3], float closestPoint[3],
00147                         vtkGenericCell *cell, vtkIdType &cellId, int &subId,
00148                         float& dist2);
00150   
00152 
00158   int FindClosestPointWithinRadius(float x[3], float radius,
00159                                    float closestPoint[3], vtkIdType &cellId,
00160                                    int &subId, float& dist2);
00162  
00164 
00177   int FindClosestPointWithinRadius(float x[3], float radius,
00178                                    float closestPoint[3],
00179                                    vtkGenericCell *cell, vtkIdType &cellId,
00180                                    int &subId, float& dist2);
00182 
00184 
00199   int FindClosestPointWithinRadius(float x[3], float radius,
00200                                    float closestPoint[3],
00201                                    vtkGenericCell *cell, vtkIdType &cellId,
00202                                    int &subId, float& dist2, int &inside);
00204   
00206   virtual vtkIdList *GetCells(int bucket);
00207 
00210   virtual int GetNumberOfBuckets(void);
00211 
00213 
00214   void FreeSearchStructure();
00215   void BuildLocator();
00216   void GenerateRepresentation(int level, vtkPolyData *pd);
00218   
00219 protected:
00220   vtkCellLocator();
00221   ~vtkCellLocator();
00222 
00223   void GetBucketNeighbors(int ijk[3], int ndivs, int level);
00224   void GetOverlappingBuckets(float x[3], int ijk[3], float dist, 
00225                              int prevMinLevel[3], int prevMaxLevel[3]);
00226 
00227   void ClearCellHasBeenVisited();
00228   void ClearCellHasBeenVisited(int id);
00229 
00230   float Distance2ToBucket(float x[3], int nei[3]);
00231   float Distance2ToBounds(float x[3], float bounds[6]);
00232   
00233   int NumberOfCellsPerBucket; // cells per octant
00234   int NumberOfOctants; // number of octants in tree
00235   float Bounds[6]; // bounding box root octant
00236   int NumberOfParents; // number of parent octants
00237   float H[3]; // width of leaf octant in x-y-z directions
00238   int NumberOfDivisions; // number of "leaf" octant sub-divisions
00239   vtkIdList **Tree; // octree
00240 
00241   void MarkParents(void*, int, int, int, int, int);
00242   void GetChildren(int idx, int level, int children[8]);
00243   int GenerateIndex(int offset, int numDivs, int i, int j, int k,
00244                     vtkIdType &idx);
00245   void GenerateFace(int face, int numDivs, int i, int j, int k,
00246                     vtkPoints *pts, vtkCellArray *polys);
00247 
00248   vtkNeighborCells *Buckets;
00249   unsigned char *CellHasBeenVisited;
00250   unsigned char QueryNumber;
00251   int CacheCellBounds;
00252 //BTX - begin tcl exclude
00253   float (*CellBounds)[6];
00254 //ETX - end tcl exclude
00255 private:
00256   vtkCellLocator(const vtkCellLocator&);  // Not implemented.
00257   void operator=(const vtkCellLocator&);  // Not implemented.
00258 };
00259 
00260 #endif
00261 
00262 

Generated on Thu Mar 28 14:19:18 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001