1GLUBEGINTRIM(3G) GLUBEGINTRIM(3G)
2
3
4
6 gluBeginTrim, gluEndTrim - delimit a NURBS trimming loop definition
7
8
10 void gluBeginTrim( GLUnurbs* nurb )
11
12 void gluEndTrim( GLUnurbs* nurb )
13
14
16 nurb Specifies the NURBS object (created with gluNewNurbsRenderer).
17
19 Use gluBeginTrim to mark the beginning of a trimming loop, and
20 gluEndTrim to mark the end of a trimming loop. A trimming loop is a set
21 of oriented curve segments (forming a closed curve) that define bound‐
22 aries of a NURBS surface. You include these trimming loops in the defi‐
23 nition of a NURBS surface, between calls to gluBeginSurface and
24 gluEndSurface.
25
26 The definition for a NURBS surface can contain many trimming loops. For
27 example, if you wrote a definition for a NURBS surface that resembled a
28 rectangle with a hole punched out, the definition would contain two
29 trimming loops. One loop would define the outer edge of the rectangle;
30 the other would define the hole punched out of the rectangle. The defi‐
31 nitions of each of these trimming loops would be bracketed by a
32 gluBeginTrim/gluEndTrim pair.
33
34 The definition of a single closed trimming loop can consist of multiple
35 curve segments, each described as a piecewise linear curve (see
36 gluPwlCurve) or as a single NURBS curve (see gluNurbsCurve), or as a
37 combination of both in any order. The only library calls that can
38 appear in a trimming loop definition (between the calls to gluBeginTrim
39 and gluEndTrim) are gluPwlCurve and gluNurbsCurve.
40
41 The area of the NURBS surface that is displayed is the region in the
42 domain to the left of the trimming curve as the curve parameter
43 increases. Thus, the retained region of the NURBS surface is inside a
44 counterclockwise trimming loop and outside a clockwise trimming loop.
45 For the rectangle mentioned earlier, the trimming loop for the outer
46 edge of the rectangle runs counterclockwise, while the trimming loop
47 for the punched-out hole runs clockwise.
48
49 If you use more than one curve to define a single trimming loop, the
50 curve segments must form a closed loop (that is, the endpoint of each
51 curve must be the starting point of the next curve, and the endpoint of
52 the final curve must be the starting point of the first curve). If the
53 endpoints of the curve are sufficiently close together but not exactly
54 coincident, they will be coerced to match. If the endpoints are not
55 sufficiently close, an error results (see gluNurbsCallback).
56
57 If a trimming loop definition contains multiple curves, the direction
58 of the curves must be consistent (that is, the inside must be to the
59 left of all of the curves). Nested trimming loops are legal as long as
60 the curve orientations alternate correctly. If trimming curves are
61 self-intersecting, or intersect one another, an error results.
62
63 If no trimming information is given for a NURBS surface, the entire
64 surface is drawn.
65
67 This code fragment defines a trimming loop that consists of one piece‐
68 wise linear curve, and two NURBS curves:
69
70 gluBeginTrim(nobj);
71 gluPwlCurve(..., GLU_MAP1_TRIM_2);
72 gluNurbsCurve(..., GLU_MAP1_TRIM_2);
73 gluNurbsCurve(..., GLU_MAP1_TRIM_3); gluEndTrim(nobj);
74
76 gluBeginSurface(3G), gluNewNurbsRenderer(3G), gluNurbsCallback(3G),
77 gluNurbsCurve(3G), gluPwlCurve(3G)
78
79
80
81
82
83 GLUBEGINTRIM(3G)