Subversion Repositories AndroidProjects

Rev

Blame | Last modification | View Log | RSS feed

<?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="glRotate">
    <refmeta>
        <refmetainfo>
            <copyright>
                <year>1991-2006</year>
                <holder>Silicon Graphics, Inc.</holder>
            </copyright>
        </refmetainfo>
        <refentrytitle>glRotate</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>glRotate</refname>
        <refpurpose>multiply the current matrix by a rotation matrix</refpurpose>
    </refnamediv>
    <refsynopsisdiv><title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRotated</function></funcdef>
                <paramdef>GLdouble <parameter>angle</parameter></paramdef>
                <paramdef>GLdouble <parameter>x</parameter></paramdef>
                <paramdef>GLdouble <parameter>y</parameter></paramdef>
                <paramdef>GLdouble <parameter>z</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
        <funcsynopsis>
            <funcprototype>
                <funcdef>void <function>glRotatef</function></funcdef>
                <paramdef>GLfloat <parameter>angle</parameter></paramdef>
                <paramdef>GLfloat <parameter>x</parameter></paramdef>
                <paramdef>GLfloat <parameter>y</parameter></paramdef>
                <paramdef>GLfloat <parameter>z</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <!-- eqn: ignoring delim $$ -->
    <refsect1 id="parameters"><title>Parameters</title>
        <variablelist>
        <varlistentry>
            <term><parameter>angle</parameter></term>
            <listitem>
                <para>
                    Specifies the angle of rotation, in degrees.
                </para>
            </listitem>
        </varlistentry>
        <varlistentry>
            <term><parameter>x</parameter></term>
            <term><parameter>y</parameter></term>
            <term><parameter>z</parameter></term>
            <listitem>
                <para>
                    Specify the <emphasis>x</emphasis>, <emphasis>y</emphasis>, and <emphasis>z</emphasis> coordinates of a vector, respectively.
                </para>
            </listitem>
        </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 id="description"><title>Description</title>
        <para>
            <function>glRotate</function> produces a rotation of <parameter>angle</parameter> degrees around
            the vector
            <inlineequation><mml:math>
                <!-- eqn: (x, y, z):-->
                <mml:mfenced open="(" close=")">
                    <mml:mi mathvariant="italic">x</mml:mi>
                    <mml:mi mathvariant="italic">y</mml:mi>
                    <mml:mi mathvariant="italic">z</mml:mi>
                </mml:mfenced>
            </mml:math></inlineequation>.
            The current matrix (see <citerefentry><refentrytitle>glMatrixMode</refentrytitle></citerefentry>) is multiplied by a rotation
            matrix with the product
            replacing the current matrix, as if <citerefentry><refentrytitle>glMultMatrix</refentrytitle></citerefentry> were called
            with the following matrix as its argument:
        </para>
        <para>
            <informalequation><mml:math>
                <!-- eqn: left (   matrix {  ccol {    x sup 2 (1  -  c) +  c above    y x (1  -  c) +  z s above    x z (1  -  c) - y s above     0  }  ccol {       x y (1  -  c) - z s above       y sup 2 (1  -  c) +  c above       y z (1  -  c) +  x s above        0  }  ccol {       x z (1  -  c) +  y s above       y z (1  -  c) -  x s above       z sup 2 (1  -  c)  +   c above        0  }  ccol {  0 above  0 above  0 above  1} }    right ):-->
                <mml:mfenced open="(" close=")">
                    <mml:mtable>
                        <mml:mtr>
                            <mml:mtd>
                                <mml:mrow>
                                    <mml:mrow>
                                        <mml:msup><mml:mi mathvariant="italic">x</mml:mi>
                                        <mml:mn>2</mml:mn>
                                        </mml:msup>
                                        <mml:mo>&af;</mml:mo>
                                        <mml:mfenced open="(" close=")">
                                            <mml:mrow>
                                                <mml:mn>1</mml:mn>
                                                <mml:mo>-</mml:mo>
                                                <mml:mi mathvariant="italic">c</mml:mi>
                                            </mml:mrow>
                                        </mml:mfenced>
                                    </mml:mrow>
                                    <mml:mo>+</mml:mo>
                                    <mml:mi mathvariant="italic">c</mml:mi>
                                </mml:mrow>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mrow>
                                    <mml:mi mathvariant="italic">x</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mrow>
                                        <mml:mi mathvariant="italic">y</mml:mi>
                                        <mml:mo>&af;</mml:mo>
                                        <mml:mfenced open="(" close=")">
                                            <mml:mrow>
                                                <mml:mn>1</mml:mn>
                                                <mml:mo>-</mml:mo>
                                                <mml:mi mathvariant="italic">c</mml:mi>
                                            </mml:mrow>
                                        </mml:mfenced>
                                    </mml:mrow>
                                    <mml:mo>-</mml:mo>
                                    <mml:mi mathvariant="italic">z</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mi mathvariant="italic">s</mml:mi>
                                </mml:mrow>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mrow>
                                    <mml:mi mathvariant="italic">x</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mrow>
                                        <mml:mi mathvariant="italic">z</mml:mi>
                                        <mml:mo>&af;</mml:mo>
                                        <mml:mfenced open="(" close=")">
                                            <mml:mrow>
                                                <mml:mn>1</mml:mn>
                                                <mml:mo>-</mml:mo>
                                                <mml:mi mathvariant="italic">c</mml:mi>
                                            </mml:mrow>
                                        </mml:mfenced>
                                    </mml:mrow>
                                    <mml:mo>+</mml:mo>
                                    <mml:mi mathvariant="italic">y</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mi mathvariant="italic">s</mml:mi>
                                </mml:mrow>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mn>0</mml:mn>
                            </mml:mtd>
                        </mml:mtr>
                        <mml:mtr>
                            <mml:mtd>
                                <mml:mrow>
                                    <mml:mi mathvariant="italic">y</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mrow>
                                        <mml:mi mathvariant="italic">x</mml:mi>
                                        <mml:mo>&af;</mml:mo>
                                        <mml:mfenced open="(" close=")">
                                            <mml:mrow>
                                                <mml:mn>1</mml:mn>
                                                <mml:mo>-</mml:mo>
                                                <mml:mi mathvariant="italic">c</mml:mi>
                                            </mml:mrow>
                                        </mml:mfenced>
                                    </mml:mrow>
                                    <mml:mo>+</mml:mo>
                                    <mml:mi mathvariant="italic">z</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mi mathvariant="italic">s</mml:mi>
                                </mml:mrow>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mrow>
                                    <mml:mrow>
                                        <mml:msup><mml:mi mathvariant="italic">y</mml:mi>
                                        <mml:mn>2</mml:mn>
                                        </mml:msup>
                                        <mml:mo>&af;</mml:mo>
                                        <mml:mfenced open="(" close=")">
                                            <mml:mrow>
                                                <mml:mn>1</mml:mn>
                                                <mml:mo>-</mml:mo>
                                                <mml:mi mathvariant="italic">c</mml:mi>
                                            </mml:mrow>
                                        </mml:mfenced>
                                    </mml:mrow>
                                    <mml:mo>+</mml:mo>
                                    <mml:mi mathvariant="italic">c</mml:mi>
                                </mml:mrow>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mrow>
                                    <mml:mi mathvariant="italic">y</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mrow>
                                        <mml:mi mathvariant="italic">z</mml:mi>
                                        <mml:mo>&af;</mml:mo>
                                        <mml:mfenced open="(" close=")">
                                            <mml:mrow>
                                                <mml:mn>1</mml:mn>
                                                <mml:mo>-</mml:mo>
                                                <mml:mi mathvariant="italic">c</mml:mi>
                                            </mml:mrow>
                                        </mml:mfenced>
                                    </mml:mrow>
                                    <mml:mo>-</mml:mo>
                                    <mml:mi mathvariant="italic">x</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mi mathvariant="italic">s</mml:mi>
                                </mml:mrow>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mn>0</mml:mn>
                            </mml:mtd>
                        </mml:mtr>
                        <mml:mtr>
                            <mml:mtd>
                                <mml:mrow>
                                    <mml:mi mathvariant="italic">x</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mrow>
                                        <mml:mi mathvariant="italic">z</mml:mi>
                                        <mml:mo>&af;</mml:mo>
                                        <mml:mfenced open="(" close=")">
                                            <mml:mrow>
                                                <mml:mn>1</mml:mn>
                                                <mml:mo>-</mml:mo>
                                                <mml:mi mathvariant="italic">c</mml:mi>
                                            </mml:mrow>
                                        </mml:mfenced>
                                    </mml:mrow>
                                    <mml:mo>-</mml:mo>
                                    <mml:mi mathvariant="italic">y</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mi mathvariant="italic">s</mml:mi>
                                </mml:mrow>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mrow>
                                    <mml:mi mathvariant="italic">y</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mrow>
                                        <mml:mi mathvariant="italic">z</mml:mi>
                                        <mml:mo>&af;</mml:mo>
                                        <mml:mfenced open="(" close=")">
                                            <mml:mrow>
                                                <mml:mn>1</mml:mn>
                                                <mml:mo>-</mml:mo>
                                                <mml:mi mathvariant="italic">c</mml:mi>
                                            </mml:mrow>
                                        </mml:mfenced>
                                    </mml:mrow>
                                    <mml:mo>+</mml:mo>
                                    <mml:mi mathvariant="italic">x</mml:mi>
                                    <mml:mo>&it;</mml:mo>
                                    <mml:mi mathvariant="italic">s</mml:mi>
                                </mml:mrow>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mrow>
                                    <mml:mrow>
                                        <mml:msup><mml:mi mathvariant="italic">z</mml:mi>
                                        <mml:mn>2</mml:mn>
                                        </mml:msup>
                                        <mml:mo>&af;</mml:mo>
                                        <mml:mfenced open="(" close=")">
                                            <mml:mrow>
                                                <mml:mn>1</mml:mn>
                                                <mml:mo>-</mml:mo>
                                                <mml:mi mathvariant="italic">c</mml:mi>
                                            </mml:mrow>
                                        </mml:mfenced>
                                    </mml:mrow>
                                    <mml:mo>+</mml:mo>
                                    <mml:mi mathvariant="italic">c</mml:mi>
                                </mml:mrow>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mn>0</mml:mn>
                            </mml:mtd>
                        </mml:mtr>
                        <mml:mtr>
                            <mml:mtd>
                                <mml:mn>0</mml:mn>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mn>0</mml:mn>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mn>0</mml:mn>
                            </mml:mtd>
                            <mml:mtd>
                                <mml:mn>1</mml:mn>
                            </mml:mtd>
                        </mml:mtr>
                    </mml:mtable>
                </mml:mfenced>
            </mml:math></informalequation>
        </para>
        <para>
        </para>
        <para>
            Where
            <inlineequation><mml:math>
                <!-- eqn: c  =  cos (angle):-->
                <mml:mrow>
                    <mml:mi mathvariant="italic">c</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mi mathvariant="italic">cos</mml:mi>
                        <mml:mo>&af;</mml:mo>
                        <mml:mfenced open="(" close=")">
                            <mml:mi mathvariant="italic">angle</mml:mi>
                        </mml:mfenced>
                    </mml:mrow>
                </mml:mrow>
            </mml:math></inlineequation>,
            <inlineequation><mml:math>
                <!-- eqn: s  =  sin (angle):-->
                <mml:mrow>
                    <mml:mi mathvariant="italic">s</mml:mi>
                    <mml:mo>=</mml:mo>
                    <mml:mrow>
                        <mml:mi mathvariant="italic">sin</mml:mi>
                        <mml:mo>&af;</mml:mo>
                        <mml:mfenced open="(" close=")">
                            <mml:mi mathvariant="italic">angle</mml:mi>
                        </mml:mfenced>
                    </mml:mrow>
                </mml:mrow>
            </mml:math></inlineequation>,
            and
            <inlineequation><mml:math>
                <!-- eqn: ||( x, y, z )||  =  1:-->
                <mml:mrow>
                    <mml:mfenced open="&DoubleVerticalBar;" close="&DoubleVerticalBar;">
                        <mml:mfenced open="(" close=")">
                            <mml:mi mathvariant="italic">x</mml:mi>
                            <mml:mi mathvariant="italic">y</mml:mi>
                            <mml:mi mathvariant="italic">z</mml:mi>
                        </mml:mfenced>
                    </mml:mfenced>
                    <mml:mo>=</mml:mo>
                    <mml:mn>1</mml:mn>
                </mml:mrow>
            </mml:math></inlineequation>
            (if not, the GL
            will normalize this vector).
        </para>
        <para>
        </para>
        <para>
        </para>
        <para>
            If the matrix mode is either <constant>GL_MODELVIEW</constant> or <constant>GL_PROJECTION</constant>,
            all objects drawn after <function>glRotate</function> is called are rotated.
            Use <citerefentry><refentrytitle>glPushMatrix</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glPopMatrix</refentrytitle></citerefentry> to save and restore
            the unrotated coordinate system.
        </para>
    </refsect1>
    <refsect1 id="notes"><title>Notes</title>
        <para>
            This rotation follows the right-hand rule, so
            if the vector
            <inlineequation><mml:math>
                <!-- eqn: (x, y, z):-->
                <mml:mfenced open="(" close=")">
                    <mml:mi mathvariant="italic">x</mml:mi>
                    <mml:mi mathvariant="italic">y</mml:mi>
                    <mml:mi mathvariant="italic">z</mml:mi>
                </mml:mfenced>
            </mml:math></inlineequation>
            points toward the
            user, the rotation will be counterclockwise.
        </para>
    </refsect1>
    <refsect1 id="errors"><title>Errors</title>
        <para>
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glRotate</function>
            is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry>
            and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
        </para>
    </refsect1>
    <refsect1 id="associatedgets"><title>Associated Gets</title>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MATRIX_MODE</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_COLOR_MATRIX</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_MODELVIEW_MATRIX</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_PROJECTION_MATRIX</constant>
        </para>
        <para>
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_TEXTURE_MATRIX</constant>
        </para>
    </refsect1>
    <refsect1 id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>glMatrixMode</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glMultMatrix</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glPushMatrix</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glScale</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>glTranslate</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>