GLUBEGINTRIM(3G)
β¨ GLUBEGINTRIM πβ¨
okay so bestie, we're in the 3G manual today and we're talking about gluBeginTrim, gluEndTrim β the iconic duo that delimit a NURBS trimming loop definition. yes it's giving niche OpenGL Utility Library, yes you're gonna slay it, let's go π¦
πΈ NAME πΈ
gluBeginTrim, gluEndTrim β delimit a NURBS trimming loop definition π
π C SPECIFICATION π
void gluBeginTrim( GLUnurbs* nurb )
void gluEndTrim( GLUnurbs* nurb )
like, that's it. two little void functions. no return value. they just exist and they're perfect β¨
π«Ά PARAMETERS π«Ά
nurbβ Specifies the NURBS object (created withgluNewNurbsRenderer).
that's your whole parameter list babe, one singular NURBS object, and yes it has to come from gluNewNurbsRenderer or it's not it π
π DESCRIPTION π
So here's the tea, bestie. You use gluBeginTrim to mark the beginning of a trimming loop, and gluEndTrim to mark the end of a trimming loop. A trimming loop is a set of oriented curve segments (forming a closed curve) that define boundaries of a NURBS surface. You tuck these trimming loops into the definition of a NURBS surface, between calls to gluBeginSurface and gluEndSurface. it's giving nesting dolls, it's giving structure, we love to see it π
The definition for a NURBS surface can contain many trimming loops. For example, if you wrote a definition for a NURBS surface that resembled a rectangle with a hole punched out, the definition would contain two trimming loops. One loop would define the outer edge of the rectangle; the other would define the hole punched out of the rectangle. And the definitions of each of these trimming loops would be bracketed by a gluBeginTrim/gluEndTrim pair. two pairs, two loops, one rectangle with a hole. the math is mathing π
The definition of a single closed trimming loop can consist of multiple curve segments, each described as a piecewise linear curve (see gluPwlCurve) or as a single NURBS curve (see gluNurbsCurve), or as a combination of both in any order. okay and this part is important so listen up: the only library calls that can appear in a trimming loop definition (between the calls to gluBeginTrim and gluEndTrim) are gluPwlCurve and gluNurbsCurve. that's the whole guest list. no plus-ones. π«
lowkey the strictest bouncer in the GLU club and it's just two functions.
The area of the NURBS surface that is displayed is the region in the domain to the left of the trimming curve as the curve parameter increases. Thus, the retained region of the NURBS surface is inside a counterclockwise trimming loop and outside a clockwise trimming loop. For the rectangle mentioned earlier, the trimming loop for the outer edge of the rectangle runs counterclockwise, while the trimming loop for the punched-out hole runs clockwise. orientation is literally the whole personality here π
If you use more than one curve to define a single trimming loop, the curve segments must form a closed loop (that is, the endpoint of each curve must be the starting point of the next curve, and the endpoint of the final curve must be the starting point of the first curve). If the endpoints of the curve are sufficiently close together but not exactly coincident, they will be coerced to match. If the endpoints are not sufficiently close, an error results (see gluNurbsCallback). so like... near-miss is fine, full miss is a whole error, no cap π
If a trimming loop definition contains multiple curves, the direction of the curves must be consistent (that is, the inside must be to the left of all of the curves). Nested trimming loops are legal as long as the curve orientations alternate correctly. If trimming curves are self-intersecting, or intersect one another, an error results. π« so: alternate your orientations, don't let your curves cross each other, and you're golden β¨
If no trimming information is given for a NURBS surface, the entire surface is drawn. easy. no trim, no drama, full surface, main character energy π
π EXAMPLE π
This code fragment defines a trimming loop that consists of one piecewise linear curve, and two NURBS curves:
gluBeginTrim(nobj);
gluPwlCurve(..., GLU_MAP1_TRIM_2);
gluNurbsCurve(..., GLU_MAP1_TRIM_2);
gluNurbsCurve(..., GLU_MAP1_TRIM_3); gluEndTrim(nobj);
three curves, one loop, all valid, all gorgeous. the GLU_MAP1_TRIM_2 and GLU_MAP1_TRIM_3 are doing the heavy lifting and they ate π
π¦ SEE ALSO π¦
gluBeginSurface(3G)gluNewNurbsRenderer(3G)gluNurbsCallback(3G)gluNurbsCurve(3G)gluPwlCurve(3G)
go read those next, bestie, they're all part of the same NURBS friend group π«Ά
and that's the whole page!! this little gem lives in the 3G manual, and if you flip to the very bottom you'd see it signed off with the title GLUBEGINTRIM(3G) β same name up top, same name down bottom, it's giving symmetrical, it's giving iconique πΈβ¨π periodt π
now go trim something responsibly, bestie π¦π
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- fedora 43: gl-manpages 1.1-34.20190306.fc43 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- fedora 44: gl-manpages 1.1-35.20190306.fc44 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms