SbBSPTree(3)

πŸ“¦ version 2.5.0, in fedora 43, fedora 44

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

okay so bestie, welcome to the Library Functions Manual ✨ this is the SbBSPTree(3) page and it is literally about to change your whole spatial-query life. grab a snack πŸ“


🌸 NAME 🌸

SbBSPTree β€” the SbBSPTree class provides a binary space partitioning container.


✨ SYNOPSIS ✨

#include <Inventor/SbBSPTree.h>

πŸŽ€ Public Member Functions πŸŽ€

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

πŸ¦‹ Friends πŸ¦‹

class coin_bspnode

πŸ‘‘ Detailed Description πŸ‘‘

The SbBSPTree 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. no cap, that's the whole glow-up. πŸ’…

Note: SbBSPTree is an extension to the original Open Inventor API.

🧚 Constructor & Destructor Documentation 🧚

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

Constructor, bestie πŸ’– β€” maxnodepts tells it the maximum number of points a node can hold before it must split, and initsize is the number of initially allocated points in the growable points array. If you already have a vibe for roughly how many points are gonna get added to the tree, passing that number in initsize will help the performance. do it, it's free real estate. ✨

🌟 SbBSPTree::~SbBSPTree () 🌟

Destructor. Frees used memory. bye bye, clean up after yourself queen 🫢


πŸ’… Member Function Documentation πŸ’…

int SbBSPTree::numPoints () const

Returns the number of points in the BSP tree. the headcount, periodt. πŸ‘‘

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 energy, different door πŸšͺ✨

void * SbBSPTree::getUserData (const int idx) const

Returns the user data for the point at index idx. it's giving "your stuff, back to you". πŸ’–

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.

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. (so don't come in expecting it to get overwritten, bestie, it will not. 🫠)

See also: SbBSPTree::findPoint()

int SbBSPTree::removePoint (const SbVec3f & pt)

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

Referenced by removePoint().

void SbBSPTree::removePoint (const int idx)

Removes the point at index idx.

See also: SbBSPTree::numPoints()

References removePoint().

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. πŸ’€ (respectfully)

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.

References findClosest(), SbVec3f::length(), SbSphere::setRadius(), and SbList< Type >::truncate().

Referenced by findClosest().

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

Will empty all points from the BSP tree. total reset, main character era 🌈

void SbBSPTree::findPoints (const SbSphere & sphere, SbIntList & array) const

Will return indices to all points inside sphere.

Since: Coin 2.3

Referenced by findClosest(), and findClosest().

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

Since: Coin 2.3

References findPoints(), SbSphere::getCenter(), and SbPList::getLength().

const SbBox3f & SbBSPTree::getBBox () const

Will return the bounding box of all points in the BSP tree. the whole vibe, boxed. πŸ“¦βœ¨

const SbVec3f * SbBSPTree::getPointsArrayPtr (void ) const

Returns a pointer to the array of points inserted into the BPS tree.

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 am 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. same warning, same please-don't. 😭

References findPoints(), SbSphere::getCenter(), and SbList< Type >::getLength().


🌸 Author 🌸

Generated automatically by Doxygen for Coin from the source code. (so if the prose is a little stiff in places, that's why β€” not me though, I'm thriving πŸ’–)


and that's the whole page, bestie!! ✨ this manual page came to you from Coin, Version 2.5.0 β€” generated automatically by Doxygen for Coin from the source code, and lovingly yelled at you in group-chat format. mwah πŸ’…πŸ«Ά go build something iconic with your BSP tree, ily, bye!! πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from