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   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 __vtkCellLocator_h
    00058 #define __vtkCellLocator_h
    00059
    00060 #include "vtkLocator.h"
    00061
    00062 class vtkCellArray;
    00063 class vtkGenericCell;
    00064 class vtkIdList;
    00065 class vtkNeighborCells;
    00066 class vtkPoints;
    00067
    00068 class VTK_FILTERING_EXPORT vtkCellLocator : public vtkLocator
    00069 {
    00070 public:
    00071   vtkTypeRevisionMacro(vtkCellLocator,vtkLocator);
    00072   void PrintSelf(ostream& os, vtkIndent indent);
    00073
    00076   static vtkCellLocator *New();
    00077
    00079
    00080   vtkSetClampMacro(NumberOfCellsPerBucket,int,1,VTK_LARGE_INTEGER);
    00081   vtkGetMacro(NumberOfCellsPerBucket,int);
    00083
    00085
    00090   vtkSetMacro(CacheCellBounds,int);
    00091   vtkGetMacro(CacheCellBounds,int);
    00092   vtkBooleanMacro(CacheCellBounds,int);
    00094
    00096
    00098   virtual int IntersectWithLine(float a0[3], float a1[3], float tol,
    00099                                 float& t, float x[3], float pcoords[3],
    00100                                 int &subId);
    00102
    00104
    00106   virtual int IntersectWithLine(float a0[3], float a1[3], float tol,
    00107                                 float& t, float x[3], float pcoords[3],
    00108                                 int &subId, vtkIdType &cellId);
    00110
    00112
    00115   virtual int IntersectWithLine(float a0[3], float a1[3], float tol,
    00116                                 float& t, float x[3], float pcoords[3],
    00117                                 int &subId, vtkIdType &cellId,
    00118                                 vtkGenericCell *cell);
    00120
    00122
    00125   void FindClosestPoint(float x[3], float closestPoint[3], vtkIdType &cellId,
    00126                         int &subId, float& dist2);
    00128
    00130
    00139   void FindClosestPoint(float x[3], float closestPoint[3],
    00140                         vtkGenericCell *cell, vtkIdType &cellId, int &subId,
    00141                         float& dist2);
    00143
    00145
    00151   int FindClosestPointWithinRadius(float x[3], float radius,
    00152                                    float closestPoint[3], vtkIdType &cellId,
    00153                                    int &subId, float& dist2);
    00155
    00157
    00170   int FindClosestPointWithinRadius(float x[3], float radius,
    00171                                    float closestPoint[3],
    00172                                    vtkGenericCell *cell, vtkIdType &cellId,
    00173                                    int &subId, float& dist2);
    00175
    00177
    00192   int FindClosestPointWithinRadius(float x[3], float radius,
    00193                                    float closestPoint[3],
    00194                                    vtkGenericCell *cell, vtkIdType &cellId,
    00195                                    int &subId, float& dist2, int &inside);
    00197
    00199   virtual vtkIdList *GetCells(int bucket);
    00200
    00203   virtual int GetNumberOfBuckets(void);
    00204
    00206
    00207   void FreeSearchStructure();
    00208   void BuildLocator();
    00209   void GenerateRepresentation(int level, vtkPolyData *pd);
    00211
    00212 protected:
    00213   vtkCellLocator();
    00214   ~vtkCellLocator();
    00215
    00216   void GetBucketNeighbors(int ijk[3], int ndivs, int level);
    00217   void GetOverlappingBuckets(float x[3], int ijk[3], float dist,
    00218                              int prevMinLevel[3], int prevMaxLevel[3]);
    00219
    00220   void ClearCellHasBeenVisited();
    00221   void ClearCellHasBeenVisited(int id);
    00222
    00223   float Distance2ToBucket(float x[3], int nei[3]);
    00224   float Distance2ToBounds(float x[3], float bounds[6]);
    00225
    00226   int NumberOfCellsPerBucket; // cells per octant
    00227   int NumberOfOctants; // number of octants in tree
    00228   float Bounds[6]; // bounding box root octant
    00229   int NumberOfParents; // number of parent octants
    00230   float H[3]; // width of leaf octant in x-y-z directions
    00231   int NumberOfDivisions; // number of "leaf" octant sub-divisions
    00232   vtkIdList **Tree; // octree
    00233
    00234   void MarkParents(void*, int, int, int, int, int);
    00235   void GetChildren(int idx, int level, int children[8]);
    00236   int GenerateIndex(int offset, int numDivs, int i, int j, int k,
    00237                     vtkIdType &idx);
    00238   void GenerateFace(int face, int numDivs, int i, int j, int k,
    00239                     vtkPoints *pts, vtkCellArray *polys);
    00240
    00241   vtkNeighborCells *Buckets;
    00242   unsigned char *CellHasBeenVisited;
    00243   unsigned char QueryNumber;
    00244   int CacheCellBounds;
    00245 //BTX - begin tcl exclude
    00246   float (*CellBounds)[6];
    00247 //ETX - end tcl exclude
    00248 private:
    00249   vtkCellLocator(const vtkCellLocator&);  // Not implemented.
    00250   void operator=(const vtkCellLocator&);  // Not implemented.
    00251 };
    00252
    00253 #endif
    00254
    00255