VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkIncrementalOctreePointLocator.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00050 #ifndef __vtkIncrementalOctreePointLocator_h 00051 #define __vtkIncrementalOctreePointLocator_h 00052 00053 #include "vtkCommonDataModelModule.h" // For export macro 00054 #include "vtkIncrementalPointLocator.h" 00055 00056 class vtkPoints; 00057 class vtkIdList; 00058 class vtkPolyData; 00059 class vtkCellArray; 00060 class vtkIncrementalOctreeNode; 00061 00062 class VTKCOMMONDATAMODEL_EXPORT vtkIncrementalOctreePointLocator : public vtkIncrementalPointLocator 00063 { 00064 public: 00065 00066 vtkTypeMacro( vtkIncrementalOctreePointLocator, vtkIncrementalPointLocator ); 00067 void PrintSelf( ostream & os, vtkIndent indent ); 00068 00069 static vtkIncrementalOctreePointLocator * New(); 00070 00072 00080 vtkSetClampMacro( MaxPointsPerLeaf, int, 16, 256 ); 00081 vtkGetMacro( MaxPointsPerLeaf, int ); 00083 00085 00086 vtkSetMacro( BuildCubicOctree, int ); 00087 vtkGetMacro( BuildCubicOctree, int ); 00088 vtkBooleanMacro( BuildCubicOctree, int ); 00090 00092 00094 vtkGetObjectMacro( LocatorPoints, vtkPoints ); 00096 00098 virtual void Initialize() { this->FreeSearchStructure(); } 00099 00101 virtual void FreeSearchStructure(); 00102 00104 virtual void GetBounds( double * bounds ); 00105 00107 00108 virtual double * GetBounds() 00109 { this->GetBounds( this->Bounds ); return this->Bounds; } 00111 00113 int GetNumberOfPoints(); 00114 00121 virtual vtkIdType FindClosestInsertedPoint( const double x[3] ); 00122 00125 virtual void GenerateRepresentation( int nodeLevel, vtkPolyData * polysData ); 00126 00127 // ------------------------------------------------------------------------- 00128 // ---------------------------- Point Location ---------------------------- 00129 // ------------------------------------------------------------------------- 00130 00134 virtual void BuildLocator(); 00135 00140 virtual vtkIdType FindClosestPoint( const double x[3] ); 00141 00146 virtual vtkIdType FindClosestPoint( double x, double y, double z ); 00147 00153 virtual vtkIdType FindClosestPoint( const double x[3], double * miniDist2 ); 00154 00160 virtual vtkIdType FindClosestPoint( double x, double y, double z, double * miniDist2 ); 00161 00163 00169 virtual vtkIdType FindClosestPointWithinRadius 00170 ( double radius, const double x[3], double & dist2 ); 00172 00174 00180 vtkIdType FindClosestPointWithinSquaredRadius 00181 ( double radius2, const double x[3], double & dist2 ); 00183 00185 00190 virtual void FindPointsWithinRadius 00191 ( double R, const double x[3], vtkIdList * result ); 00193 00195 00200 void FindPointsWithinSquaredRadius 00201 ( double R2, const double x[3], vtkIdList * result ); 00203 00205 00210 virtual void FindClosestNPoints 00211 ( int N, const double x[3], vtkIdList * result ); 00213 00214 // ------------------------------------------------------------------------- 00215 // ---------------------------- Point Insertion ---------------------------- 00216 // ------------------------------------------------------------------------- 00217 00225 virtual int InitPointInsertion( vtkPoints * points, const double bounds[6] ); 00226 00228 00236 virtual int InitPointInsertion( vtkPoints * points, const double bounds[6], 00237 vtkIdType estSize ); 00239 00244 virtual vtkIdType IsInsertedPoint( const double x[3] ); 00245 00250 virtual vtkIdType IsInsertedPoint( double x, double y, double z ); 00251 00259 virtual int InsertUniquePoint( const double point[3], vtkIdType & pntId ); 00260 00268 virtual void InsertPoint( vtkIdType ptId, const double x[3] ); 00269 00277 virtual vtkIdType InsertNextPoint( const double x[3] ); 00278 00280 00287 void InsertPointWithoutChecking 00288 ( const double point[3], vtkIdType & pntId, int insert ); 00290 00291 //BTX 00292 protected: 00293 00294 vtkIncrementalOctreePointLocator(); 00295 virtual ~vtkIncrementalOctreePointLocator(); 00296 00297 private: 00298 00299 int BuildCubicOctree; 00300 int MaxPointsPerLeaf; 00301 double InsertTolerance2; 00302 double OctreeMaxDimSize; 00303 double FudgeFactor; 00304 vtkPoints * LocatorPoints; 00305 vtkIncrementalOctreeNode * OctreeRootNode; 00306 00308 static void DeleteAllDescendants( vtkIncrementalOctreeNode * node ); 00309 00311 00313 static void AddPolys( vtkIncrementalOctreeNode * node, 00314 vtkPoints * points, vtkCellArray * polygs ); 00316 00318 00321 vtkIncrementalOctreeNode * GetLeafContainer( vtkIncrementalOctreeNode * node, 00322 const double pnt[3] ); 00324 00326 00332 vtkIdType FindClosestPointInLeafNode( vtkIncrementalOctreeNode * leafNode, 00333 const double point[3], double * dist2 ); 00335 00337 00348 vtkIdType FindClosestPointInSphere 00349 ( const double point[3], double radius2, vtkIncrementalOctreeNode * maskNode, 00350 double * minDist2, const double * refDist2 ); 00352 00353 00354 // ------------------------------------------------------------------------- 00355 // ---------------------------- Point Location ---------------------------- 00356 // ------------------------------------------------------------------------- 00357 00359 00368 vtkIdType FindClosestPointInSphereWithoutTolerance( const double point[3], 00369 double radius2, vtkIncrementalOctreeNode * maskNode, double * minDist2 ); 00371 00373 00377 void FindPointsWithinSquaredRadius( vtkIncrementalOctreeNode * node, 00378 double radius2, const double point[3], vtkIdList * idList ); 00380 00381 // ------------------------------------------------------------------------- 00382 // ---------------------------- Point Insertion ---------------------------- 00383 // ------------------------------------------------------------------------- 00384 00386 00396 vtkIdType FindClosestPointInSphereWithTolerance( const double point[3], 00397 double radius2, vtkIncrementalOctreeNode * maskNode, double * minDist2 ); 00399 00401 00409 vtkIdType IsInsertedPoint( const double x[3], 00410 vtkIncrementalOctreeNode ** leafContainer ); 00412 00414 00421 vtkIdType IsInsertedPointForZeroTolerance 00422 ( const double x[3], vtkIncrementalOctreeNode ** leafContainer ); 00424 00426 00434 vtkIdType IsInsertedPointForNonZeroTolerance 00435 ( const double x[3], vtkIncrementalOctreeNode ** leafContainer ); 00437 00439 00444 vtkIdType FindDuplicatePointInLeafNode( vtkIncrementalOctreeNode * leafNode, 00445 const double point[3] ); 00447 00449 00455 vtkIdType FindDuplicateFloatTypePointInVisitedLeafNode 00456 ( vtkIncrementalOctreeNode * leafNode, const double point[3] ); 00458 00460 00466 vtkIdType FindDuplicateDoubleTypePointInVisitedLeafNode 00467 ( vtkIncrementalOctreeNode * leafNode, const double point[3] ); 00469 00470 vtkIncrementalOctreePointLocator 00471 ( const vtkIncrementalOctreePointLocator & ); // Not implemented 00472 void operator = ( const vtkIncrementalOctreePointLocator & );// Not implemented 00473 //ETX 00474 }; 00475 #endif