Provided by: libcoin80-doc_3.1.4~abc9f50-4ubuntu2_all

**NAME**

SbBSPTree - TheSbBSPTreeclass provides a binary space partitioning container. This class can be used to organize searches for 3D points or normals in a set in O(log(n)) time.

**SYNOPSIS**

#include <Inventor/SbBSPTree.h>PublicMemberFunctionsSbBSPTree(const int maxnodepts=64, const int initsize=4)~SbBSPTree() intnumPoints() constSbVec3fgetPoint(const int idx) const voidgetPoint(const int idx,SbVec3f&pt) const void *getUserData(const int idx) const voidsetUserData(const int idx, void *const data) intaddPoint(constSbVec3f&pt, void *const userdata=NULL) intremovePoint(constSbVec3f&pt) voidremovePoint(const int idx) intfindPoint(constSbVec3f&pos) const intfindClosest(constSbVec3f&pos) const voidclear(const int initsize=4) voidfindPoints(constSbSphere&sphere,SbIntList&array) const intfindClosest(constSbSphere&sphere,SbIntList&array) const constSbBox3f&getBBox() const constSbVec3f*getPointsArrayPtr() const voidfindPoints(constSbSphere&sphere,SbList< int > &array) const intfindClosest(constSbSphere&sphere,SbList< int > &array) const

**Detailed** **Description**

TheSbBSPTreeclass provides a binary space partitioning container. This class can be used to organize searches for 3D points or normals in a set in O(log(n)) time. Note:SbBSPTreeis an extension to the original Open Inventor API.

**Constructor** **&** **Destructor** **Documentation**

SbBSPTree::SbBSPTree(constintmaxnodepts=64,constintinitsize=4)Constructor withmaxnodeptsspecifying the maximum number of points in a node before it must be split, andinitsizeis the number of initially allocated points in the growable points array. If you know approximately the number of points which will be added to the tree, it will help the performance if you supply this ininitsize.SbBSPTree::~SbBSPTree()Destructor. Frees used memory.

**Member** **Function** **Documentation**

intSbBSPTree::numPoints()constReturns the number of points in the BSP tree.SbVec3fSbBSPTree::getPoint(constintidx)constReturns the point at indexidx.SeeAlso:SbBSPTree::numPoints()voidSbBSPTree::getPoint(constintidx,SbVec3f&pt)constThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.void*SbBSPTree::getUserData(constintidx)constReturns the user data for the point at indexidx.SeeAlso:SbBSPTree::addPoint()SbBSPTree::numPoints()voidSbBSPTree::setUserData(constintidx,void*constdata)Sets the user data for the point at indexidxtodata.SeeAlso:SbBSPTree::addPoint()SbBSPTree::numPoints()intSbBSPTree::addPoint(constSbVec3f&pt,void*constdata=NULL)Adds a new pointptto the BSP tree, and returns the index to the new point. The user data for that point will be set todata. If the point already exists in the BSP tree, the index to the old point will be returned. The user data for that point will not be changed.SeeAlso:SbBSPTree::findPoint()intSbBSPTree::removePoint(constSbVec3f&pt)Removes the point with coordinatespt, and returns the index to the removed point. -1 is returned if no point with those coordinates could be found.voidSbBSPTree::removePoint(constintidx)Removes the point at indexidx.SeeAlso:SbBSPTree::numPoints()intSbBSPTree::findPoint(constSbVec3f&pos)constWill search the tree, and return the index to the point with coordinates matchingpos. If no such point can be found, -1 is returned.intSbBSPTree::findClosest(constSbVec3f&pos)constThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.voidSbBSPTree::clear(constintinitsize=4)Will empty all points from the BSP tree.voidSbBSPTree::findPoints(constSbSphere&sphere,SbIntList&array)constWill return indices to all points insidesphere.Since:Coin 2.3intSbBSPTree::findClosest(constSbSphere&sphere,SbIntList&arr)constWill return the index to the point closest to the center ofsphere. Indices to all points inside the sphere is returned inarr. If no points can be found inside the sphere, -1 is returned.Since:Coin 2.3constSbBox3f&SbBSPTree::getBBox()constWill return the bounding box of all points in the BSP tree.constSbVec3f*SbBSPTree::getPointsArrayPtr(void)constReturns a pointer to the array of points inserted into the BPS tree.voidSbBSPTree::findPoints(constSbSphere&sphere,SbList<int>&array)constWARNING: Please don't use this function. It can cause hard to find bugs on the Windows platform if your application is linked against a different CRT than your Coin DLL. Use void findPoints(const SbSphere &sphere, SbIntList & array) instead.intSbBSPTree::findClosest(constSbSphere&sphere,SbList<int>&arr)constWARNING: Please don't use this function. It can cause hard to find bugs on the Windows platform if your application is linked against a different CRT than your Coin DLL. Use int findClosest(const SbSphere &sphere, SbIntList & arr) instead.

**Author**

Generated automatically by Doxygen for Coin from the source code.