SbBSPTree(3)
π SbBSPTree π
okay bestie, sit down, hydrate, because we're about to talk about SbBSPTree β the class that hands you a binary space partitioning container and honestly? it's giving organized. it's giving spatially aware. no cap.
this page lives in the Library Functions Manual section (that's the (3) in SbBSPTree(3), iykyk), so it's a C++ class, not a command you type into your shell. just so we're clear π«Ά
β¨ NAME β¨
SbBSPTree β the SbBSPTree class provides a binary space partitioning container.
πΈ SYNOPSIS πΈ
#include <Inventor/SbBSPTree.h>
π Public Member Functions π
here's the whole roster, every single one, no skips:
SbBSPTree (const int maxnodepts=64, const int initsize=4)~SbBSPTree ()int numPoints () constSbVec3f getPoint (const int idx) constvoid getPoint (const int idx, SbVec3f &pt) constvoid * getUserData (const int idx) constvoid setUserData (const int idx, void *const data)int addPoint (const SbVec3f &pt, void *const userdata=NULL)int removePoint (const SbVec3f &pt)void removePoint (const int idx)int findPoint (const SbVec3f &pos) constint findClosest (const SbVec3f &pos) constvoid clear (const int initsize=4)void findPoints (const SbSphere &sphere, SbIntList &array) constint findClosest (const SbSphere &sphere, SbIntList &array) constconst SbBox3f & getBBox () constconst SbVec3f * getPointsArrayPtr () constvoid findPoints (const SbSphere &sphere, SbList< int > &array) constint findClosest (const SbSphere &sphere, SbList< int > &array) const
π Detailed Description π
The SbBSPTree class provides a binary space partitioning container. yes, that's the same sentence as the NAME section, she's consistent, we love her for it π
here's the actual tea though: this class can be used to organize searches for 3D points or normals in a set in O(log(n)) time. log-n. logarithmic. she's fast. she's efficient. she ate. π₯
Note: SbBSPTree is an extension to the original Open Inventor API. so if you were like "hmm I don't remember this from the original" β correct, you don't, bestie, it's a Coin thing β¨
π¦ Constructor & Destructor Documentation π¦
SbBSPTree::SbBSPTree (const int maxnodepts = 64, const int initsize = 4)
Constructor time, babes π here's the deal:
maxnodeptsβ the maximum number of points in a node before it must be split. that's the whole point of the tree, she splits when she's full, main character energy.initsizeβ the number of initially allocated points in the growable points array.
and lowkey a pro tip from the manpage itself: if you already know approximately how many points you're gonna add to the tree, supply that in initsize, because it helps the performance. do your future self a favor fr fr π
SbBSPTree::~SbBSPTree ()
Destructor. Frees used memory. that's it, that's the vibe, she cleans up after herself, iconic π§Ήβ¨
π Member Function Documentation π
int SbBSPTree::numPoints () const
Returns the number of points in the BSP tree. how many besties are in the tree, basically π
SbVec3f SbBSPTree::getPoint (const int idx) const
Returns the point at index idx.
See also: SbBSPTree::numPoints()
void SbBSPTree::getPoint (const int idx, SbVec3f & pt) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. same girl, different fit π
void * SbBSPTree::getUserData (const int idx) const
Returns the user data for the point at index idx.
See also: SbBSPTree::addPoint(), SbBSPTree::numPoints()
void SbBSPTree::setUserData (const int idx, void *const data)
Sets the user data for the point at index idx to data.
See also: SbBSPTree::addPoint(), SbBSPTree::numPoints()
int SbBSPTree::addPoint (const SbVec3f & pt, void *const data = NULL)
Adds a new point pt to the BSP tree, and returns the index to the new point. The user data for that point will be set to data.
BUT WAIT β if the point already exists in the BSP tree, the index to the old point will be returned. and the user data for that point will not be changed. so don't come in expecting your new data to overwrite anything, she said no π
See also: SbBSPTree::findPoint()
int SbBSPTree::removePoint (const SbVec3f & pt)
Removes the point with coordinates pt, and returns the index to the removed point. and if no point with those coordinates could be found? you get -1. the classic "girl, she's not here" π
void SbBSPTree::removePoint (const int idx)
Removes the point at index idx.
See also: SbBSPTree::numPoints()
int SbBSPTree::findPoint (const SbVec3f & pos) const
Will search the tree, and return the index to the point with coordinates matching pos. If no such point can be found, -1 is returned. (again with the -1, she's consistent π«Ά)
int SbBSPTree::findClosest (const SbVec3f & pos) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. same energy, different signature β¨
void SbBSPTree::clear (const int initsize = 4)
Will empty all points from the BSP tree. full reset. factory settings. clean slate πΈ
void SbBSPTree::findPoints (const SbSphere & sphere, SbIntList & array) const
Will return indices to all points inside sphere.
Since: Coin 2.3
int SbBSPTree::findClosest (const SbSphere & sphere, SbIntList & arr) const
Will return the index to the point closest to the center of sphere. Indices to all points inside the sphere is returned in arr. And if no points can be found inside the sphere, -1 is returned. (you knew it was coming π)
Since: Coin 2.3
const SbBox3f & SbBSPTree::getBBox () const
Will return the bounding box of all points in the BSP tree. the little box that contains every single point, so cute, so organized π¦π
const SbVec3f * SbBSPTree::getPointsArrayPtr (void ) const
Returns a pointer to the array of points inserted into the BPS tree. (yes, it says BPS in the original, we're keeping it exactly as written, no editing bestie π)
void SbBSPTree::findPoints (const SbSphere & sphere, SbList< 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.
Use void findPoints(const SbSphere &sphere, SbIntList & array) instead. seriously, use the other one, this one is a trap π©
int SbBSPTree::findClosest (const SbSphere & sphere, SbList< 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.
Use int findClosest(const SbSphere &sphere, SbIntList & arr) instead. same warning, same escape hatch, go use the SbIntList version π
π Author π
Generated automatically by Doxygen for Coin from the source code. so technically the author is a robot and the source code, which is honestly so valid of them π€β¨
and that's the whole page bestie!! you read all of it, I'm so proud, you ate that π
Coin β Version 3.1.3 β and the date is stamped on the page as SbBSPTree(3), so there you go. mwah, go build something spatially partitioned π π¦
π¦ where this page comes from
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms