_C_ License Applicability. Except to the extent portions of this file are
_C_ made subject to an alternative license as permitted in the SGI Free
_C_ Software License B, Version 1.1 (the "License"), the contents of this
_C_ file are subject only to the provisions of the License. You may not use
_C_ this file except in compliance with the License. You may obtain a copy
_C_ of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
_C_ Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
_C_ 
_C_ http://oss.sgi.com/projects/FreeB
_C_ 
_C_ Note that, as provided in the License, the Software is distributed on an
_C_ "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
_C_ DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
_C_ CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
_C_ PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
_C_ 
_C_ Original Code. The Original Code is: OpenGL Sample Implementation,
_C_ Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
_C_ Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
_C_ Copyright in any portions created by third parties is as indicated
_C_ elsewhere herein. All Rights Reserved.
_C_ 
_C_ Additional Notice Provisions: The application programming interfaces
_C_ established by SGI in conjunction with the Original Code are The
_C_ OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
_C_ April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
_C_ 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
_C_ Window System(R) (Version 1.3), released October 19, 1998. This software
_C_ was created using the OpenGL(R) version 1.2.1 Sample Implementation
_C_ published by SGI, but has not been independently verified as being
_C_ compliant with the OpenGL(R) version 1.2.1 Specification.
_C_
_C_ The first character in this file must be an '_'!
_C_ Anything on a line after _C_ is ignored
_define(_filters,tbl|eqn)_C_
_C_      eqn is automatically replaced with neqn for nroff
_header(Map2,define a two-dimensional evaluator)
_names(Map2,[fd])
.EQ
delim $$
.EN
.SH PARAMETERS
_phead(_param1)
Specifies the kind of values that are generated by the evaluator.
Symbolic constants
_const(MAP2_VERTEX_3),
_const(MAP2_VERTEX_4),
_const(MAP2_INDEX),
_const(MAP2_COLOR_4),
_const(MAP2_NORMAL),
_const(MAP2_TEXTURE_COORD_1),
_const(MAP2_TEXTURE_COORD_2),
_const(MAP2_TEXTURE_COORD_3), and
_const(MAP2_TEXTURE_COORD_4) are accepted.
_phead(_param2 _param3)
Specify a linear mapping of $u$,
as presented to _cmnd(EvalCoord2),
to $u hat$,
one of the two variables that are evaluated by the equations specified
by this command. Initially, _param2 is 0 and _param3 is 1.
_phead(_param4)
Specifies the number of floats or doubles between
the beginning of control point
$R sub ij$
and the beginning of control point
$R sub { (i+1) j }$,
where $i$ and $j$ are the $u$ and $v$ control point indices, respectively.
This allows control points to be embedded in arbitrary data structures.
The only constraint is that the values for a particular control point
must occupy contiguous memory locations. The initial value of _param4 is 0. 
_phead(_param5)
Specifies the dimension of the control point array in the $u$ axis.
Must be positive. The initial value is 1.
_phead(_param6 _param7)
Specify a linear mapping of $v$,
as presented to _cmnd(EvalCoord2),
to $v hat$,
one of the two variables that are evaluated by the equations specified
by this command. Initially, _param6 is 0 and _param7 is 1. 
_phead(_param8)
Specifies the number of floats or doubles between
the beginning of control point
$R sub ij$
and the beginning of control point
$R sub { i (j+1) }$,
where $i$ and $j$ are the $u$ and $v$ control point indices, respectively.
This allows control points to be embedded in arbitrary data structures.
The only constraint is that the values for a particular control point
must occupy contiguous memory locations. The initial value of _param8 is 0.
_phead(_param9)
Specifies the dimension of the control point array in the $v$ axis.
Must be positive. The initial value is 1. 
_phead(_param10)
Specifies a pointer to the array of control points.
.SH DESCRIPTION
Evaluators provide a way to use polynomial or rational polynomial mapping
to produce vertices,
normals,
texture coordinates,
and colors.
The values produced by an evaluator are sent on to further stages
of GL processing just as if they had been presented using
_cmnd(Vertex),
_cmnd(Normal),
_cmnd(TexCoord), and
_cmnd(Color) commands,
except that the generated values do not update the current normal,
texture coordinates,
or color.
.P
All polynomial or rational polynomial splines of any degree
(up to the maximum degree supported by the GL implementation)
can be described using evaluators.
These include almost all surfaces used in computer graphics,
including B-spline surfaces,
NURBS surfaces,
Bezier surfaces, and so on.  
.P
Evaluators define surfaces based on bivariate Bernstein polynomials.
Define $p ( u hat , v hat ) $ as
.ce
.sp
.EQ 
p ( u hat , v hat ) ~~=~~
 down 30 {{size 18 {sum}} from {size 8 {i~=~0}} to {size 9 {n}} } ~
 {{size 18 {sum}} from {size 8 {j~=~0}} to {size 9 {m}} } ~
 up 15 { B sub i sup n ( u hat ) ~ B sub j sup m ( v hat ) ~ R sub ij }
.EN
.sp
.P
where $R sub ij$ is a control point,
$B sub i sup n ( u hat )$
is the $i$th Bernstein polynomial of degree 
.br
$n$ (_param5 = $n ~+~ 1$)
.ce
.sp
.EQ 
B sub i sup n ( u hat ) ~~=~~ left ( down 20 {cpile { n above i }} ~ right
) u hat sup i ( 1 - u hat ) sup { n - i }
.EN
.sp
and $B sub j sup m ( v hat )$
is the $j$th Bernstein polynomial of degree $m$ (_param9 = $m ~+~ 1$)
.ce
.sp
.EQ 
B sub j sup m ( v hat ) ~~=~~ left ( ^down 20 {cpile { m above j }} ~^ right ) v hat sup j ( 1 - v hat ) sup { m - j }
.EN
.sp
Recall that 
.ce
$0 sup 0 ~==~ 1 $ and $ left ( ^ down 20 {cpile { n above 0 }} ~^ right ) ~~==~~ 1 $
.sp
_cmnd is used to define the basis and to specify what kind of values
are produced.
Once defined,
a map can be enabled and disabled by calling _cmnd(Enable) and _cmnd(Disable)
with the map name, one of the nine predefined values for _param1,
described below.
When _cmnd(EvalCoord2) presents values $u$ and $v$,
the bivariate Bernstein polynomials are evaluated using $u hat$ and $v hat$,
where
.sp
.ce
$u hat ~~=~~ {u ~-~ _eqnparam2} over {_eqnparam3 ~-~ _eqnparam2}$
.sp
.ce
$v hat ~~=~~ {v ~-~ _eqnparam6} over {_eqnparam7 ~-~ _eqnparam6}$
.sp
_param1 is a symbolic constant that indicates what kind of control points
are provided in _param10,
and what output is generated when the map is evaluated.
It can assume one of nine predefined values:
.TP 25
_const(MAP2_VERTEX_3)
Each control point is three floating-point values representing
$x$, $y$, and $z$.
Internal _cmnd(Vertex3) commands are generated when the map is evaluated.
.TP
_const(MAP2_VERTEX_4)
Each control point is four floating-point values representing
$x$, $y$, $z$, and $w$.
Internal _cmnd(Vertex4) commands are generated when the map is evaluated.
.TP
_const(MAP2_INDEX)
Each control point is a single floating-point value representing a color index.
Internal _cmnd(Index) commands are generated when the map is evaluated
but the current index is not updated with the value of these
_cmnd(Index) commands. 
.TP
_const(MAP2_COLOR_4)
Each control point is four floating-point values representing
red, green, blue, and alpha.
Internal _cmnd(Color4) commands are generated when the map is
evaluated but the current color is not updated with the value of
these _cmnd(Color4) commands.
.TP
_const(MAP2_NORMAL)
Each control point is three floating-point values representing
the $x$, $y$, and $z$ components of a normal vector.
Internal _cmnd(Normal) commands are generated when the map is
evaluated but the current normal is not updated with the value of
these _cmnd(Normal) commands.
.TP 
_const(MAP2_TEXTURE_COORD_1)
Each control point is a single floating-point value representing
the $s$ texture coordinate.
Internal 
.br
_cmnd(TexCoord1) commands are generated when the map is evaluated but
the current texture coordinates are not updated with the value 
of these _cmnd(TexCoord) commands. 
.TP
_const(MAP2_TEXTURE_COORD_2)
Each control point is two floating-point values representing
the $s$ and $t$ texture coordinates.
Internal 
.br
_cmnd(TexCoord2) commands are generated when the map is evaluated but
the current texture coordinates are not updated with the value 
of these _cmnd(TexCoord) commands.
.TP
_const(MAP2_TEXTURE_COORD_3)
Each control point is three floating-point values representing
the $s$, $t$, and $r$ texture coordinates.
Internal _cmnd(TexCoord3) commands are generated when the map is
evaluated but the current texture coordinates are not updated with the value
of these _cmnd(TexCoord) commands.
.TP
_const(MAP2_TEXTURE_COORD_4)
Each control point is four floating-point values representing
the $s$, $t$, $r$, and $q$ texture coordinates.
Internal 
.br
_cmnd(TexCoord4) commands are generated when the map is evaluated but the current texture coordinates are not updated with the value
of these _cmnd(TexCoord) commands.
.P
_param4,
_param5,
_param8,
_param9, and
_param10 define the array addressing for accessing the control points.
_param10 is the location of the first control point,
which occupies one, two, three, or four contiguous memory locations,
depending on which map is being defined.
There are $ _eqnparam5 ~times~ _eqnparam9 $ control points in the array.
_param4 specifies how many float or double locations are skipped to advance
the internal memory pointer from control point
$R sub {i j} $ to control point $R sub {(i+1) j} $.
_param8 specifies how many float or double locations are skipped to advance
the internal memory pointer from control point
$R sub {i j} $ to control point $R sub {i (j+1) } $.
.SH NOTES
As is the case with all GL commands that accept pointers to data,
it is as if the contents of _param10 were copied by _cmnd before _cmnd
returns.
Changes to the contents of _param10 have no effect after _cmnd is called.
.P
Initially, _const(AUTO_NORMAL) is enabled. If _const(AUTO_NORMAL) is enabled,
normal vectors are generated when either
_const(MAP2_VERTEX_3) or _const(MAP2_VERTEX_4) is used to generate
vertices.
.SH ERRORS
_const(INVALID_ENUM) is generated if _param1 is not an accepted value.
.P
_const(INVALID_VALUE) is generated if _param2 is equal to _param3,
or if _param6 is equal to _param7.
.P
_const(INVALID_VALUE) is generated if either _param4 or _param8
is less than the number of values in a control point.
.P
_const(INVALID_VALUE) is generated if either _param5 or _param9
is less than 1 or greater than the return value of _const(MAX_EVAL_ORDER).
.P
_const(INVALID_OPERATION) is generated if _cmnd
is executed between the execution of
_cmnd(Begin)
and the corresponding execution of _cmnd(End).
.P
When the _arbstring(multitexture) extension is supported,
_const(INVALID_OPERATION) is generated if _cmnd is called and the value
of _arbconst(ACTIVE_TEXTURE) is not _arbconst(TEXTURE0).
.SH ASSOCIATED GETS
_cmnd(GetMap)
.br
_cmnd(Get) with argument _const(MAX_EVAL_ORDER)
.br
_cmnd(IsEnabled) with argument _const(MAP2_VERTEX_3)
.br
_cmnd(IsEnabled) with argument _const(MAP2_VERTEX_4)
.br
_cmnd(IsEnabled) with argument _const(MAP2_INDEX)
.br
_cmnd(IsEnabled) with argument _const(MAP2_COLOR_4)
.br
_cmnd(IsEnabled) with argument _const(MAP2_NORMAL)
.br
_cmnd(IsEnabled) with argument _const(MAP2_TEXTURE_COORD_1)
.br
_cmnd(IsEnabled) with argument _const(MAP2_TEXTURE_COORD_2)
.br
_cmnd(IsEnabled) with argument _const(MAP2_TEXTURE_COORD_3)
.br
_cmnd(IsEnabled) with argument _const(MAP2_TEXTURE_COORD_4)
.SH SEE ALSO
_cmnd(Begin),
_cmnd(Color),
_cmnd(Enable),
_cmnd(EvalCoord),
_cmnd(EvalMesh),
_cmnd(EvalPoint),
_cmnd(Map1),
_cmnd(MapGrid),
_cmnd(Normal),
_cmnd(TexCoord),
_cmnd(Vertex)
