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

SbBSPTree.h
1 #ifndef COIN_SBBSPTREE_H
2 #define COIN_SBBSPTREE_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
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 Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <stddef.h> // for NULL definition
28 #include <Inventor/lists/SbList.h>
29 #include <Inventor/SbVec3f.h>
30 #include <Inventor/SbBox3f.h>
31 
32 #ifdef COIN_INTERNAL
33  #define COIN_ALLOW_SBINTLIST
34  #include <Inventor/lists/SbIntList.h>
35  #undef COIN_ALLOW_SBINTLIST
36 #else
37  #include <Inventor/lists/SbIntList.h>
38 #endif // COIN_INTERNAL
39 
40 class SbSphere;
41 class coin_bspnode;
42 
43 // *************************************************************************
44 
45 class COIN_DLL_API SbBSPTree {
46 public:
47  SbBSPTree(const int maxnodepts = 64, const int initsize = 4);
48  ~SbBSPTree();
49 
50  int numPoints() const;
51  SbVec3f getPoint(const int idx) const;
52  void getPoint(const int idx, SbVec3f & pt) const;
53  void * getUserData(const int idx) const;
54  void setUserData(const int idx, void * const data);
55 
56  int addPoint(const SbVec3f & pt, void * const userdata = NULL);
57  int removePoint(const SbVec3f & pt);
58  void removePoint(const int idx);
59  int findPoint(const SbVec3f & pos) const;
60  int findClosest(const SbVec3f & pos) const;
61  void clear(const int initsize = 4);
62  void findPoints(const SbSphere & sphere, SbIntList & array) const;
63  int findClosest(const SbSphere & sphere, SbIntList & array) const;
64 
65  const SbBox3f & getBBox() const;
66  const SbVec3f * getPointsArrayPtr() const;
67 
68  // Please stop using these two functions. They will be removed in
69  // Coin 3.0. Use the SbIntList versions instead.
70  void findPoints(const SbSphere & sphere, SbList <int> & array) const;
71  int findClosest(const SbSphere & sphere, SbList <int> & array) const;
72 
73 private:
74  friend class coin_bspnode;
75  SbList <SbVec3f> pointsArray;
76  SbList <void *> userdataArray;
77  coin_bspnode * topnode;
78  int maxnodepoints;
79  SbBox3f boundingBox;
80 };
81 
82 #endif // !COIN_SBBSPTREE_H
SbPList::getLength
int getLength(void) const
Definition: SbPList.h:94
SbBSPTree::setUserData
void setUserData(const int idx, void *const data)
Definition: SbBSPTree.cpp:409
SbIntList::append
void append(const int item)
Definition: SbIntList.h:36
SbList::getArrayPtr
const Type * getArrayPtr(const int start=0) const
Definition: SbList.h:168
SbIntList
The SbIntList class is a container for integer list arrays.
Definition: SbIntList.h:31
SbSphere::getRadius
float getRadius(void) const
Definition: SbSphere.cpp:125
SbBSPTree::SbBSPTree
SbBSPTree(const int maxnodepts=64, const int initsize=4)
Definition: SbBSPTree.cpp:345
SbSphere::setRadius
void setRadius(const float radius)
Definition: SbSphere.cpp:98
SbList::truncate
void truncate(const int length, const int dofit=0)
Definition: SbList.h:149
SbBSPTree::addPoint
int addPoint(const SbVec3f &pt, void *const userdata=NULL)
Definition: SbBSPTree.cpp:426
SbBox3f::getMin
const SbVec3f & getMin(void) const
Definition: SbBox3f.cpp:122
SbBox3f
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.
Definition: SbBox3f.h:37
SbSphere::pointInside
SbBool pointInside(const SbVec3f &p) const
Definition: SbSphere.cpp:237
SbBSPTree::numPoints
int numPoints() const
Definition: SbBSPTree.cpp:365
SbBSPTree::getPointsArrayPtr
const SbVec3f * getPointsArrayPtr() const
Definition: SbBSPTree.cpp:543
SbList::append
void append(const Type item)
Definition: SbList.h:98
SbVec3f::length
float length(void) const
Definition: SbVec3f.cpp:356
SbList< SbVec3f >
SbBox3f::getMax
const SbVec3f & getMax(void) const
Definition: SbBox3f.cpp:134
SbBox3f::makeEmpty
void makeEmpty(void)
Definition: SbBox3f.cpp:424
SbSphere
The SbSphere class is a representation of a sphere.
Definition: SbSphere.h:33
SbList::getLength
int getLength(void) const
Definition: SbList.h:145
SbBSPTree
The SbBSPTree class provides a binary space partitioning container.
Definition: SbBSPTree.h:45
SbBSPTree::~SbBSPTree
~SbBSPTree()
Definition: SbBSPTree.cpp:356
SbBSPTree::getBBox
const SbBox3f & getBBox() const
Definition: SbBSPTree.cpp:487
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:37
SbBSPTree::clear
void clear(const int initsize=4)
Definition: SbBSPTree.cpp:473
SbSphere::getCenter
const SbVec3f & getCenter(void) const
Definition: SbSphere.cpp:114
SbBSPTree::removePoint
int removePoint(const SbVec3f &pt)
Definition: SbBSPTree.cpp:442
SbBSPTree::findPoints
void findPoints(const SbSphere &sphere, SbIntList &array) const
Definition: SbBSPTree.cpp:554
SbBSPTree::findClosest
int findClosest(const SbVec3f &pos) const
Definition: SbBSPTree.cpp:496
SbBox3f::extendBy
void extendBy(const SbVec3f &point)
Definition: SbBox3f.cpp:178
SbBSPTree::getPoint
SbVec3f getPoint(const int idx) const
Definition: SbBSPTree.cpp:375
SbBSPTree::getUserData
void * getUserData(const int idx) const
Definition: SbBSPTree.cpp:397
SbBSPTree::findPoint
int findPoint(const SbVec3f &pos) const
Definition: SbBSPTree.cpp:464

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Jul 27 2020 for Coin by Doxygen. 1.8.18