<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
              "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
<refentry id="gluBeginTrim">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>gluBeginTrim</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>gluBeginTrim</refname>
        <refpurpose>delimit a NURBS trimming loop definition</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>gluBeginTrim</function></funcdef>
                <paramdef>GLUnurbs* <parameter>nurb</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>gluEndTrim</function></funcdef>
                <paramdef>GLUnurbs* <parameter>nurb</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>nurb</parameter></term>
            <listitem>
                <para>
                    Specifies the NURBS object (created with <citerefentry><refentrytitle>gluNewNurbsRenderer</refentrytitle></citerefentry>).
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            Use <function>gluBeginTrim</function> to mark the beginning of a
            trimming loop and <citerefentry><refentrytitle>gluEndTrim</refentrytitle></citerefentry> 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 include these
            trimming loops in the definition of a NURBS 
            surface, between calls to <citerefentry><refentrytitle>gluBeginSurface</refentrytitle></citerefentry> and <citerefentry><refentrytitle>gluEndSurface</refentrytitle></citerefentry>.
        </para>
        <para>
            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. The definitions
            of each of these trimming loops would be bracketed by a
            <function>gluBeginTrim</function>/<citerefentry><refentrytitle>gluEndTrim</refentrytitle></citerefentry> pair.
        </para>
        <para>
            The definition of a single closed trimming loop can consist
            of multiple curve segments, each described as a piecewise
            linear curve (see <citerefentry><refentrytitle>gluPwlCurve</refentrytitle></citerefentry>) or as a single NURBS
            curve (see <citerefentry><refentrytitle>gluNurbsCurve</refentrytitle></citerefentry>), or as a combination of 
            both in any order. The only library calls that can 
            appear in a trimming loop definition (between the calls
            to <function>gluBeginTrim</function> and <citerefentry><refentrytitle>gluEndTrim</refentrytitle></citerefentry>) are 
            <citerefentry><refentrytitle>gluPwlCurve</refentrytitle></citerefentry> and <citerefentry><refentrytitle>gluNurbsCurve</refentrytitle></citerefentry>.
        </para>
        <para>
            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.
        </para>
        <para>
            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 <citerefentry><refentrytitle>gluNurbsCallback</refentrytitle></citerefentry>).
        </para>
        <para>
            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.
        </para>
        <para>
            If no trimming information is given
            for a NURBS surface, the entire surface is drawn.
        </para>
    </refsect1>
    <refsect1 id="example"><title>Example</title>
        <para>
            This code fragment defines a trimming loop that consists of one
            piecewise linear curve, and two NURBS curves:
            <programlisting>
gluBeginTrim(nobj);
   gluPwlCurve(..., GLU_MAP1_TRIM_2);
   gluNurbsCurve(..., GLU_MAP1_TRIM_2);
   gluNurbsCurve(..., GLU_MAP1_TRIM_3);
gluEndTrim(nobj);
            </programlisting>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>gluBeginSurface</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>gluNewNurbsRenderer</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>gluNurbsCallback</refentrytitle></citerefentry>, 
            <citerefentry><refentrytitle>gluNurbsCurve</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>gluPwlCurve</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <refsect1 id="Copyright"><title>Copyright</title>
        <para>
            Copyright <trademark class="copyright"></trademark> 1991-2006
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
        </para>
    </refsect1>
</refentry>
