BSPTree.h

00001 /**************************************************************************\
00002  * 
00003  *  FILE: BSPTree.h
00004  *
00005  *  This source file is part of DIME.
00006  *  Copyright (C) 1998-1999 by Systems In Motion.  All rights reserved.
00007  *
00008  *  This library is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License, version 2, as
00010  *  published by the Free Software Foundation.
00011  *
00012  *  This library is distributed in the hope that it will be useful, but
00013  *  WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  General Public License (the accompanying file named COPYING) for more
00016  *  details.
00017  *
00018  **************************************************************************
00019  *
00020  *  If you need DIME for a non-GPL project, contact Systems In Motion
00021  *  to acquire a Professional Edition License:
00022  *
00023  *  Systems In Motion                                   http://www.sim.no/
00024  *  Prof. Brochs gate 6                                       sales@sim.no
00025  *  N-7030 Trondheim                                   Voice: +47 22114160
00026  *  NORWAY                                               Fax: +47 67172912
00027  *
00028 \**************************************************************************/
00029 
00030 #ifndef DIME_BSPTREE_H
00031 #define DIME_BSPTREE_H
00032 
00033 #include <dime/Basic.h>
00034 #include <dime/util/Array.h>
00035 #include <dime/util/Linear.h>
00036 
00037 class dimeBox;
00038 class dime_bspnode;
00039 
00040 class DIME_DLL_API dimeBSPTree
00041 {
00042 public:
00043   dimeBSPTree(const int maxnodepts = 64, const int initsize = 4);
00044   ~dimeBSPTree();
00045   
00046   int numPoints() const;
00047   void getPoint(const int idx, dimeVec3f &pt);
00048   void *getUserData(const int idx) const;
00049   
00050   void setUserData(const int idx, void * const data);
00051   
00052   int addPoint(const dimeVec3f &pt, void * const userdata = NULL);
00053   int removePoint(const dimeVec3f &pt);
00054   void removePoint(const int idx);
00055   int findPoint(const dimeVec3f &pos) const;
00056   void clear(const int initsize = 4);
00057   
00058   const dimeBox *getBBox() const;
00059   
00060 private:
00061   friend class dime_bspnode;
00062   dimeArray <dimeVec3f> pointsArray;
00063   dimeArray <void*> userdataArray;
00064   dime_bspnode *topnode;
00065   int maxnodepoints;
00066   dimeBox *boundingBox;
00067 }; // class dimeBSPTree
00068 
00069 #endif // ! DIME_BSPTREE_H
00070 

Copyright © 1998-1999, Systems In Motion <sales@sim.no>. All rights reserved.
System documentation was generated using doxygen.