![]() |
http://www.sim.no/ http://www.coin3d.org/ |
00001 #ifndef COIN_SBOCTTREE_H 00002 #define COIN_SBOCTTREE_H 00003 00004 /**************************************************************************\ 00005 * 00006 * This file is part of the Coin 3D visualization library. 00007 * Copyright (C) by Kongsberg Oil & Gas Technologies. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * ("GPL") version 2 as published by the Free Software Foundation. 00012 * See the file LICENSE.GPL at the root directory of this source 00013 * distribution for additional information about the GNU GPL. 00014 * 00015 * For using Coin with software that can not be combined with the GNU 00016 * GPL, and for taking advantage of the additional benefits of our 00017 * support services, please contact Kongsberg Oil & Gas Technologies 00018 * about acquiring a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 00023 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00024 * 00025 \**************************************************************************/ 00026 00027 #include <Inventor/SbVec3f.h> 00028 #include <Inventor/lists/SbList.h> 00029 #include <Inventor/SbBox3f.h> 00030 #include <stdio.h> 00031 00032 class SbSphere; 00033 class SbOctTreeNode; 00034 class SbPlane; 00035 00036 // ************************************************************************* 00037 00038 typedef struct 00039 { 00040 SbBool (*ptinsidefunc)(void * const item, const SbVec3f & pt); 00041 SbBool (*insideboxfunc)(void * const item, const SbBox3f & box); 00042 SbBool (*insidespherefunc)(void * const item, const SbSphere & sphere); 00043 SbBool (*insideplanesfunc)(void * const item, 00044 const SbPlane * const planes, 00045 const int numplanes); 00046 } SbOctTreeFuncs; 00047 00048 // ************************************************************************* 00049 00050 class COIN_DLL_API SbOctTree { 00051 public: 00052 SbOctTree(const SbBox3f & bbox, 00053 const SbOctTreeFuncs & itemfuncs, 00054 const int maxitemspernode = 64); 00055 ~SbOctTree(); 00056 00057 void addItem(void * const item); 00058 void removeItem(void * const item); 00059 void findItems(const SbVec3f & pos, 00060 SbList <void*> & destarray, 00061 const SbBool removeduplicates = TRUE) const; 00062 void findItems(const SbBox3f & box, 00063 SbList <void*> & destarray, 00064 const SbBool removeduplicates = TRUE) const; 00065 void findItems(const SbSphere & sphere, 00066 SbList <void*> & destarray, 00067 const SbBool removeduplicates = TRUE) const; 00068 void findItems(const SbPlane * const planes, 00069 const int numplanes, 00070 SbList <void*> & destarray, 00071 const SbBool removeduplicates= TRUE) const; 00072 00073 const SbBox3f & getBoundingBox(void) const; 00074 void clear(void); 00075 void debugTree(FILE * fp); 00076 00077 private: 00078 SbOctTreeNode * topnode; 00079 SbOctTreeFuncs itemfuncs; 00080 int maxitemspernode; 00081 }; 00082 00083 // ************************************************************************* 00084 00085 #endif // !COIN_SBOCTTREE_H
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Mon May 10 00:34:49 2010 for Coin by Doxygen 1.6.3.