Coin Logo http://www.sim.no/
http://www.coin3d.org/

SbOctTree.h
1#ifndef COIN_SBOCTTREE_H
2#define COIN_SBOCTTREE_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/SbVec3f.h>
28#include <Inventor/lists/SbList.h>
29#include <Inventor/SbBox3f.h>
30#include <stdio.h>
31
32class SbSphere;
33class SbOctTreeNode;
34class SbPlane;
35
36// *************************************************************************
37
38typedef struct
39{
40 SbBool (*ptinsidefunc)(void * const item, const SbVec3f & pt);
41 SbBool (*insideboxfunc)(void * const item, const SbBox3f & box);
42 SbBool (*insidespherefunc)(void * const item, const SbSphere & sphere);
43 SbBool (*insideplanesfunc)(void * const item,
44 const SbPlane * const planes,
45 const int numplanes);
47
48// *************************************************************************
49
50class COIN_DLL_API SbOctTree {
51public:
52 SbOctTree(const SbBox3f & bbox,
53 const SbOctTreeFuncs & itemfuncs,
54 const int maxitemspernode = 64);
55 ~SbOctTree();
56
57 void addItem(void * const item);
58 void removeItem(void * const item);
59 void findItems(const SbVec3f & pos,
60 SbList <void*> & destarray,
61 const SbBool removeduplicates = TRUE) const;
62 void findItems(const SbBox3f & box,
63 SbList <void*> & destarray,
64 const SbBool removeduplicates = TRUE) const;
65 void findItems(const SbSphere & sphere,
66 SbList <void*> & destarray,
67 const SbBool removeduplicates = TRUE) const;
68 void findItems(const SbPlane * const planes,
69 const int numplanes,
70 SbList <void*> & destarray,
71 const SbBool removeduplicates= TRUE) const;
72
73 const SbBox3f & getBoundingBox(void) const;
74 void clear(void);
75 void debugTree(FILE * fp);
76
77private:
78 SbOctTreeNode * topnode;
79 SbOctTreeFuncs itemfuncs;
80 int maxitemspernode;
81};
82
83// *************************************************************************
84
85#endif // !COIN_SBOCTTREE_H
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.
Definition SbBox3f.h:37
The SbOctTree class defines a generic oct tree for fast geometry searches.
Definition SbOctTree.h:50
The SbPlane class represents a plane in 3D space.
Definition SbPlane.h:34
The SbSphere class is a representation of a sphere.
Definition SbSphere.h:33
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:40
Definition SbOctTree.h:39

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.