Provided by: libcoin60-doc_3.1.3-2_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)Constructorwithmaxnodeptsspecifyingthemaximumnumberofpointsinanodebeforeitmustbesplit,andinitsizeisthenumberofinitiallyallocatedpointsinthegrowablepointsarray.Ifyouknowapproximatelythenumberofpointswhichwillbeaddedtothetree,itwillhelptheperformanceifyousupplythisininitsize.SbBSPTree::~SbBSPTree()Destructor.Freesusedmemory.

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

intSbBSPTree::numPoints()constReturnsthenumberofpointsintheBSPtree.SbVec3fSbBSPTree::getPoint(constintidx)constReturnsthepointatindexidx.Seealso:SbBSPTree::numPoints()voidSbBSPTree::getPoint(constintidx,SbVec3f&pt)constThisisanoverloadedmemberfunction,providedforconvenience.Itdiffersfromtheabovefunctiononlyinwhatargument(s)itaccepts.void*SbBSPTree::getUserData(constintidx)constReturnstheuserdataforthepointatindexidx.Seealso:SbBSPTree::addPoint()SbBSPTree::numPoints()voidSbBSPTree::setUserData(constintidx,void*constdata)Setstheuserdataforthepointatindexidxtodata.Seealso:SbBSPTree::addPoint()SbBSPTree::numPoints()intSbBSPTree::addPoint(constSbVec3f&pt,void*constdata=NULL)AddsanewpointpttotheBSPtree,andreturnstheindextothenewpoint.Theuserdataforthatpointwillbesettodata.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)Removesthepointwithcoordinatespt,andreturnstheindextotheremovedpoint.-1isreturnedifnopointwiththosecoordinatescouldbefound.voidSbBSPTree::removePoint(constintidx)Removesthepointatindexidx.Seealso:SbBSPTree::numPoints()intSbBSPTree::findPoint(constSbVec3f&pos)constWillsearchthetree,andreturntheindextothepointwithcoordinatesmatchingpos.Ifnosuchpointcanbefound,-1isreturned.intSbBSPTree::findClosest(constSbVec3f&pos)constThisisanoverloadedmemberfunction,providedforconvenience.Itdiffersfromtheabovefunctiononlyinwhatargument(s)itaccepts.voidSbBSPTree::findPoints(constSbSphere&sphere,SbIntList&array)constWillreturnindicestoallpointsinsidesphere.Since:Coin 2.3intSbBSPTree::findClosest(constSbSphere&sphere,SbIntList&arr)constWillreturntheindextothepointclosesttothecenterofsphere.Indicestoallpointsinsidethesphereisreturnedinarr.Ifnopointscanbefoundinsidethesphere,-1isreturned.Since:Coin 2.3constSbBox3f&SbBSPTree::getBBox()constWillreturntheboundingboxofallpointsintheBSPtree.constSbVec3f*SbBSPTree::getPointsArrayPtr(void)constReturnsapointertothearrayofpointsinsertedintotheBPStree.voidSbBSPTree::findPoints(constSbSphere&sphere,SbList<int>&array)constWARNING:Pleasedon'tusethisfunction.ItcancausehardtofindbugsontheWindowsplatformifyourapplicationislinkedagainstadifferentCRTthanyourCoinDLL.Use void findPoints(const SbSphere &sphere, SbIntList & array) instead.intSbBSPTree::findClosest(constSbSphere&sphere,SbList<int>&arr)constWARNING:Pleasedon'tusethisfunction.ItcancausehardtofindbugsontheWindowsplatformifyourapplicationislinkedagainstadifferentCRTthanyourCoinDLL.Use int findClosest(const SbSphere &sphere, SbIntList & arr) instead.

**Author**

Generated automatically by Doxygen for Coin from the source code.