.TH "SbBSPTree" 3 "Tue Dec 26 2023 17:59:22" "Version 4.0.2" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SbBSPTree \- The \fBSbBSPTree\fP class provides a binary space partitioning container\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBSbBSPTree\fP (\fBconst\fP int \fBmaxnodepts\fP=64, \fBconst\fP int \fBinitsize\fP=4)" .br .ti -1c .RI "\fB~SbBSPTree\fP ()" .br .ti -1c .RI "int \fBnumPoints\fP () \fBconst\fP" .br .ti -1c .RI "\fBSbVec3f\fP \fBgetPoint\fP (\fBconst\fP int idx) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBgetPoint\fP (\fBconst\fP int idx, \fBSbVec3f\fP &\fBpt\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP * \fBgetUserData\fP (\fBconst\fP int idx) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBsetUserData\fP (\fBconst\fP int idx, \fBvoid\fP *\fBconst\fP data)" .br .ti -1c .RI "int \fBaddPoint\fP (\fBconst\fP \fBSbVec3f\fP &\fBpt\fP, \fBvoid\fP *\fBconst\fP userdata=\fBNULL\fP)" .br .ti -1c .RI "int \fBremovePoint\fP (\fBconst\fP \fBSbVec3f\fP &\fBpt\fP)" .br .ti -1c .RI "\fBvoid\fP \fBremovePoint\fP (\fBconst\fP int idx)" .br .ti -1c .RI "int \fBfindPoint\fP (\fBconst\fP \fBSbVec3f\fP &pos) \fBconst\fP" .br .ti -1c .RI "int \fBfindClosest\fP (\fBconst\fP \fBSbVec3f\fP &pos) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBclear\fP (\fBconst\fP int \fBinitsize\fP=4)" .br .ti -1c .RI "\fBvoid\fP \fBfindPoints\fP (\fBconst\fP \fBSbSphere\fP &sphere, \fBSbIntList\fP &array) \fBconst\fP" .br .ti -1c .RI "int \fBfindClosest\fP (\fBconst\fP \fBSbSphere\fP &sphere, \fBSbIntList\fP &array) \fBconst\fP" .br .ti -1c .RI "\fBconst\fP \fBSbBox3f\fP & \fBgetBBox\fP () \fBconst\fP" .br .ti -1c .RI "\fBconst\fP \fBSbVec3f\fP * \fBgetPointsArrayPtr\fP () \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBfindPoints\fP (\fBconst\fP \fBSbSphere\fP &sphere, \fBSbList\fP< int > &array) \fBconst\fP" .br .ti -1c .RI "int \fBfindClosest\fP (\fBconst\fP \fBSbSphere\fP &sphere, \fBSbList\fP< int > &array) \fBconst\fP" .br .in -1c .SH "Detailed Description" .PP The \fBSbBSPTree\fP class 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\&. .PP Note: \fBSbBSPTree\fP is an extension to the original Open Inventor API\&. .SH "Constructor & Destructor Documentation" .PP .SS "SbBSPTree::SbBSPTree (\fBconst\fP int maxnodepts = \fC64\fP, \fBconst\fP int initsize = \fC4\fP)" Constructor with \fImaxnodepts\fP specifying the maximum number of points in a node before it must be split, and \fIinitsize\fP is 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 in \fIinitsize\fP\&. .SS "SbBSPTree::~SbBSPTree ()" Destructor\&. Frees used memory\&. .SH "Member Function Documentation" .PP .SS "int SbBSPTree::numPoints () const" Returns the number of points in the BSP tree\&. .SS "\fBSbVec3f\fP SbBSPTree::getPoint (\fBconst\fP int idx) const" Returns the point at index \fIidx\fP\&. .PP \fBSee also\fP .RS 4 \fBSbBSPTree::numPoints()\fP .RE .PP .SS "\fBvoid\fP SbBSPTree::getPoint (\fBconst\fP int idx, \fBSbVec3f\fP & pt) const" This is an overloaded member function, provided for convenience\&. It differs from the above function only in what argument(s) it accepts\&. .SS "\fBvoid\fP * SbBSPTree::getUserData (\fBconst\fP int idx) const" Returns the user data for the point at index \fIidx\fP\&. .PP \fBSee also\fP .RS 4 \fBSbBSPTree::addPoint()\fP .PP \fBSbBSPTree::numPoints()\fP .RE .PP .SS "\fBvoid\fP SbBSPTree::setUserData (\fBconst\fP int idx, \fBvoid\fP *\fBconst\fP data)" Sets the user data for the point at index \fIidx\fP to \fIdata\fP\&. .PP \fBSee also\fP .RS 4 \fBSbBSPTree::addPoint()\fP .PP \fBSbBSPTree::numPoints()\fP .RE .PP .SS "int SbBSPTree::addPoint (\fBconst\fP \fBSbVec3f\fP & pt, \fBvoid\fP *\fBconst\fP data = \fC\fBNULL\fP\fP)" Adds a new point \fIpt\fP to the BSP tree, and returns the index to the new point\&. The user data for that point will be set to \fIdata\fP\&. .PP 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\&. .PP \fBSee also\fP .RS 4 \fBSbBSPTree::findPoint()\fP .RE .PP .SS "int SbBSPTree::removePoint (\fBconst\fP \fBSbVec3f\fP & pt)" Removes the point with coordinates \fIpt\fP, and returns the index to the removed point\&. -1 is returned if no point with those coordinates could be found\&. .SS "\fBvoid\fP SbBSPTree::removePoint (\fBconst\fP int idx)" Removes the point at index \fIidx\fP\&. .PP \fBSee also\fP .RS 4 \fBSbBSPTree::numPoints()\fP .RE .PP .SS "int SbBSPTree::findPoint (\fBconst\fP \fBSbVec3f\fP & pos) const" Will search the tree, and return the index to the point with coordinates matching \fIpos\fP\&. If no such point can be found, -1 is returned\&. .SS "int SbBSPTree::findClosest (\fBconst\fP \fBSbVec3f\fP & pos) const" This is an overloaded member function, provided for convenience\&. It differs from the above function only in what argument(s) it accepts\&. .SS "\fBvoid\fP SbBSPTree::clear (\fBconst\fP int initsize = \fC4\fP)" Will empty all points from the BSP tree\&. .SS "\fBvoid\fP SbBSPTree::findPoints (\fBconst\fP \fBSbSphere\fP & sphere, \fBSbIntList\fP & array) const" Will return indices to all points inside \fIsphere\fP\&. .PP \fBSince\fP .RS 4 Coin \fB2\&.3\fP .RE .PP .SS "int SbBSPTree::findClosest (\fBconst\fP \fBSbSphere\fP & sphere, \fBSbIntList\fP & arr) const" Will return the index to the point closest to the center of \fIsphere\fP\&. Indices to all points inside the sphere is returned in \fIarr\fP\&. If no points can be found inside the sphere, -1 is returned\&. .PP \fBSince\fP .RS 4 Coin \fB2\&.3\fP .RE .PP .SS "\fBconst\fP \fBSbBox3f\fP & SbBSPTree::getBBox () const" Will return the bounding box of all points in the BSP tree\&. .SS "\fBconst\fP \fBSbVec3f\fP * SbBSPTree::getPointsArrayPtr (\fBvoid\fP) const" Returns a pointer to the array of points inserted into the BPS tree\&. .SS "\fBvoid\fP SbBSPTree::findPoints (\fBconst\fP \fBSbSphere\fP & sphere, \fBSbList\fP< int > & array) const" WARNING: 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\&. .PP Use void findPoints(const SbSphere &sphere, SbIntList & array) instead\&. .SS "int SbBSPTree::findClosest (\fBconst\fP \fBSbSphere\fP & sphere, \fBSbList\fP< int > & arr) const" WARNING: 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\&. .PP Use int findClosest(const SbSphere &sphere, SbIntList & arr) instead\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.