SbClip(3)
π SbClip(3) β the polygon clipper bestie π
okay so you found the SbClip page in the Library Functions Manual, and honestly? you're about to have a great time. this is the class that clips polygons for you and it's giving main character energy. let's go β¨
πΈ NAME πΈ
SbClip β the SbClip class is a generic polygon clipper class. periodt.
β¨ SYNOPSIS β¨
#include <include/Inventor/base/SbClip.h>
π Public Member Functions
SbClip (SbClipCallback *callback=NULL, void *userdata=NULL)
void addVertex (const SbVec3f &v, void *vdata=NULL)
void reset (void)
void clip (const SbPlane &plane)
int getNumVertices (void) const
void getVertex (const int idx, SbVec3f &v, void **vdata=NULL) const
void * getVertexData (const int idx) const
π¦ Detailed Description π¦
so, the tea: the SbClip class is a generic polygon clipper class. π
here's the whole flow, no cap. you use it by first adding all vertices in the polygon, and then clipping against any number of planes. that's it. that's the vibe.
now, if you need to carry extra info per vertex (think texture coordinates, you know the drill), you should supply a callback in the constructor, and then a pointer to your vertex structure in addVertex(). π«Ά
and here's the part where it gets iconic: for every new vertex created, the callback is called with the line being clipped β including the pointers to your vertex structures AND the position of the new (clipped against some plane) vertex. so then you create a new vertex structure, calculate your data (like a fresh new texture coordinate π) and return a pointer to this structure. that's your whole job. slay.
β οΈ heads up bestie: be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. so don't come looking for it there, she's not home. π
Since
Coin 2.0 β
π Constructor & Destructor Documentation π
SbClip::SbClip (SbClipCallback * callback = NULL, void * userdata = NULL)
a constructor. supply a callback if you need to handle additional data per vertex. that's the whole thing, iykyk. π
π Member Function Documentation π
void SbClip::addVertex (const SbVec3f & v, void * vdata = NULL)
adds a polygon vertex. vdata could be a pointer to your vertex structure. easy. πΈ
void SbClip::reset (void )
resets the clipper. you should call this before adding any vertices when reusing an SbClip instance β like, do it, don't skip it. π
void SbClip::clip (const SbPlane & plane)
clip polygon against plane. ngl this might change the number of vertices in the polygon, so don't be shocked.
for each time a new vertex is created, the callback supplied in the constructor (if != NULL) is called with the line being clipped and the new vertex calculated. the callback should return a new void pointer to be stored by the clipper. that's the deal. π₯
int SbClip::getNumVertices (void ) const
returns the number of vertices in the polygon. π«
See also
SbClip::getVertex()
void SbClip::getVertex (const int idx, SbVec3f & v, void ** vdata = NULL) const
returns the vertex at index idx. π―
See also
SbClip::getNumVertices()
void * SbClip::getVertexData (const int idx) const
return the vertex data at index idx. that's it, go off. π
π Author π
generated automatically by Doxygen for Coin from the source code. (not a human, just a robot doing its little thing π€β¨)
and that's the page, bestie!! π«Ά this was Coin, Version 3.1.3, and yeah β SbClip(3), we love her, we stan, bye!! πππ¦
π¦ 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