SbClip(3)

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

πŸ’– SbClip(3) πŸ’–

Library Functions Manual ✨ yes bestie, we're in section 3, the library functions section, and today's main character is SbClip.


🌸 NAME 🌸

SbClip β€” the SbClip class is a generic polygon clipper class. that's it. that's the whole vibe. a generic polygon clipper. slay. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so first you gotta let the compiler know you want in:

#include <include/Inventor/base/SbClip.h>

⭐ Public Member Functions ⭐

here's the whole cast of characters, no cap:

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 🌈

okay so SbClip is a generic polygon clipper class, fr fr. that's literally what it is.

here's how you actually use it, bestie, listen up: you first add all the vertices in the polygon, and then you clip against any number of planes. that's the flow. 🫢

now, if you need to carry extra info per vertex (think texture coordinates, the little details that make the fit iconic ✨), you should supply a callback in the constructor, and then a pointer to your own vertex structure in addVertex().

for every new vertex that gets created, the callback is called with the line being clipped, including the pointers to your vertex structures and the position of the new vertex (the one clipped against some plane). your job then: create a new vertex structure, calculate your data (like a brand new texture coordinate πŸŽ€), and return a pointer to that structure. easy. iconic. periodt.

⚠️ okay important heads up: 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 go looking for it there, you will not find it πŸ’€

Since

Coin 2.0 πŸ‘‘


πŸŽ€ Constructor & Destructor Documentation πŸŽ€

πŸ’œ SbClip::SbClip (SbClipCallback * callback = NULL, void * userdata = NULL)

A constructor, obviously. πŸ’… supply a callback if you need to handle additional data per vertex β€” that's the whole reason it's there, bestie.


✨ 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. that's the tea. β˜•

🧚 void SbClip::reset (void )

Resets the clipper. you should call this before adding any vertices when you're reusing an SbClip instance β€” like, do not skip this step, it's giving fresh start energy 🌱

πŸ”₯ void SbClip::clip (const SbPlane & plane)

Clip polygon against plane. this might change the number of vertices in the polygon, just so you're not surprised. πŸ‘€

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.

References SbVec3f::dot(), SbPlane::getDistance(), SbPlane::getNormal(), and SbVec3f::normalize().

⭐ int SbClip::getNumVertices (void ) const

Returns the number of vertices in the polygon. that's it, that's the function. πŸ’«

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. the extra little something you attached. πŸŽ€


πŸ’Œ Author πŸ’Œ

Generated automatically by Doxygen for Coin from the source code. (not a human, not a bestie, just doxygen doing its thing πŸ€–)


and that's the whole page, babes!! this manual came from Coin, Version 2.5.0, and the page you just read is SbClip(3) β€” mwah, take care of her πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from