SbBSPTree(3)

πŸ“¦
version 4.0.10 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– SbBSPTree(3) πŸ’–

okay bestie, sit down, hydrate, and let me tell you about SbBSPTree from the Coin manual, page 3. it's giving spatial data structures, it's giving O(log(n)) slay, it's giving binary space partitioning container. yes queen. πŸ’…


✨ NAME ✨

SbBSPTree β€” the class that literally provides a binary space partitioning container. that's it. that's the vibe. 🌸


✨ SYNOPSIS ✨

first things first, you gotta invite it in:

#include <Inventor/SbBSPTree.h>

πŸŽ€ Public Member Functions πŸŽ€

here's the whole friend group, in order, no cap:

SbBSPTree (const int maxnodepts=64, const int initsize=4)
~SbBSPTree ()
int numPoints () const
SbVec3f getPoint (const int idx) const
void getPoint (const int idx, SbVec3f &pt) const
void * getUserData (const int idx) const
void 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) const
int findClosest (const SbVec3f &pos) const
void clear (const int initsize=4)
void findPoints (const SbSphere &sphere, SbIntList &array) const
int findClosest (const SbSphere &sphere, SbIntList &array) const
const SbBox3f & getBBox () const
const SbVec3f * getPointsArrayPtr () const
void findPoints (const SbSphere &sphere, SbList< int > &array) const
int findClosest (const SbSphere &sphere, SbList< int > &array) const

🌈 Detailed Description 🌈

SbBSPTree is the class that provides a binary space partitioning container. iconic behavior honestly.

so what does it actually do? it organizes your searches for 3D points or normals in a set in O(log(n)) time. that's the whole point. fast lookups, no scrolling, no crying. ✨

Note: SbBSPTree is an extension to the original Open Inventor API. so like, it's a Coin bonus, a little extra sprinkle. 🧚

πŸ¦‹ Constructor & Destructor Documentation πŸ¦‹

SbBSPTree::SbBSPTree (const int maxnodepts = 64, const int initsize = 4)

the constructor, aka the glow-up moment. ✨

  • maxnodepts β€” the max number of points a node can hold before it must split. default is 64.
  • initsize β€” how many points get allocated initially in the growable points array. default is 4.

and bestie, listen: if you know roughly how many points you're gonna throw into this tree, pass it in initsize. it helps the performance. fr fr. do it for your future self. 🫢

SbBSPTree::~SbBSPTree ()

the destructor. frees the used memory. clean up after yourself, we love a tidy queen. πŸ’…


πŸ‘‘ Member Function Documentation πŸ‘‘

int SbBSPTree::numPoints () const

returns the number of points in the BSP tree. simple. elegant. we stan. πŸ’–

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

okay so this is an overloaded member function, provided for convenience. it differs from the function above only in what argument(s) it accepts. same energy, different signature. πŸŽ€

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 gets set to data.

heads up though: if the point already exists in the BSP tree, the index to the old point gets returned instead β€” and the user data for that point will not be changed. no overwriting, no drama. πŸ™ˆ

See also: SbBSPTree::findPoint()

int SbBSPTree::removePoint (const SbVec3f & pt)

removes the point with coordinates pt, and returns the index to the removed point. if no point with those coordinates could be found, -1 is returned. sad girl hours. 😭

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.

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. ✨

void SbBSPTree::clear (const int initsize = 4)

will empty all points from the BSP tree. total reset, fresh start, main character energy. 🌈

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 get returned in arr. if no points can be found inside the sphere, -1 is returned.

Since: Coin 2.3

const SbBox3f & SbBSPTree::getBBox () const

will return the bounding box of all points in the BSP tree. it's giving organized. it's giving contained. πŸ“¦βœ¨

const SbVec3f * SbBSPTree::getPointsArrayPtr (void ) const

returns a pointer to the array of points inserted into the BPS tree. (yes, the original says BPS. we don't question the ancestors, we just report faithfully. πŸ’€)

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. bestie, I'm begging you. πŸ™

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. periodt. πŸŽ€


🌸 Author 🌸

generated automatically by Doxygen for Coin from the source code. not me being a bot-authored baddie. πŸ€–πŸ’…


and that's the whole page, bestie!! 🫢 this was Version 4.0.10, dated Thu Jun 25 2026 00:00:00, and it's the SbBSPTree(3) manual page β€” so go forth, partition that binary space, and stay iconic. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from