% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.

%
%
%
%
%



\texht{\setcounter{chapter}{6}}{} % Chapter 7

\newcommand{\optArg}[1]{{{\tt [}{#1}{\tt ]}}}
\newcommand{\argDef}[1]{{\tt ({#1})}}
\newcommand{\funSyntax}[2]{\spadfun{#1}{\tt ({\small\it{#2}})}}
\newcommand{\funArgs}[1]{{\tt ({\small\it {#1}})}\newline}

%
\newcommand{\ugGraphTitle}{Graphics}
\newcommand{\ugGraphNumber}{7.}
%
% =====================================================================
\begin{page}{ugGraphPage}{7. Graphics}
% =====================================================================
\beginscroll

%

This chapter shows how to use the \Language{} graphics facilities
%-% \HDindex{graphics}{ugGraphPage}{7.}{Graphics}
under the X Window System.
\Language{} has \twodim{} and \threedim{} drawing and rendering
packages that allow the drawing, coloring, transforming, mapping,
clipping, and combining of graphic output from \Language{}
computations.
This facility is particularly useful for investigating problems in
areas such as topology.
The graphics package is capable of plotting functions of one or
more variables or plotting parametric surfaces and curves.
Various coordinate systems are also available, such as polar and
spherical.

A graph is displayed in a viewport window and it has a
%-% \HDindex{viewport}{ugGraphPage}{7.}{Graphics}
control-panel that uses interactive mouse commands.
PostScript and other output forms are available so that \Language{}
%-% \HDindex{PostScript}{ugGraphPage}{7.}{Graphics}
images can be printed or used by other programs.\footnote{PostScript
is a trademark of Adobe Systems Incorporated, registered in the United
States.}

\beginmenu
    \menudownlink{{7.1. Two-Dimensional Graphics}}{ugGraphTwoDPage}
    \menudownlink{{7.2. Three-Dimensional Graphics}}{ugGraphThreeDPage}
\endmenu
\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphTwoDTitle}{Two-Dimensional Graphics}
\newcommand{\ugGraphTwoDNumber}{7.1.}
%
% =====================================================================
\begin{page}{ugGraphTwoDPage}{7.1. Two-Dimensional Graphics}
% =====================================================================
\beginscroll
%
The \Language{} \twodim{} graphics package provides the ability to
%-% \HDindex{graphics!two-dimensional}{ugGraphTwoDPage}{7.1.}{Two-Dimensional Graphics}
display
%
\indent{4}
\beginitems
%
\item[-] curves defined by functions of a single real variable
%
\item[-] curves defined by parametric equations
%
\item[-] implicit non-singular curves defined by polynomial equations
%
\item[-] planar graphs generated from lists of point components.
\enditems
\indent{0}
These graphs
can be modified by specifying various options, such as
calculating points in the polar
coordinate system or changing the size of the graph viewport window.

\beginmenu
    \menudownlink{{7.1.1. Plotting Two-Dimensional Functions of One Variable}}{ugGraphTwoDPlotPage}
    \menudownlink{{7.1.2. Plotting Two-Dimensional Parametric Plane Curves}}{ugGraphTwoDParPage}
    \menudownlink{{7.1.3. Plotting Plane Algebraic Curves}}{ugGraphTwoDPlanePage}
    \menudownlink{{7.1.4. Two-Dimensional Options}}{ugGraphTwoDOptionsPage}
    \menudownlink{{7.1.5. Color}}{ugGraphColorPage}
    \menudownlink{{7.1.6. Palette}}{ugGraphColorPalettePage}
    \menudownlink{{7.1.7. Two-Dimensional Control-Panel}}{ugGraphTwoDControlPage}
    \menudownlink{{7.1.8. Operations for Two-Dimensional Graphics}}{ugGraphTwoDopsPage}
    \menudownlink{{7.1.9. Addendum: Building Two-Dimensional Graphs}}{ugGraphTwoDbuildPage}
    \menudownlink{{7.1.10. Addendum: Appending a Graph to a Viewport Window Containing a Graph}}{ugGraphTwoDappendPage}
\endmenu
\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphTwoDPlotTitle}{Plotting Two-Dimensional Functions of One Variable}
\newcommand{\ugGraphTwoDPlotNumber}{7.1.1.}
%
% =====================================================================
\begin{page}{ugGraphTwoDPlotPage}{7.1.1. Plotting Two-Dimensional Functions of One Variable}
% =====================================================================
\beginscroll

%-% \HDindex{curve!one variable function}{ugGraphTwoDPlotPage}{7.1.1.}{Plotting Two-Dimensional Functions of One Variable}
The first kind of \twodim{} graph is that of a curve defined by a function
\spad{y = f(x)} over a finite interval of the \spad{x} axis.

%
\beginImportant
The general format for drawing a function defined by a formula
\spad{f(x)} is:
%
\centerline{{{\tt draw(f(x), x = a..b, {\it options})}}}
where \spad{a..b} defines the range of \spad{x}, and where
{\it options} prescribes zero or more options as described in
\downlink{``\ugGraphTwoDOptionsTitle''}{ugGraphTwoDOptionsPage} in Section \ugGraphTwoDOptionsNumber\ignore{ugGraphTwoDOptions}.
An example of an option is \spad{curveColor == bright red().}
An alternative format involving functions \spad{f} and \spad{g}
is also available.
\endImportant

A simple way to plot a function is to use a formula.
The first argument is the formula.
For the second argument, write the name of the independent variable (here, \spad{x}),
followed by an \spadSyntax{=}, and the range of values.

\psXtc{
Display this formula over the range
\texht{$0 \leq x \leq 6$}{0 <= x <= 6}.
\Language{} converts your formula to a compiled
function so that the results can be computed
quickly and efficiently.
}{
\graphpaste{draw(sin(tan(x)) - tan(sin(x)),x = 0..6)}
}{
\epsffile[0 0 295 295]{../ps/2D1VarA.ps}
}

Notice that \Language{} compiled the function before the graph was put
on the screen.

\psXtc{
Here is the same graph on a different interval.
This time we give the graph a title.
}{
\graphpaste{draw(sin(tan(x)) - tan(sin(x)),x = 10..16)}
}{
%window was 300 x 300
\epsffile[0 0 295 295]{../ps/2D1VarB.ps}
}
%
Once again the formula is converted to a compiled function before
any points were computed.
If you want to graph the same function on several intervals, it is
a good idea to define the function first so that the function has
to be compiled only once.
\xtc{
This time we first define the function.
}{
\spadpaste{f(x) == (x-1)*(x-2)*(x-3) \bound{f}}
}
\psXtc{
To draw the function, the first argument is its name
and the second is just the range with no independent variable.
}{
\graphpaste{draw(f, 0..4) \free{f}}
}{
\epsffile[0 0 295 295]{../ps/2D1VarD.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphTwoDParTitle}{Plotting Two-Dimensional Parametric Plane Curves}
\newcommand{\ugGraphTwoDParNumber}{7.1.2.}
%
% =====================================================================
\begin{page}{ugGraphTwoDParPage}{7.1.2. Plotting Two-Dimensional Parametric Plane Curves}
% =====================================================================
\beginscroll

The second kind of \twodim{} graph is that of
%-% \HDindex{parametric plane curve}{ugGraphTwoDParPage}{7.1.2.}{Plotting Two-Dimensional Parametric Plane Curves}
curves produced by parametric equations.
%-% \HDindex{curve!parametric plane}{ugGraphTwoDParPage}{7.1.2.}{Plotting Two-Dimensional Parametric Plane Curves}
Let \spad{x = f(t)} and \spad{y = g(t)} be formulas or two
functions \spad{f} and \spad{g} as the parameter \spad{t} ranges
over an interval \spad{[a,b]}.
The function \spadfun{curve} takes the two functions \spad{f} and
\spad{g} as its parameters.

\beginImportant
The general format for drawing a \twodim{} plane curve defined by
parametric formulas \spad{x = f(t)} and \spad{y = g(t)} is:
%
\centerline{{{\tt draw(curve(f(t), g(t)), t = a..b, {\it options})}}}
where \spad{a..b} defines the range of the independent variable \spad{t},
and where {\it options} prescribes zero or more options as
described in \downlink{``\ugGraphThreeDOptionsTitle''}{ugGraphThreeDOptionsPage} in Section \ugGraphThreeDOptionsNumber\ignore{ugGraphThreeDOptions}.
An example of an option is \spad{curveColor == bright red().}
\endImportant

Here's an example:

\psXtc{
Define a parametric curve using a range involving
\spad{\%pi}, \Language{}'s way of saying \texht{$\pi$}{``pi''}.
For parametric curves, \Language{} compiles two
functions, one for each of the functions \spad{f} and \spad{g}.
}{
\graphpaste{draw(curve(sin(t)*sin(2*t)*sin(3*t), sin(4*t)*sin(5*t)*sin(6*t)), t = 0..2*\%pi)}
}{
\epsffile[0 0 295 295]{../ps/2DppcA.ps}
}
%
%
\psXtc{
The title may be an arbitrary string and is an
optional argument to the \spadfun{draw} command.
}{
\graphpaste{draw(curve(cos(t), sin(t)), t = 0..2*\%pi)}
}{
\epsffile[0 0 295 295]{../ps/2DppcB.ps}
}
%
If you plan on plotting \spad{x = f(t)}, \spad{y = g(t)} as \spad{t} ranges over
several intervals, you may want to define functions \spad{f} and \spad{g} first, so
that they need not be recompiled every time you create a new graph.
Here's an example:
\xtc{
As before, you can first define the functions you wish to draw.
}{
\spadpaste{f(t:DFLOAT):DFLOAT == sin(3*t/4) \bound{f}}
}
\xtc{
\Language{} compiles them to map \spadtype{DoubleFloat}
values to \spadtype{DoubleFloat} values.
}{
\spadpaste{g(t:DFLOAT):DFLOAT == sin(t) \bound{g}}
}

\psXtc{
Give to {\tt curve} the names of the functions,
then write the range without the name of the
independent variable.
}{
\graphpaste{draw(curve(f,g),0..\%pi) \free{f g}}
}{
\epsffile[0 0 295 295]{../ps/2DppcC.ps}
}
%
%
\psXtc{
Here is another look at the same curve but over a different
range. Notice that \spad{f} and \spad{g} are not recompiled.
Also note that \Language{} provides a default title based on
the first function specified in \spadfun{curve}.
}{
\graphpaste{draw(curve(f,g),-4*\%pi..4*\%pi) \free{f g}}
}{
\epsffile[0 0 295 295]{../ps/2DppcE.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphTwoDPlaneTitle}{Plotting Plane Algebraic Curves}
\newcommand{\ugGraphTwoDPlaneNumber}{7.1.3.}
%
% =====================================================================
\begin{page}{ugGraphTwoDPlanePage}{7.1.3. Plotting Plane Algebraic Curves}
% =====================================================================
\beginscroll

A third kind of \twodim{} graph is a non-singular ``solution curve''
%-% \HDindex{curve!plane algebraic}{ugGraphTwoDPlanePage}{7.1.3.}{Plotting Plane Algebraic Curves}
in a rectangular region of the plane.
A solution curve is a curve defined by a polynomial equation
\spad{p(x,y) = 0}.
%-% \HDindex{plane algebraic curve}{ugGraphTwoDPlanePage}{7.1.3.}{Plotting Plane Algebraic Curves}
Non-singular means that the curve is ``smooth'' in that it does not
cross itself or come to a point (cusp).
Algebraically, this means that for any point \spad{(x,y)} on the curve,
that is, a point such that \spad{p(x,y) = 0}, the partial derivatives
\texht{${{\partial p}\over{\partial x}}(x,y)$ and
${{\partial p}\over{\partial y}}(x,y)$}{\spad{dp/dx(x,y)}
and \spad{dp/dy(a,b)}}
are not both zero.
%-% \HDindex{curve!smooth}{ugGraphTwoDPlanePage}{7.1.3.}{Plotting Plane Algebraic Curves}
%-% \HDindex{curve!non-singular}{ugGraphTwoDPlanePage}{7.1.3.}{Plotting Plane Algebraic Curves}
%-% \HDindex{smooth curve}{ugGraphTwoDPlanePage}{7.1.3.}{Plotting Plane Algebraic Curves}
%-% \HDindex{non-singular curve}{ugGraphTwoDPlanePage}{7.1.3.}{Plotting Plane Algebraic Curves}

%
\beginImportant
The general format for drawing a non-singular solution curve
given by a polynomial of the form \spad{p(x,y) = 0} is:
%
\centerline{{{\tt draw(p(x,y) = 0, x, y, range == [a..b, c..d], {\it options})}}}
where the second and third arguments name the first and second
independent variables of \spad{p}.
A {\tt range} option is always given to designate a bounding
rectangular region of the plane \texht{$a \leq x \leq b, c \leq y
\leq d$}{a <= x <= b, c <= y <= d}.
Zero or more additional options as described in
\downlink{``\ugGraphTwoDOptionsTitle''}{ugGraphTwoDOptionsPage} in Section \ugGraphTwoDOptionsNumber\ignore{ugGraphTwoDOptions} may be given.
\endImportant

\xtc{
We require that the polynomial has rational or integral coefficients.
Here is an algebraic curve example (``Cartesian ovals''):
%-% \HDindex{Cartesian!ovals}{ugGraphTwoDPlanePage}{7.1.3.}{Plotting Plane Algebraic Curves}
}{
\spadpaste{p := ((x^2 + y^2 + 1) - 8*x)^2 - (8*(x^2 + y^2 + 1)-4*x-1) \bound{p}}
}

\psXtc{
The first argument is always expressed as an equation of the form \spad{p = 0}
where \spad{p} is a polynomial.
}{
\graphpaste{draw(p = 0, x, y, range == [-1..11, -7..7]) \free{p}}
}{
\epsffile[0 0 295 295]{../ps/2DpacA.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphTwoDOptionsTitle}{Two-Dimensional Options}
\newcommand{\ugGraphTwoDOptionsNumber}{7.1.4.}
%
% =====================================================================
\begin{page}{ugGraphTwoDOptionsPage}{7.1.4. Two-Dimensional Options}
% =====================================================================
\beginscroll

The \spadfun{draw} commands take an optional list of options,
such as {\tt title} shown above.
Each option is given by the syntax: {\it name} {\tt ==} {\it value}.
Here is a list of the available options in the order that they are
described below.

\table{ {adaptive} {clip} {unit} {clip} {curveColor} {range}
{toScale} {pointColor} {coordinates}}

The \spad{adaptive} option turns adaptive plotting on or off.
%-% \HDindex{adaptive plotting}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
Adaptive plotting uses an algorithm that traverses a graph and computes
more points for those parts of the graph with high curvature.
The higher the curvature of a region is, the more points the algorithm
computes.
%-% \HDindex{graphics!2D options!adaptive}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
%
%
\psXtc{
The {\tt adaptive} option is normally on.
Here we turn it off.
}{
\graphpaste{draw(sin(1/x),x=-2*\%pi..2*\%pi, adaptive == false)}
}{
\epsffile[0 0 295 295]{../ps/2DOptAd.ps}
}
%
%
\psXtc{
The {\tt clip} option turns clipping on or off.
%-% \HDindex{graphics!2D options!clipping}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
If on, large values are cut off according to
\spadfunFrom{clipPointsDefault}{GraphicsDefaults}.
}{
\graphpaste{draw(tan(x),x=-2*\%pi..2*\%pi, clip == true)}
}{
\epsffile[0 0 295 295]{../ps/2DOptCp.ps}
}
%
%
\psXtc{
Option {\tt toScale} does plotting to scale if {\tt true} or uses
the entire viewport if {\tt false}.
The default can be determined using
\spadfunFrom{drawToScale}{GraphicsDefaults}.
%-% \HDindex{graphics!2D options!to scale}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
}{
\graphpaste{draw(sin(x),x=-\%pi..\%pi, toScale == true, unit == [1.0,1.0])}
}{
\epsffile[0 0 295 295]{../ps/2DOptSc.ps}
}
%
%
\psXtc{
Option {\tt clip} with a range sets point clipping of a graph within the
%-% \HDindex{graphics!2D options!clip in a range}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
ranges specified in the list \spad{[x range,y range]}.
%-% \HDindex{clipping}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
If only one range is specified, clipping applies to the y-axis.
}{
\graphpaste{draw(sec(x),x=-2*\%pi..2*\%pi, clip == [-2*\%pi..2*\%pi,-\%pi..\%pi], unit == [1.0,1.0])}
}{
\epsffile[0 0 295 295]{../ps/2DOptCpR.ps}
}
%
\psXtc{
Option {\tt curveColor} sets the color of the graph curves or lines to be the
%-% \HDindex{graphics!2D options!curve color}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
indicated palette color
%-% \HDindex{curve!color}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
(see \downlink{``\ugGraphColorTitle''}{ugGraphColorPage} in Section \ugGraphColorNumber\ignore{ugGraphColor} and \downlink{``\ugGraphColorPaletteTitle''}{ugGraphColorPalettePage} in Section \ugGraphColorPaletteNumber\ignore{ugGraphColorPalette}).
%-% \HDindex{color!curve}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
}{
\graphpaste{draw(sin(x),x=-\%pi..\%pi, curveColor == bright red())}
}{
\epsffile[0 0 295 295]{../ps/2DOptCvC.ps}
}
%
\psXtc{
Option {\tt pointColor}
sets the color of the graph points to the indicated
%-% \HDindex{graphics!2D options!point color}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
palette color
(see \downlink{``\ugGraphColorTitle''}{ugGraphColorPage} in Section \ugGraphColorNumber\ignore{ugGraphColor} and \downlink{``\ugGraphColorPaletteTitle''}{ugGraphColorPalettePage} in Section \ugGraphColorPaletteNumber\ignore{ugGraphColorPalette}).
%-% \HDindex{color!point}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
}{
\graphpaste{draw(sin(x),x=-\%pi..\%pi, pointColor == pastel yellow())}
}{
\epsffile[0 0 295 295]{../ps/2DOptPtC.ps}
}
%
\psXtc{
Option {\tt unit} sets the intervals at which the axis units are plotted
%-% \HDindex{graphics!2D options!set units}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
according to the indicated steps [\spad{x} interval, \spad{y} interval].
}{
\graphpaste{draw(curve(9*sin(3*t/4),8*sin(t)), t = -4*\%pi..4*\%pi, unit == [2.0,1.0])}
}{
\epsffile[0 0 295 295]{../ps/2DOptUt.ps}
}
%
%
\psXtc{
Option {\tt range} sets the range of variables in a graph to be
within the ranges
%-% \HDindex{graphics!2D options!range}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
for solving plane algebraic curve plots.
}{
\graphpaste{draw(y^2 + y - (x^3 - x) = 0, x, y, range == [-2..2,-2..1], unit==[1.0,1.0])}
}{
\epsffile[0 0 295 295]{../ps/2DOptRgA.ps}
}
%
%
\psXtc{
A second example of a solution plot.
}{
\graphpaste{draw(x^2 + y^2 = 1, x, y, range == [-3/2..3/2,-3/2..3/2], unit==[0.5,0.5])}
}{
\epsffile[0 0 295 295]{../ps/2DOptRgB.ps}
}
%
%
\psXtc{
Option \spad{coordinates} indicates the coordinate system
in which the graph
%-% \HDindex{graphics!2D options!coordinates}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
is plotted.
The default is to use the Cartesian coordinate system.
%-% \HDindex{Cartesian!coordinate system}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
For more details, see \downlink{``\ugGraphCoordTitle''}{ugGraphCoordPage} in Section \ugGraphCoordNumber\ignore{ugGraphCoord} \texht{.}{or
\spadtype{CoordinateSystems}.}
%-% \HDindex{coordinate system!Cartesian}{ugGraphTwoDOptionsPage}{7.1.4.}{Two-Dimensional Options}
}{
\graphpaste{draw(curve(sin(5*t),t),t=0..2*\%pi, coordinates == polar)}
}{
\epsffile[0 0 295 295]{../ps/2DOptPlr.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphColorTitle}{Color}
\newcommand{\ugGraphColorNumber}{7.1.5.}
%
% =====================================================================
\begin{page}{ugGraphColorPage}{7.1.5. Color}
% =====================================================================
\beginscroll

The domain \spadtype{Color}
%-% \HDexptypeindex{Color}{ugGraphColorPage}{7.1.5.}{Color}
provides operations for manipulating
%-% \HDindex{graphics!color}{ugGraphColorPage}{7.1.5.}{Color}
colors in \twodim{} graphs.
%-% \HDindex{color}{ugGraphColorPage}{7.1.5.}{Color}
Colors are objects of \spadtype{Color}.
Each color has a {\it hue} and a {\it weight}.
%-% \HDindex{hue}{ugGraphColorPage}{7.1.5.}{Color}
Hues are represented by integers that range from \spad{1} to the
\spadfunFrom{numberOfHues()}{Color}, normally
%-% \HDindex{graphics!color!number of hues}{ugGraphColorPage}{7.1.5.}{Color}
\spad{27}.
%\footnote{Use \spadfun{colorDef} to
%change these values to any range you want for a given \threedim{} viewport}
%-% \HDindex{weight}{ugGraphColorPage}{7.1.5.}{Color}
Weights are floats and  have the value \spad{1.0} by default.
%
\indent{0}
\beginitems
%
\item[\spadfun{color}]\funArgs{integer}
creates a color of hue {\it integer} and weight \spad{1.0}.
%
\item[\spadfun{hue}]\funArgs{color}
returns the hue of {\it color} as an integer.
%-% \HDindex{graphics!color!hue function}{ugGraphColorPage}{7.1.5.}{Color}
%
\item[\spadfun{red}]\funArgs{},
\funSyntax{blue}{},
\funSyntax{green}{}, and \funSyntax{yellow}{}
%-% \HDindex{graphics!color!primary color functions}{ugGraphColorPage}{7.1.5.}{Color}
create colors of that hue with weight \spad{1.0}.
%
\item[\subscriptIt{color}{1} {\tt +} \subscriptIt{color}{2}] returns the
color that results from additively combining the indicated
\subscriptIt{color}{1} and \subscriptIt{color}{2}.
Color addition is not commutative: changing the order of the arguments
produces different results.
%
\item[{\it integer} {\tt *} {\it color}]
changes the weight of {\it color} by {\it integer}
without affecting its hue.
%-% \HDindex{graphics!color!multiply function}{ugGraphColorPage}{7.1.5.}{Color}
For example,
\spad{red() + 3*yellow()} produces a color closer to yellow than to red.
Color multiplication is not associative: changing the order of grouping
%-% \HDindex{color!multiplication}{ugGraphColorPage}{7.1.5.}{Color}
produces different results.
\enditems
\indent{0}
%
\psXtc{
These functions can be used to change the point and curve colors
for two- and \threedim{} graphs.
Use the {\tt pointColor} option for points.
}{
\graphpaste{draw(x^2,x=-1..1,pointColor == green())}
}{
\epsffile[0 0 295 295]{../ps/23DColA.ps}
}
%
\psXtc{
Use the {\tt curveColor} option for curves.
}{
\graphpaste{draw(x^2,x=-1..1,curveColor == color(13) + 2*blue())}
}{
\epsffile[0 0 295 295]{../ps/23DColB.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphColorPaletteTitle}{Palette}
\newcommand{\ugGraphColorPaletteNumber}{7.1.6.}
%
% =====================================================================
\begin{page}{ugGraphColorPalettePage}{7.1.6. Palette}
% =====================================================================
\beginscroll
%-% \HDindex{graphics!palette}{ugGraphColorPalettePage}{7.1.6.}{Palette}

Domain \spadtype{Palette} is the domain of shades of colors:
\spadfun{dark}, \spadfun{dim}, \spadfun{bright}, \spadfun{pastel}, and \spadfun{light},
designated by the integers \spad{1} through \spad{5}, respectively.
%-% \HDexptypeindex{Palette}{ugGraphColorPalettePage}{7.1.6.}{Palette}
\xtc{
Colors are normally ``bright.''
}{
\spadpaste{shade red()}
}
\xtc{
To change the shade of a color, apply the name of a shade to it.
%-% \HDindex{color!shade}{ugGraphColorPalettePage}{7.1.6.}{Palette}
%-% \HDindex{shade}{ugGraphColorPalettePage}{7.1.6.}{Palette}
}{
\spadpaste{myFavoriteColor := dark blue() \bound{mfc}}
}
\xtc{
The expression \spad{shade(color)}
returns the value of a shade of \spad{color}.
}{
\spadpaste{shade myFavoriteColor \free{mfc}}
}
\xtc{
The expression \spad{hue(color)} returns its hue.
}{
\spadpaste{hue myFavoriteColor \free{mfc}}
}
\psXtc{
Palettes can be used in specifying colors in \twodim{} graphs.
}{
\graphpaste{draw(x^2,x=-1..1,curveColor == dark blue())}
}{
\epsffile[0 0 295 295]{../ps/23DPal.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphTwoDControlTitle}{Two-Dimensional Control-Panel}
\newcommand{\ugGraphTwoDControlNumber}{7.1.7.}
%
% =====================================================================
\begin{page}{ugGraphTwoDControlPage}{7.1.7. Two-Dimensional Control-Panel}
% =====================================================================
\beginscroll
%-% \HDindex{graphics!2D control-panel}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
Once you have created a viewport, move your mouse to the viewport and click
with your left mouse button to display a control-panel.
The panel is displayed on the side of the viewport closest to
where you clicked.  Each of the buttons which toggle on and off show the
current state of the graph.


\subsubsection{Transformations}
%-% \HDindex{graphics!2D control-panel!transformations}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}

Object transformations are executed from the control-panel by mouse-activated
potentiometer windows.
%
\indent{0}
\beginitems
%
\item[Scale:] To scale a graph, click on a mouse button
%-% \HDindex{graphics!2D control-panel!scale}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
within the {\bf Scale} window in the upper left corner of the control-panel.
The axes along which the scaling is to occur are indicated by setting the
toggles above the arrow.
With {\tt X On} and {\tt Y On} appearing, both axes are selected and scaling
is uniform.
If either is not selected, for example, if {\tt X Off} appears, scaling is
non-uniform.
%
\item[Translate:] To translate a graph, click the mouse in the
%-% \HDindex{graphics!2D control-panel!translate}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
{\bf Translate} window in the direction you wish the graph to move.
This window is located in the upper right corner of the control-panel.
Along the top of the {\bf Translate} window are two buttons for selecting
the direction of translation.
Translation along both coordinate axes results when {\tt X On} and {\tt Y
On} appear or along one axis when one is on, for example, {\tt X On} and
{\tt Y Off} appear.
\enditems
\indent{0}

\subsubsection{Messages}
%-% \HDindex{graphics!2D control-panel!messages}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}

The window directly below the transformation potentiometer windows is
used to display system messages relating to the viewport and the control-panel.
The following format is displayed: \newline
%
\centerline{{[scaleX, scaleY] \spad{>}graph\spad{<} [translateX, translateY] \newline}}
The two values to the left show the scale factor along the {\tt X} and
{\tt Y} coordinate axes.  The two values to the right show the distance of
translation from the center in the {\tt X} and {\tt Y} directions.  The number
in the center shows which graph in the viewport this data pertains to.
When multiple graphs exist in the same viewport,
the graph must be selected (see ``Multiple Graphs,'' below) in
order for its transformation data to be shown, otherwise the number
is 1.

\subsubsection{Multiple Graphs}

%-% \HDindex{graphics!2D control-panel!multiple graphs}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
The {\bf Graphs} window contains buttons that allow the placement
of \twodim{} graphs into one of nine available slots in any other
\twodim{} viewport.
In the center of the window are numeral buttons from one to nine
that show whether a graph is displayed in the viewport.
Below each number button is a button showing whether a graph
that is present is selected for application of some
transformation.
When the caret symbol is displayed, then the graph in that slot
will be manipulated.
Initially, the graph for which the viewport is created occupies
the first slot, is displayed, and is selected.
%
%
\indent{0}
\beginitems
%
\item[Clear:]  The {\bf Clear} button deselects every viewport graph slot.
%-% \HDindex{graphics!2D control-panel!clear}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
A graph slot is reselected by selecting the button below its number.
%
\item[Query:]  The {\bf Query} button is used to display the scale and
%-% \HDindex{graphics!2D control-panel!query}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
translate data for the indicated graph.  When this button is selected the
message ``Click on the graph to query'' appears.  Select a slot
number button from the {\bf Graphs} window. The scaling factor and translation
offset of the graph are then displayed in the message window.
%
\item[Pick:]  The {\bf Pick} button is used to select a graph
%-% \HDindex{graphics!2D control-panel!pick}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
to be placed or dropped into the indicated viewport.  When this button is
selected, the message ``Click on the graph to pick'' appears.
Click on the slot with the graph number of the desired
graph.  The graph information is held waiting for
you to execute a {\bf Drop} in some other graph.
%
\item[Drop:]  Once a graph has been picked up using the {\bf Pick} button,
%-% \HDindex{graphics!2D control-panel!drop}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
the {\bf Drop} button places it into a new viewport slot.
The message ``Click on the graph to drop'' appears in the message
window when the {\bf Drop} button is selected.
By selecting one of the slot number buttons in the {\bf Graphs}
window, the graph currently being held is dropped into this slot
and displayed.
\enditems
\indent{0}

\subsubsection{Buttons}
%-% \HDindex{graphics!2D control-panel!buttons}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}

%
\indent{0}
\beginitems
%
\item[Axes] turns the coordinate axes on or off.
%-% \HDindex{graphics!2D control-panel!axes}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
%
\item[Units] turns the units along the {\tt x}
and {\tt y} axis on or off.
%-% \HDindex{graphics!2D control-panel!units}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
%
\item[Box] encloses the area of the viewport graph
in a bounding box, or removes the box if already enclosed.
%-% \HDindex{graphics!2D control-panel!box}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
%
\item[Pts] turns on or off the display of points.
%-% \HDindex{graphics!2D control-panel!points}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
%
\item[Lines] turns on or off the display
of lines connecting points.
%-% \HDindex{graphics!2D control-panel!lines}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
%
\item[PS] writes the current viewport contents to
%-% \HDindex{graphics!2D control-panel!ps}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
a file {\bf fricas2D.ps}.
The file is placed in the directory from which \Language{} or the {\bf
viewAlone} program was invoked.
%-% \HDindex{PostScript}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
%
\item[Reset] resets the object transformation
characteristics and attributes back to their initial states.
%-% \HDindex{graphics!2D control-panel!reset}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
%
\item[Hide] makes the control-panel disappear.
%-% \HDindex{graphics!2D control-panel!hide}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
%
\item[Quit] queries whether the current viewport
%-% \HDindex{graphics!2D control-panel!quit}{ugGraphTwoDControlPage}{7.1.7.}{Two-Dimensional Control-Panel}
session should be terminated.
\enditems
\indent{0}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphTwoDopsTitle}{Operations for Two-Dimensional Graphics}
\newcommand{\ugGraphTwoDopsNumber}{7.1.8.}
%
% =====================================================================
\begin{page}{ugGraphTwoDopsPage}{7.1.8. Operations for Two-Dimensional Graphics}
% =====================================================================
\beginscroll

Here is a summary of useful \Language{} operations for \twodim{}
graphics.
Each operation name is followed by a list of arguments.
Each argument is written as a variable informally named according
to the type of the argument (for example, {\it integer}).
If appropriate, a default value for an argument is given in
parentheses immediately following the name.

%
\texht{\bgroup\hbadness = 10001\sloppy}{}
\indent{0}
\beginitems
%
\item[\spadfun{adaptive}]\funArgs{\optArg{boolean\argDef{true}}}
%-% \HDindex{adaptive plotting}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
sets or indicates whether graphs are plotted
%-% \HDindex{graphics!set 2D defaults!adaptive}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
according to the adaptive refinement algorithm.
%
\item[\spadfun{axesColorDefault}]\funArgs{\optArg{color\argDef{dark blue()}}}
sets or indicates the default color of the
%-% \HDindex{graphics!set 2D defaults!axes color}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
axes in a \twodim{} graph viewport.
%
\item[\spadfun{clipPointsDefault}]\funArgs{\optArg{boolean\argDef{false}}}
sets or
indicates whether point clipping is
%-% \HDindex{graphics!set 2D defaults!clip points}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
to be applied as the default for graph plots.
%
\item[\spadfun{drawToScale}]\funArgs{\optArg{boolean\argDef{false}}}
sets or
indicates whether the plot of a graph
%-% \HDindex{graphics!set 2D defaults!to scale}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
is ``to scale'' or uses the entire viewport space as the default.
%
\item[\spadfun{lineColorDefault}]\funArgs{\optArg{color\argDef{pastel yellow()}}}
sets or indicates the default color of the
%-% \HDindex{graphics!set 2D defaults!line color}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
lines or curves in a \twodim{} graph viewport.
%
\item[\spadfun{maxPoints}]\funArgs{\optArg{integer\argDef{500}}}
sets or indicates
the default maximum number of
%-% \HDindex{graphics!set 2D defaults!max points}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
possible points to be used when constructing a \twodim{} graph.
%
\item[\spadfun{minPoints}]\funArgs{\optArg{integer\argDef{21}}}
sets or indicates the default minimum number of
%-% \HDindex{graphics!set 2D defaults!min points}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
possible points to be used when constructing a \twodim{} graph.
%
\item[\spadfun{pointColorDefault}]\funArgs{\optArg{color\argDef{bright red()}}}
sets or indicates the default color of the
%-% \HDindex{graphics!set 2D defaults!point color}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
points in a \twodim{} graph viewport.
%
\item[\spadfun{pointSizeDefault}]\funArgs{\optArg{integer\argDef{5}}}
sets or indicates the default size of the
%-% \HDindex{graphics!set 2D defaults!point size}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
dot used to plot points in a \twodim{} graph.
%
\item[\spadfun{screenResolution}]\funArgs{\optArg{integer\argDef{600}}}
sets or indicates the default screen
%-% \HDindex{graphics!set 2D defaults!screen resolution}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
resolution constant used in setting the computation limit of adaptively
%-% \HDindex{adaptive plotting}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
generated curve plots.
%
\item[\spadfun{unitsColorDefault}]\funArgs{\optArg{color\argDef{dim green()}}}
sets or indicates the default color of the
%-% \HDindex{graphics!set 2D defaults!units color}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
unit labels in a \twodim{} graph viewport.
%
\item[\spadfun{viewDefaults}]\funArgs{}
resets the default settings for the following
%-% \HDindex{graphics!set 2D defaults!reset viewport}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
attributes:  point color, line color, axes color, units color, point size,
viewport upper left-hand corner position, and the viewport size.
%
\item[\spadfun{viewPosDefault}]\funArgs{\optArg{list\argDef{[100,100]}}}
sets or indicates the default position of the
%-% \HDindex{graphics!set 2D defaults!viewport position}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
upper left-hand corner of a \twodim{} viewport, relative to the
display root window.
The upper left-hand corner of the display is considered to be at the
(0, 0) position.
%
\item[\spadfun{viewSizeDefault}]\funArgs{\optArg{list\argDef{[200,200]}}}
sets or
indicates the default size in which two
%-% \HDindex{graphics!set 2D defaults!viewport size}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
dimensional viewport windows are shown.
It is defined by a width and then a height.
%
\item[\spadfun{viewWriteAvailable}]\funArgs{\optArg{list\argDef{["pixmap",
"bitmap", "postscript", \"image"}}}
indicates the possible file types
%-% \HDindex{graphics!2D defaults!available viewport writes}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
that can be created with the \spadfunFrom{write}{TwoDimensionalViewport} function.
%
\item[\spadfun{viewWriteDefault}]
\funArgs{\optArg{list\argDef{[]}}}
sets or indicates the default types of files, in
%-% \HDindex{graphics!set 2D defaults!write viewport}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
addition to the {\bf data} file, that are created when a
\spadfun{write} function is executed on a viewport.
%
\item[\spadfun{units}]\funArgs{viewport, integer\argDef{1}, string\argDef{"off"}}
turns the units on or off for the graph with index {\it integer}.
%
\item[\spadfun{axes}]\funArgs{viewport, integer\argDef{1}, string\argDef{"on"}}
turns the axes on
%-% \HDindex{graphics!2D commands!axes}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
or off for the graph with index {\it integer}.
%
\item[\spadfun{close}]\funArgs{viewport}
closes {\it viewport}.
%-% \HDindex{graphics!2D commands!close}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
%
\item[\spadfun{connect}]\funArgs{viewport, integer\argDef{1}, string\argDef{"on"}}
declares whether lines
%-% \HDindex{graphics!2D commands!connect}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
connecting the points are displayed or not.
%
\item[\spadfun{controlPanel}]\funArgs{viewport, string\argDef{"off"}}
declares
whether the \twodim{} control-panel is automatically displayed
or not.
%
\item[\spadfun{graphs}]\funArgs{viewport}
returns a list
%-% \HDindex{graphics!2D commands!graphs}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
describing the state of each graph.
If the graph state is not being used this is shown by {\tt "undefined"},
otherwise a description of the graph's contents is shown.
%
\item[\spadfun{graphStates}]\funArgs{viewport}
displays
%-% \HDindex{graphics!2D commands!state of graphs}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
a list of all the graph states available for {\it viewport}, giving the
values for every property.
%
\item[\spadfun{key}]\funArgs{viewport}
returns the process
%-% \HDindex{graphics!2D commands!key}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
ID number for {\it viewport}.
%
\item[\spadfun{move}]\funArgs{viewport,
\subscriptText{integer}{x}(viewPosDefault),
\subscriptText{integer}{y}(viewPosDefault)}
moves {\it viewport} on the screen so that the
%-% \HDindex{graphics!2D commands!move}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
upper left-hand corner of {\it viewport} is at the position {\it (x,y)}.
%
\item[\spadfun{options}]\funArgs{\it viewport}
returns a list
%-% \HDindex{graphics!2D commands!options}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
of all the \spadtype{DrawOption}s used by {\it viewport}.
%
\item[\spadfun{points}]\funArgs{viewport, integer\argDef{1}, string\argDef{"on"}}
specifies whether the graph points for graph {\it integer} are
%-% \HDindex{graphics!2D commands!points}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
to be displayed or not.
%
\item[\spadfun{region}]\funArgs{viewport, integer\argDef{1}, string\argDef{"off"}}
declares whether graph {\it integer} is or is not to be displayed
with a bounding rectangle.
%
\item[\spadfun{reset}]\funArgs{viewport}
resets all the properties of {\it viewport}.
%
\item[\spadfun{resize}]\funArgs{viewport,
\subscriptText{integer}{width}, \subscriptText{integer}{height}}
%-% \HDindex{graphics!2D commands!resize}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
resizes {\it viewport} with a new {\it width} and {\it height}.
%
\item[\spadfun{scale}]\funArgs{viewport, \subscriptText{integer}{n}\argDef{1},
\subscriptText{integer}{x}\argDef{0.9}, \subscriptText{integer}{y}\argDef{0.9}}
scales values for the
%-% \HDindex{graphics!2D commands!scale}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
{\it x} and {\it y} coordinates of graph {\it n}.
%
\item[\spadfun{show}]\funArgs{viewport, \subscriptText{integer}{n}\argDef{1},
string\argDef{"on"}}
indicates if graph {\it n} is shown or not.
%
\item[\spadfun{title}]\funArgs{viewport, string\argDef{"FriCAS 2D"}}
designates the title for {\it viewport}.
%
\item[\spadfun{translate}]\funArgs{viewport,
\subscriptText{integer}{n}\argDef{1},
\subscriptText{float}{x}\argDef{0.0}, \subscriptText{float}{y}\argDef{0.0}}
%-% \HDindex{graphics!2D commands!translate}{ugGraphTwoDopsPage}{7.1.8.}{Operations for Two-Dimensional Graphics}
causes graph {\it n} to be moved {\it x} and {\it y} units in the respective directions.
%
\item[\spadfun{write}]\funArgs{viewport, \subscriptText{string}{directory},
\optArg{strings}}
if no third argument is given, writes the {\bf data} file onto the directory
with extension {\bf data}.
The third argument can be a single string or a list of strings with some or
all the entries {\tt "pixmap"}, {\tt "bitmap"}, {\tt "postscript"}, and
{\tt "image"}.
\enditems
\indent{0}
\texht{\egroup}{}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphTwoDbuildTitle}{Addendum: Building Two-Dimensional Graphs}
\newcommand{\ugGraphTwoDbuildNumber}{7.1.9.}
%
% =====================================================================
\begin{page}{ugGraphTwoDbuildPage}{7.1.9. Addendum: Building Two-Dimensional Graphs}
% =====================================================================
\beginscroll

In this section we demonstrate how to create \twodim{} graphs from
lists of points and give an example showing how to read the lists
of points from a file.

\subsubsection{Creating a Two-Dimensional Viewport from a List of Points}

\Language{} creates lists of points in a \twodim{} viewport by utilizing
the \spadtype{GraphImage} and \spadtype{TwoDimensionalViewport} domains.
In this example, the \spadfunFrom{makeGraphImage}{GraphImage}
function takes a list of lists of points parameter, a list of colors for
each point in the graph, a list of colors for each line in the graph, and
a list of sizes for each point in the graph.
%
\xtc{
The following expressions create a list of lists of points which will be read
by \Language{} and made into a \twodim{} viewport.
}{
\spadpaste{p1 := point [1,1]\$(Point DFLOAT) \bound{p1}}
}
\xtc{
}{
\spadpaste{p2 := point [0,1]\$(Point DFLOAT) \bound{p2}}
}
\xtc{
}{
\spadpaste{p3 := point [0,0]\$(Point DFLOAT) \bound{p3}}
}
\xtc{
}{
\spadpaste{p4 := point [1,0]\$(Point DFLOAT) \bound{p4}}
}
\xtc{
}{
\spadpaste{p5 := point [1,.5]\$(Point DFLOAT) \bound{p5}}
}
\xtc{
}{
\spadpaste{p6 := point [.5,0]\$(Point DFLOAT) \bound{p6}}
}
\xtc{
}{
\spadpaste{p7 := point [0,0.5]\$(Point DFLOAT) \bound{p7}}
}
\xtc{
}{
\spadpaste{p8 := point [.5,1]\$(Point DFLOAT) \bound{p8}}
}
\xtc{
}{
\spadpaste{p9 := point [.25,.25]\$(Point DFLOAT) \bound{p9}}
}
\xtc{
}{
\spadpaste{p10 := point [.25,.75]\$(Point DFLOAT) \bound{p10}}
}
\xtc{
}{
\spadpaste{p11 := point [.75,.75]\$(Point DFLOAT) \bound{p11}}
}
\xtc{
}{
\spadpaste{p12 := point [.75,.25]\$(Point DFLOAT) \bound{p12}}
}
\xtc{
Finally, here is the list.
}{
\spadpaste{llp := [[p1,p2], [p2,p3], [p3,p4], [p4,p1], [p5,p6], [p6,p7], [p7,p8], [p8,p5], [p9,p10], [p10,p11], [p11,p12], [p12,p9]] \free{p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12} \bound{llp}}
}
\xtc{
Now we set the point sizes for all components of the graph.
}{
\spadpaste{size1 := 6::PositiveInteger \bound{size1}}
}
\xtc{
}{
}
\xtc{
}{
\spadpaste{size2 := 8::PositiveInteger \bound{size2}}
}
\xtc{
}{
\spadpaste{size3 := 10::PositiveInteger \bound{size3}}
}
\xtc{
}{
\spadpaste{lsize := [size1, size1, size1, size1, size2, size2, size2, size2, size3, size3, size3, size3] \bound{lsize} \free{size1 size2 size3}}
}
\xtc{
Here are the colors for the points.
}{
\spadpaste{pc1 := pastel red() \bound{pc1}}
}
\xtc{
}{
\spadpaste{pc2 := dim green() \bound{pc2}}
}
\xtc{
}{
\spadpaste{pc3 := pastel yellow() \bound{pc3}}
}
\xtc{
}{
\spadpaste{lpc := [pc1, pc1, pc1, pc1, pc2, pc2, pc2, pc2, pc3, pc3, pc3, pc3] \free{pc1 pc2 pc3} \bound{lpc}}
}
\xtc{
Here are the colors for the lines.
}{
\spadpaste{lc := [pastel blue(), light yellow(), dim green(), bright red(), light green(), dim yellow(), bright blue(), dark red(), pastel red(), light blue(), dim green(), light yellow()] \bound{lc}}
}
\xtc{
Now the \spadtype{GraphImage} is created according to the component
specifications indicated above.
}{
\spadpaste{g := makeGraphImage(llp,lpc,lc,lsize)\$GRIMAGE \bound{g} \free{llp lpc lc lsize}}
}
\psXtc{
The \spadfunFrom{makeViewport2D}{TwoDimensionalViewport} function now
creates a \spadtype{TwoDimensionalViewport} for this graph according to the
list of options specified within the brackets.
}{
\graphpaste{makeViewport2D(g,[title("Lines")])\$VIEW2D \free{g}}
}{
%
}
%See Figure #.#.
\xtc{
This example demonstrates the use of the \spadtype{GraphImage} functions
\spadfunFrom{component}{GraphImage} and \spadfunFrom{appendPoint}{GraphImage}
in adding points to an empty \spadtype{GraphImage}.
}{
\spadpaste{)clear all \bound{clearAll}}
}
\xtc{
}{
\spadpaste{g := graphImage()\$GRIMAGE \bound{Sg}\free{clearAll}}
}
\xtc{
}{
\spadpaste{p1 := point [0,0]\$(Point DFLOAT) \bound{Sp1}}
}
\xtc{
}{
\spadpaste{p2 := point [.25,.25]\$(Point DFLOAT) \bound{Sp2}}
}
\xtc{
}{
\spadpaste{p3 := point [.5,.5]\$(Point DFLOAT) \bound{Sp3}}
}
\xtc{
}{
\spadpaste{p4 := point [.75,.75]\$(Point DFLOAT) \bound{Sp4}}
}
\xtc{
}{
\spadpaste{p5 := point [1,1]\$(Point DFLOAT) \bound{Sp5}}
}
\xtc{
}{
\spadpaste{component(g,p1)\$GRIMAGE\free{Sg Sp1}\bound{gp1}}
}
\xtc{
}{
\spadpaste{component(g,p2)\$GRIMAGE\free{Sg Sp2}\bound{gp2}}
}
\xtc{
}{
\spadpaste{appendPoint(g,p3)\$GRIMAGE\free{gp1 gp2 Sp3}\bound{gp3}}
}
\xtc{
}{
\spadpaste{appendPoint(g,p4)\$GRIMAGE\free{gp3 Sp4}\bound{gp4}}
}
\xtc{
}{
\spadpaste{appendPoint(g,p5)\$GRIMAGE\free{gp4 Sp5}\bound{gp5}}
}
\psXtc{
Here is the graph.
}{
\graphpaste{makeViewport2D(g,[title("Graph Points")])\$VIEW2D \free{Sg gp5}}
}{
%
}
%
%See Figure #.#.
%
\xtc{
A list of points can also be made into a \spadtype{GraphImage} by using
the operation \spadfunFrom{coerce}{GraphImage}.  It is equivalent to adding
each point to \spad{g2} using \spadfunFrom{component}{GraphImage}.
}{
\spadpaste{g2 := coerce([[p1],[p2],[p3],[p4],[p5]])\$GRIMAGE  \free{Sp1 Sp2 Sp3 Sp4 Sp5} \bound{Sg2}}
}
\xtc{
Now, create an empty \spadtype{TwoDimensionalViewport}.
}{
\spadpaste{v := viewport2D()\$VIEW2D \bound{Sv}}
}
\xtc{
}{
\spadpaste{options(v,[title("Just Points")])\$VIEW2D \free{Sv}\bound{Svo}}
}
\xtc{
Place the graph into the viewport.
}{
\spadpaste{putGraph(v,g2,1)\$VIEW2D \free{Sg2 Svo}\bound{Svog2}}
}
\psXtc{
Take a look.
}{
\graphpaste{makeViewport2D(v)\$VIEW2D \free{Svog2}}
}{
%
}

%See Figure #.#.

\subsubsection{Creating a Two-Dimensional Viewport of a List of Points from a File}

The following three functions read a list of points from a
file and then draw the points and the connecting lines. The
points are stored in the file in readable form as floating point numbers
(specifically, \spadtype{DoubleFloat} values) as an alternating
stream of \spad{x}- and \spad{y}-values. For example,
\begin{verbatim}
0.0 0.0     1.0 1.0     2.0 4.0
3.0 9.0     4.0 16.0    5.0 25.0
\end{verbatim}

\beginImportant
  
\noindent
{\tt 1.\ \ \ drawPoints(lp:List\ Point\ DoubleFloat):VIEW2D\ ==}\newline
{\tt 2.\ \ \ \ \ g\ :=\ graphImage()\$GRIMAGE}\newline
{\tt 3.\ \ \ \ \ for\ p\ in\ lp\ repeat}\newline
{\tt 4.\ \ \ \ \ \ \ component(g,p,pointColorDefault(),lineColorDefault(),}\newline
{\tt 5.\ \ \ \ \ \ \ \ \ pointSizeDefault())}\newline
{\tt 6.\ \ \ \ \ makeViewport2D(g,[title("Points")])\$VIEW2D}\newline
{\tt 7.\ \ \ }\newline
{\tt 8.\ \ \ drawLines(lp:List\ Point\ DoubleFloat):VIEW2D\ ==}\newline
{\tt 9.\ \ \ \ \ g\ :=\ graphImage()\$GRIMAGE}\newline
{\tt 10.\ \ \ \ component(g,\ lp,\ pointColorDefault(),\ lineColorDefault(),}\newline
{\tt 11.\ \ \ \ \ \ pointSizeDefault())\$GRIMAGE}\newline
{\tt 12.\ \ \ \ makeViewport2D(g,[title("Points")])\$VIEW2D}\newline
{\tt 13.\ \ }\newline
{\tt 14.\ \ plotData2D(name,\ title)\ ==}\newline
{\tt 15.\ \ \ \ f:File(DFLOAT)\ :=\ open(name,"input")}\newline
{\tt 16.\ \ \ \ lp:LIST(Point\ DFLOAT)\ :=\ empty()}\newline
{\tt 17.\ \ \ \ while\ ((x\ :=\ readIfCan!(f))\ case\ DFLOAT)\ repeat}\newline
{\tt 18.\ \ \ \ \ \ y\ :\ DFLOAT\ :=\ read!(f)}\newline
{\tt 19.\ \ \ \ \ \ lp\ :=\ cons(point\ [x,y]\$(Point\ DFLOAT),\ lp)}\newline
{\tt 20.\ \ \ \ \ \ lp}\newline
{\tt 21.\ \ \ \ close!(f)}\newline
{\tt 22.\ \ \ \ drawPoints(lp)}\newline
{\tt 23.\ \ \ \ drawLines(lp)}\newline
\endImportant
%
This command will actually create the viewport and the graph if
the point data is in the file \spad{"file.data"}.
\beginImportant
  
\noindent
{\tt 1.\ \ \ plotData2D("file.data",\ "2D\ Data\ Plot")}\newline
\endImportant

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphTwoDappendTitle}{Addendum: Appending a Graph to a Viewport Window Containing a Graph}
\newcommand{\ugGraphTwoDappendNumber}{7.1.10.}
%
% =====================================================================
\begin{page}{ugGraphTwoDappendPage}{7.1.10. Addendum: Appending a Graph to a Viewport Window Containing a Graph}
% =====================================================================
\beginscroll

This section demonstrates how to append a \twodim{} graph to a viewport
already containing other graphs.
The default \spadfun{draw} command places a graph into the first
\spadtype{GraphImage} slot position of the \spadtype{TwoDimensionalViewport}.

\xtc{
This graph is in the first slot in its viewport.
}{
\spadpaste{v1 := draw(sin(x),x=0..2*\%pi) \bound{v1}}
}
\xtc{
So is this graph.
}{
\spadpaste{v2 := draw(cos(x),x=0..2*\%pi, curveColor==light red()) \bound{v2}}
}
\xtc{
The operation \spadfunFrom{getGraph}{TwoDimensionalViewport}
retrieves the \spadtype{GraphImage} \spad{g1} from the first slot position
in the viewport \spad{v1}.
}{
\spadpaste{g1 := getGraph(v1,1) \bound{g1}\free{v1}}
}
\xtc{
Now \spadfunFrom{putGraph}{TwoDimensionalViewport}
places \spad{g1} into the the second slot position of \spad{v2}.
}{
\spadpaste{putGraph(v2,g1,2) \bound{v22}\free{g1 v2}}
}
\psXtc{
Display the new \spadtype{TwoDimensionalViewport} containing both graphs.
}{
\graphpaste{makeViewport2D(v2) \free{v22}}
}{
%
}
Instead of using \spadfun{draw} to draw a graph and then extract
graph data we can use \spadfun{makeObject}.
\xtc{
First graph.
}{
\spadpaste{g3 := makeObject(sin(x),x=-1..\%pi,[]) \bound{g3}}
}
\xtc{
This graph is in the first slot in its viewport.
}{
\spadpaste{v3 := draw(cos(x),x=-1..\%pi, curveColor==light red()) \bound{v3}}
}
\xtc{
Now \spadfunFrom{putGraph}{TwoDimensionalViewport}
places \spad{g3} into the the second slot position of \spad{v3}.
}{
\spadpaste{putGraph(v3,g3,2) \bound{v33}\free{g3 v3}}
}
\psXtc{
Display the new \spadtype{TwoDimensionalViewport} containing both graphs.
}{
\graphpaste{makeViewport2D(v3) \free{v33}}
}{
%
}
\xtc{
The viewports \spad{v1}, \spad{v2} and \spad{v3} are no longer needed so
we close them.
}{
\spadpaste{close(v1); close(v2); close(v3) \free{v1 v2 v3}}
}

%
%See Figure #.#.
%

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphThreeDTitle}{Three-Dimensional Graphics}
\newcommand{\ugGraphThreeDNumber}{7.2.}
%
% =====================================================================
\begin{page}{ugGraphThreeDPage}{7.2. Three-Dimensional Graphics}
% =====================================================================
\beginscroll
%
The \Language{} \threedim{} graphics package provides the ability to
%-% \HDindex{graphics!three-dimensional}{ugGraphThreeDPage}{7.2.}{Three-Dimensional Graphics}
%
\indent{4}
\beginitems
%
\item[-] generate surfaces defined by a function of two real variables
%
\item[-] generate space curves and tubes defined by parametric equations
%
\item[-] generate surfaces defined by parametric equations
\enditems
\indent{0}
These graphs can be modified by using various options, such as calculating
points in the spherical coordinate system or changing the polygon grid size
of a surface.

\beginmenu
    \menudownlink{{7.2.1. Plotting Three-Dimensional Functions of Two Variables}}{ugGraphThreeDPlotPage}
    \menudownlink{{7.2.2. Plotting Three-Dimensional Parametric Space Curves}}{ugGraphThreeDParmPage}
    \menudownlink{{7.2.3. Plotting Three-Dimensional Parametric Surfaces}}{ugGraphThreeDParPage}
    \menudownlink{{7.2.4. Three-Dimensional Options}}{ugGraphThreeDOptionsPage}
    \menudownlink{{7.2.5. The makeObject Command}}{ugGraphMakeObjectPage}
    \menudownlink{{7.2.6. Building Three-Dimensional Objects From Primitives}}{ugGraphThreeDBuildPage}
    \menudownlink{{7.2.7. Coordinate System Transformations}}{ugGraphCoordPage}
    \menudownlink{{7.2.8. Three-Dimensional Clipping}}{ugGraphClipPage}
    \menudownlink{{7.2.9. Three-Dimensional Control-Panel}}{ugGraphThreeDControlPage}
    \menudownlink{{7.2.10. Operations for Three-Dimensional Graphics}}{ugGraphThreeDopsPage}
    \menudownlink{{7.2.11. Customization using .Xdefaults}}{ugXdefaultsPage}
\endmenu
\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphThreeDPlotTitle}{Plotting Three-Dimensional Functions of Two Variables}
\newcommand{\ugGraphThreeDPlotNumber}{7.2.1.}
%
% =====================================================================
\begin{page}{ugGraphThreeDPlotPage}{7.2.1. Plotting Three-Dimensional Functions of Two Variables}
% =====================================================================
\beginscroll

%-% \HDindex{surface!two variable function}{ugGraphThreeDPlotPage}{7.2.1.}{Plotting Three-Dimensional Functions of Two Variables}
The simplest \threedim{} graph is that of a surface defined by a function
of two variables, \spad{z = f(x,y)}.

%
\beginImportant
The general format for drawing a surface defined by a formula \spad{f(x,y)}
of two variables \spad{x} and \spad{y} is:
%
\centerline{{{\tt draw(f(x,y), x = a..b, y = c..d, {\it options})}}}
where \spad{a..b} and \spad{c..d} define the range of \spad{x}
and \spad{y}, and where {\it options} prescribes zero or more
options as described in \downlink{``\ugGraphThreeDOptionsTitle''}{ugGraphThreeDOptionsPage} in Section \ugGraphThreeDOptionsNumber\ignore{ugGraphThreeDOptions}.
An example of an option is \spad{title == "Title of Graph".}
An alternative format involving a function \spad{f} is also
available.
\endImportant

%
\psXtc{
The simplest way to plot a function of two variables is to use a formula.
With formulas you always precede the range specifications with
the variable name and an \spadSyntax{=} sign.
Notice that \Language{} uses the text of your function as a
default title.
}{
\graphpaste{draw(cos(x*y),x=-3..3,y=-3..3)}
}{
\epsffile[0 0 295 295]{../ps/3D2VarA.ps}
}
%
\xtc{
If you intend to use a function more than once,
or it is long and complex, then first
give its definition to \Language{}.
}{
\spadpaste{f(x,y) == sin(x)*cos(y) \bound{f}}
}
%
%
\psXtc{
To draw the function, just give its name and drop the variables
from the range specifications.
\Language{} compiles your function for efficient computation
of data for the graph.
}{
\graphpaste{draw(f,-\%pi..\%pi,-\%pi..\%pi) \free{f}}
}{
\epsffile[0 0 295 295]{../ps/3D2VarB.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphThreeDParmTitle}{Plotting Three-Dimensional Parametric Space Curves}
\newcommand{\ugGraphThreeDParmNumber}{7.2.2.}
%
% =====================================================================
\begin{page}{ugGraphThreeDParmPage}{7.2.2. Plotting Three-Dimensional Parametric Space Curves}
% =====================================================================
\beginscroll

A second kind of \threedim{} graph is a \threedim{} space curve
%-% \HDindex{curve!parametric space}{ugGraphThreeDParmPage}{7.2.2.}{Plotting Three-Dimensional Parametric Space Curves}
defined by the parametric equations for \spad{x(t)}, \spad{y(t)},
%-% \HDindex{parametric space curve}{ugGraphThreeDParmPage}{7.2.2.}{Plotting Three-Dimensional Parametric Space Curves}
and \spad{z(t)} as a function of an independent variable \spad{t}.

%
\beginImportant
The general format for drawing a \threedim{} space curve defined by
parametric formulas \spad{x = f(t)}, \spad{y = g(t)}, and
\spad{z = h(t)} is:
%
\centerline{{{\tt draw(curve(f(t),g(t),h(t)), t = a..b, {\it options})}}}
where \spad{a..b} defines the range of the independent variable
\spad{t}, and where {\it options} prescribes zero or more options
as described in \downlink{``\ugGraphThreeDOptionsTitle''}{ugGraphThreeDOptionsPage} in Section \ugGraphThreeDOptionsNumber\ignore{ugGraphThreeDOptions}.
An example of an option is \spad{title == "Title of Graph".}
An alternative format involving functions \spad{f}, \spad{g} and
\spad{h} is also available.
\endImportant

%
\psXtc{
If you use explicit formulas to draw a space curve, always precede
the range specification with the variable name and an
\spadSyntax{=} sign.
}{
\graphpaste{draw(curve(5*cos(t), 5*sin(t),t), t=-12..12)}
}{
\epsffile[0 0 295 295]{../ps/3DpscA.ps}
}
%
\xtc{
Alternatively, you can draw space curves by referring to functions.
}{
\spadpaste{i1(t:DFLOAT):DFLOAT == sin(t)*cos(3*t/5) \bound{i1}}
}
\xtc{
This is useful if the functions are to be used more than once \ldots
}{
\spadpaste{i2(t:DFLOAT):DFLOAT == cos(t)*cos(3*t/5) \bound{i2}}
}
\xtc{
or if the functions are long and complex.
}{
\spadpaste{i3(t:DFLOAT):DFLOAT == cos(t)*sin(3*t/5) \bound{i3}}
}
%
%
\psXtc{
Give the names of the functions and
drop the variable name specification in the second argument.
Again, \Language{} supplies a default title.
}{
\graphpaste{draw(curve(i1,i2,i3),0..15*\%pi) \free{i1 i2 i3}}
}{
\epsffile[0 0 295 295]{../ps/3DpscB.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphThreeDParTitle}{Plotting Three-Dimensional Parametric Surfaces}
\newcommand{\ugGraphThreeDParNumber}{7.2.3.}
%
% =====================================================================
\begin{page}{ugGraphThreeDParPage}{7.2.3. Plotting Three-Dimensional Parametric Surfaces}
% =====================================================================
\beginscroll

%-% \HDindex{surface!parametric}{ugGraphThreeDParPage}{7.2.3.}{Plotting Three-Dimensional Parametric Surfaces}
A third kind of \threedim{} graph is a surface defined by
%-% \HDindex{parametric surface}{ugGraphThreeDParPage}{7.2.3.}{Plotting Three-Dimensional Parametric Surfaces}
parametric equations for \spad{x(u,v)}, \spad{y(u,v)}, and
\spad{z(u,v)} of two independent variables \spad{u} and \spad{v}.

%
\beginImportant
The general format for drawing a \threedim{} graph defined by
parametric formulas \spad{x = f(u,v)}, \spad{y = g(u,v)},
and \spad{z = h(u,v)} is:
%
\centerline{{{\tt draw(surface(f(u,v),g(u,v),h(u,v)), u = a..b, v = c..d, {\it options})}}}
where \spad{a..b} and \spad{c..d} define the range of the
independent variables \spad{u} and \spad{v}, and where
{\it options} prescribes zero or more options as described in
\downlink{``\ugGraphThreeDOptionsTitle''}{ugGraphThreeDOptionsPage} in Section \ugGraphThreeDOptionsNumber\ignore{ugGraphThreeDOptions}.
An example of an option is \spad{title == "Title of Graph".}
An alternative format involving functions \spad{f}, \spad{g} and
\spad{h} is also available.
\endImportant

%
\psXtc{
This example draws a graph of a surface plotted using the
parabolic cylindrical coordinate system option.
%-% \HDindex{coordinate system!parabolic cylindrical}{ugGraphThreeDParPage}{7.2.3.}{Plotting Three-Dimensional Parametric Surfaces}
The values of the functions supplied to \spadfun{surface} are
%-% \HDindex{parabolic cylindrical coordinate system}{ugGraphThreeDParPage}{7.2.3.}{Plotting Three-Dimensional Parametric Surfaces}
interpreted in coordinates as given by a {\tt coordinates} option,
here as parabolic cylindrical coordinates (see
\downlink{``\ugGraphCoordTitle''}{ugGraphCoordPage} in Section \ugGraphCoordNumber\ignore{ugGraphCoord}).
}{
\graphpaste{draw(surface(u*cos(v), u*sin(v), v*cos(u)), u=-4..4, v=0..\%pi, coordinates== parabolicCylindrical)}
}{
\epsffile[0 0 295 295]{../ps/3DpsA.ps}
}
%
Again, you can graph these parametric surfaces using functions,
if the functions are long and complex.
\xtc{
Here we declare the types of arguments and values to be of type
\spadtype{DoubleFloat}.
}{
\spadpaste{n1(u:DFLOAT,v:DFLOAT):DFLOAT == u*cos(v) \bound{n1}}
}
\xtc{
As shown by previous examples, these declarations are necessary.
}{
\spadpaste{n2(u:DFLOAT,v:DFLOAT):DFLOAT == u*sin(v) \bound{n2}}
}
\xtc{
In either case, \Language{} compiles the functions
when needed to graph a result.
}{
\spadpaste{n3(u:DFLOAT,v:DFLOAT):DFLOAT == u \bound{n3}}
}
\xtc{
Without these declarations, you have to suffix floats
with \spad{@DFLOAT} to get a \spadtype{DoubleFloat} result.
However, a call here with an unadorned float produces a \spadtype{DoubleFloat}.
}{
\spadpaste{n3(0.5,1.0)\free{n3}}
}
%
%
\psXtc{
Draw the surface by referencing the function names, this time
choosing the toroidal coordinate system.
%-% \HDindex{coordinate system!toroidal}{ugGraphThreeDParPage}{7.2.3.}{Plotting Three-Dimensional Parametric Surfaces}
%-% \HDindex{toroidal coordinate system}{ugGraphThreeDParPage}{7.2.3.}{Plotting Three-Dimensional Parametric Surfaces}
}{
\graphpaste{draw(surface(n1,n2,n3), 1..4, 1..2*\%pi, coordinates == toroidal(1\$DFLOAT)) \free{n1 n2 n3}}
}{
\epsffile[0 0 295 295]{../ps/3DpsB.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphThreeDOptionsTitle}{Three-Dimensional Options}
\newcommand{\ugGraphThreeDOptionsNumber}{7.2.4.}
%
% =====================================================================
\begin{page}{ugGraphThreeDOptionsPage}{7.2.4. Three-Dimensional Options}
% =====================================================================
\beginscroll

%-% \HDindex{graphics!3D options}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
The \spadfun{draw} commands optionally take an optional list of options such
as {\tt coordinates} as shown in the last example.
Each option is given by the syntax: \spad{name} {\tt ==} \spad{value}.
Here is a list of the available options in the order that they are
described below:

\table{ {title} {coordinates} {var1Steps} {style} {tubeRadius} {var2Steps}
{colorFunction} {tubePoints} {space}}

\psXtc{
The option \spad{title} gives your graph a title.
%-% \HDindex{graphics!3D options!title}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
}{
\graphpaste{draw(cos(x*y),x=0..2*\%pi,y=0..\%pi,title == "Title of Graph") }
}{
\epsffile[0 0 295 295]{../ps/3DOptTtl.ps}
}
%
\psXtc{
The \spad{style} determines which of four rendering algorithms is used for
%-% \HDindex{rendering}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
the graph.
The choices are
{\tt "wireMesh"}, {\tt "solid"}, {\tt "shade"}, and {\tt "smooth"}.
}{
\graphpaste{draw(cos(x*y),x=-3..3,y=-3..3, style=="smooth", title=="Smooth Option")}
}{
\epsffile[0 0 295 295]{../ps/3DOptSty.ps}
}
%

In all but the wire-mesh style, polygons in a surface or tube plot
are normally colored in a graph according to their
\spad{z}-coordinate value.  Space curves are colored according to their
parametric variable value.
%-% \HDindex{graphics!3D options!color function}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
To change this, you can give a coloring function.
%-% \HDindex{function!coloring}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
The coloring function is sampled across the range of its arguments, then
normalized onto the standard \Language{} colormap.

\xtc{
A function of one variable  makes the color depend on the
value of the parametric variable specified for a tube plot.
}{
\spadpaste{color1(t) == t \bound{colorFxn1}}
}
\psXtc{
}{
\graphpaste{draw(curve(sin(t), cos(t),0), t=0..2*\%pi, tubeRadius == .3, colorFunction == color1) \free{colorFxn1}}
}{
\epsffile[0 0 295 295]{../ps/3DOptCf1.ps}
}
%
\xtc{
A function of two variables makes the color depend on the
values of the independent variables.
}{
\spadpaste{color2(u,v) == u^2 - v^2 \bound{colorFxn2}}
}
\psXtc{
Use the option {\tt colorFunction} for special coloring.
}{
\graphpaste{draw(cos(u*v), u=-3..3, v=-3..3, colorFunction == color2) \free{colorFxn2}}
}{
\epsffile[0 0 295 295]{../ps/3DOptCf2.ps}
}
%
\xtc{
With a three variable function, the
color also depends on the value of the function.
}{
\spadpaste{color3(x,y,fxy) == sin(x*fxy) + cos(y*fxy) \bound{colorFxn3}}
}
\psXtc{
}{
\graphpaste{draw(cos(x*y), x=-3..3, y=-3..3, colorFunction == color3) \free{colorFxn3}}
}{
\epsffile[0 0 295 295]{../ps/3DOptCf3.ps}
}
%
Normally the Cartesian coordinate system is used.
%-% \HDindex{Cartesian!coordinate system}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
To change this, use the {\tt coordinates} option.
%-% \HDindex{coordinate system!Cartesian}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
For details, see \downlink{``\ugGraphCoordTitle''}{ugGraphCoordPage} in Section \ugGraphCoordNumber\ignore{ugGraphCoord}.
%
%
\xtc{
}{
\spadpaste{m(u:DFLOAT,v:DFLOAT):DFLOAT == 1 \bound{m}}
}
\psXtc{
Use the spherical
%-% \HDindex{spherical coordinate system}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
coordinate system.
%-% \HDindex{coordinate system!spherical}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
}{
\graphpaste{draw(m, 0..2*\%pi,0..\%pi, coordinates == spherical, style=="shade") \free{m}}
}{
\epsffile[0 0 295 295]{../ps/3DOptCrd.ps}
}
%
Space curves may be displayed as tubes with polygonal cross sections.
%-% \HDindex{tube}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
Two options, {\tt tubeRadius} and {\tt tubePoints},  control the size and
shape of this cross section.
%
\psXtc{
The {\tt tubeRadius} option specifies the radius of the tube that
%-% \HDindex{tube!radius}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
encircles the specified space curve.
}{
\graphpaste{draw(curve(sin(t),cos(t),0),t=0..2*\%pi, style=="shade", tubeRadius == .3)}
}{
\epsffile[0 0 295 295]{../ps/3DOptRad.ps}
}
%
%
\psXtc{
The {\tt tubePoints} option specifies the number of vertices
%-% \HDindex{tube!points in polygon}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
defining the polygon that is used to create a tube around the
specified space curve.
The larger this number is, the more cylindrical the tube becomes.
}{
\graphpaste{draw(curve(sin(t), cos(t), 0), t=0..2*\%pi, style=="shade", tubeRadius == .25, tubePoints == 3)}
}{
\epsffile[0 0 295 295]{../ps/3DOptPts.ps}
}
%
%-% \HDindex{graphics!3D options!variable steps}{ugGraphThreeDOptionsPage}{7.2.4.}{Three-Dimensional Options}
%
%
\psXtc{
Options \spadfunFrom{var1Steps}{DrawOption} and
\spadfunFrom{var2Steps}{DrawOption} specify the number of intervals into
which the grid defining a surface plot is subdivided with respect to the
first and second parameters of the surface function(s).
}{
\graphpaste{draw(cos(x*y),x=-3..3,y=-3..3, style=="shade", var1Steps == 30, var2Steps == 30)}
}{
\epsffile[0 0 295 295]{../ps/3DOptvB.ps}
}
%
The {\tt space} option
of a \spadfun{draw} command lets you build multiple graphs in three space.
To use this option, first create an empty three-space object,
then use the {\tt space} option thereafter.
There is no restriction as to the number or kinds
of graphs that can be combined this way.
\xtc{
Create an empty three-space object.
}{
\spadpaste{s := create3Space()\$(ThreeSpace DFLOAT) \bound{s}}
}
%
%
\xtc{
}{
\spadpaste{m(u:DFLOAT,v:DFLOAT):DFLOAT == 1 \bound{m}}
}
\psXtc{
Add a graph to this three-space object.
The new graph destructively inserts the graph
into \spad{s}.
}{
\graphpaste{draw(m,0..\%pi,0..2*\%pi, coordinates == spherical, space == s) \free{s m}}
}{
\epsffile[0 0 295 295]{../ps/3Dmult1A.ps}
}
%
%
\psXtc{
Add a second graph to \spad{s}.
}{
\graphpaste{v := draw(curve(1.5*sin(t), 1.5*cos(t),0), t=0..2*\%pi, tubeRadius == .25, space == s) \free{s} \bound{v}}
}{
\epsffile[0 0 295 295]{../ps/3Dmult1B.ps}
}
%
A three-space object can also be obtained from an existing \threedim{} viewport
using the \spadfunFrom{subspace}{ThreeSpace} command.
You can then use \spadfun{makeViewport3D} to create a viewport window.
\xtc{
Assign to \spad{subsp} the three-space object in viewport \spad{v}.
}{
\spadpaste{subsp := subspace v \free{v} \bound{su}}
}
\xtc{
Reset the space component of \spad{v} to the value of \spad{subsp}.
}{
\spadpaste{subspace(v, subsp) \bound{sp} \free{su}}
}
\noOutputXtc{
Create a viewport window from a three-space object.
}{
\graphpaste{makeViewport3D(subsp,"Graphs") \free{sp}}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphMakeObjectTitle}{The makeObject Command}
\newcommand{\ugGraphMakeObjectNumber}{7.2.5.}
%
% =====================================================================
\begin{page}{ugGraphMakeObjectPage}{7.2.5. The makeObject Command}
% =====================================================================
\beginscroll

An alternate way to create multiple graphs is to use
\spadfun{makeObject}.
The \spadfun{makeObject} command is similar to the \spadfun{draw}
command, except that it returns a three-space object rather than a
\spadtype{ThreeDimensionalViewport}.
In fact, \spadfun{makeObject} is called by the \spadfun{draw}
command to create the \spadtype{ThreeSpace} then
\spadfunFrom{makeViewport3D}{ThreeDimensionalViewport} to create a
viewport window.

\xtc{
}{
\spadpaste{m(u:DFLOAT,v:DFLOAT):DFLOAT == 1 \bound{m}}
}
\noOutputXtc{
Do the last example a new way.
First use \spadfun{makeObject} to
create a three-space object \spad{sph}.
}{
\spadpaste{sph := makeObject(m, 0..\%pi, 0..2*\%pi, coordinates==spherical)\bound{sph}\free{m}}
}
\noOutputXtc{
Add a second object to \spad{sph}.
}{
\spadpaste{makeObject(curve(1.5*sin(t), 1.5*cos(t), 0), t=0..2*\%pi, space == sph, tubeRadius == .25) \free{sph}\bound{v1}}
}
\noOutputXtc{
Create and display a viewport
containing \spad{sph}.
}{
\graphpaste{makeViewport3D(sph,"Multiple Objects") \free{v1}}
}

Note that an undefined \spadtype{ThreeSpace} parameter declared in a
\spadfun{makeObject} or \spadfun{draw} command results in an error.
Use the \spadfunFrom{create3Space}{ThreeSpace} function to define a
\spadtype{ThreeSpace}, or obtain a \spadtype{ThreeSpace} that has been
previously generated before including it in a command line.

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphThreeDBuildTitle}{Building Three-Dimensional Objects From Primitives}
\newcommand{\ugGraphThreeDBuildNumber}{7.2.6.}
%
% =====================================================================
\begin{page}{ugGraphThreeDBuildPage}{7.2.6. Building Three-Dimensional Objects From Primitives}
% =====================================================================
\beginscroll

Rather than using the \spadfun{draw} and \spadfun{makeObject} commands,
%-% \HDindex{graphics!advanced!build 3D objects}{ugGraphThreeDBuildPage}{7.2.6.}{Building Three-Dimensional Objects From Primitives}
you can create \threedim{} graphs from primitives.
Operation \spadfunFrom{create3Space}{ThreeSpace} creates a
three-space object to which points, curves and polygons
can be added using the operations from the \spadtype{ThreeSpace}
domain.
The resulting object can then be displayed in a viewport using
\spadfunFrom{makeViewport3D}{ThreeDimensionalViewport}.

\xtc{
Create the empty three-space object \spad{space}.
}{
\spadpaste{space := create3Space()\$(ThreeSpace DFLOAT) \bound{space}}
}

Objects can be sent to this \spad{space} using the operations
exported by the \spadtype{ThreeSpace} domain.
%-% \HDexptypeindex{ThreeSpace}{ugGraphThreeDBuildPage}{7.2.6.}{Building Three-Dimensional Objects From Primitives}
The following examples place curves into \spad{space}.

\xtc{
Add these eight curves to the space.
}{
\spadpaste{closedCurve(space,[[0,30,20], [0,30,30], [0,40,30], [0,40,100], [0,30,100],[0,30,110], [0,60,110], [0,60,100], [0,50,100], [0,50,30], [0,60,30], [0,60,20]]) \bound{curve1} \free{space}}
}
\xtc{
}{
\spadpaste{closedCurve(space,[[80,0,30], [80,0,100], [70,0,110], [40,0,110], [30,0,100], [30,0,90], [40,0,90], [40,0,95], [45,0,100], [65,0,100], [70,0,95], [70,0,35]]) \bound{curve2} \free{space}}
}
\xtc{
}{
\spadpaste{closedCurve(space,[[70,0,35], [65,0,30], [45,0,30], [40,0,35], [40,0,60], [50,0,60], [50,0,70], [30,0,70], [30,0,30], [40,0,20], [70,0,20], [80,0,30]]) \bound{curve3} \free{space}}
}
\xtc{
}{
\spadpaste{closedCurve(space,[[0,70,20], [0,70,110], [0,110,110], [0,120,100], [0,120,70], [0,115,65], [0,120,60], [0,120,30], [0,110,20], [0,80,20], [0,80,30], [0,80,20]]) \bound{curve4} \free{space}}
}
\xtc{
}{
\spadpaste{closedCurve(space,[[0,105,30], [0,110,35], [0,110,55], [0,105,60], [0,80,60], [0,80,70], [0,105,70], [0,110,75], [0,110,95], [0,105,100], [0,80,100], [0,80,20], [0,80,30]]) \bound{curve5} \free{space}}
}
\xtc{
}{
\spadpaste{closedCurve(space,[[140,0,20], [140,0,110], [130,0,110], [90,0,20], [101,0,20],[114,0,50], [130,0,50], [130,0,60], [119,0,60], [130,0,85], [130,0,20]]) \bound{curve6} \free{space}}
}
\xtc{
}{
\spadpaste{closedCurve(space,[[0,140,20], [0,140,110], [0,150,110], [0,170,50], [0,190,110], [0,200,110], [0,200,20], [0,190,20], [0,190,75], [0,175,35], [0,165,35],[0,150,75], [0,150,20]]) \bound{curve7} \free{space}}
}
\xtc{
}{
\spadpaste{closedCurve(space,[[200,0,20], [200,0,110], [189,0,110], [160,0,45], [160,0,110], [150,0,110], [150,0,20], [161,0,20], [190,0,85], [190,0,20]]) \bound{curve8} \free{space}}
}
\psXtc{
Create and display the viewport using \spadfun{makeViewport3D}.
Options may also be given but here are displayed as a list with values
enclosed in parentheses.
}{
\graphpaste{makeViewport3D(space, title == "Letters") \free{space curve1 curve2 curve3 curve4 curve5 curve6 curve7 curve8}}
}{
\epsffile[0 0 295 295]{../ps/3DBuildA.ps}
}

\subsubsection{Cube Example}

As a second example of the use of primitives, we generate a cube using a
polygon mesh.
It is important to use a consistent orientation of the polygons for
correct generation of \threedim{} objects.

\xtc{
Again start with an empty three-space object.
}{
\spadpaste{spaceC := create3Space()\$(ThreeSpace DFLOAT) \bound{spaceC}}
}
\xtc{
For convenience,
give \spadtype{DoubleFloat} values \spad{+1} and \spad{-1} names.
}{
\spadpaste{x: DFLOAT := 1 \bound{x}}
}
\xtc{
}{
\spadpaste{y: DFLOAT := -1 \bound{y}}
}
\xtc{
Define the vertices of the cube.
}{
\spadpaste{a := point [x,x,y,1::DFLOAT]\$(Point DFLOAT) \bound{a} \free{x y}}
}
\xtc{
}{
\spadpaste{b := point [y,x,y,4::DFLOAT]\$(Point DFLOAT) \bound{b} \free{x y}}
}
\xtc{
}{
\spadpaste{c := point [y,x,x,8::DFLOAT]\$(Point DFLOAT) \bound{c} \free{x y}}
}
\xtc{
}{
\spadpaste{d := point [x,x,x,12::DFLOAT]\$(Point DFLOAT) \bound{d} \free{x y}}
}
\xtc{
}{
\spadpaste{e := point [x,y,y,16::DFLOAT]\$(Point DFLOAT) \bound{e} \free{x y}}
}
\xtc{
}{
\spadpaste{f := point [y,y,y,20::DFLOAT]\$(Point DFLOAT) \bound{f} \free{x y}}
}
\xtc{
}{
\spadpaste{g := point [y,y,x,24::DFLOAT]\$(Point DFLOAT) \bound{g} \free{x y}}
}
\xtc{
}{
\spadpaste{h := point [x,y,x,27::DFLOAT]\$(Point DFLOAT) \bound{h} \free{x y}}
}
\xtc{
Add the faces of the cube as polygons to the space using a
consistent orientation.
}{
\spadpaste{polygon(spaceC,[d,c,g,h]) \free{d c g h spaceC} \bound{pol1}}
}
\xtc{
}{
\spadpaste{polygon(spaceC,[d,h,e,a]) \free{d h e a spaceC} \bound{pol2}}
}
\xtc{
}{
\spadpaste{polygon(spaceC,[c,d,a,b]) \free{c d a b spaceC} \bound{pol3}}
}
\xtc{
}{
\spadpaste{polygon(spaceC,[g,c,b,f]) \free{g c b f spaceC} \bound{pol4}}
}
\xtc{
}{
\spadpaste{polygon(spaceC,[h,g,f,e]) \free{h g f e spaceC} \bound{pol5}}
}
\xtc{
}{
\spadpaste{polygon(spaceC,[e,f,b,a]) \free{e f b a spaceC} \bound{pol6}}
}
\psXtc{
Create and display the viewport.
}{
\graphpaste{makeViewport3D(spaceC, title == "Cube") \free{pol1 pol2 pol3 pol4 pol5 pol6}}
}{
\epsffile[0 0 295 295]{../ps/3DBuildB.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphCoordTitle}{Coordinate System Transformations}
\newcommand{\ugGraphCoordNumber}{7.2.7.}
%
% =====================================================================
\begin{page}{ugGraphCoordPage}{7.2.7. Coordinate System Transformations}
% =====================================================================
\beginscroll
%-% \HDindex{graphics!advanced!coordinate systems}{ugGraphCoordPage}{7.2.7.}{Coordinate System Transformations}

The \spadtype{CoordinateSystems} package provides coordinate transformation
functions that map a given data point from the coordinate system specified
into the Cartesian coordinate system.
%-% \HDexptypeindex{CoordinateSystems}{ugGraphCoordPage}{7.2.7.}{Coordinate System Transformations}
The default coordinate system, given a triplet \spad{(f(u,v), u, v)}, assumes
that \spad{z = f(u, v)}, \spad{x = u} and \spad{y = v},
that is, reads the coordinates in \spad{(z, x, y)} order.

\xtc{
}{
\spadpaste{m(u:DFLOAT,v:DFLOAT):DFLOAT == u^2 \bound{m}}
}
%
\psXtc{
Graph plotted in default coordinate system.
}{
\graphpaste{draw(m,0..3,0..5) \free{m}}
}{
\epsffile[0 0 295 295]{../ps/defcoord.ps}
}

The \spad{z} coordinate comes first since the first argument of
the \spadfun{draw} command gives its values.
In general, the coordinate systems \Language{} provides, or any
that you make up, must provide a map to an \spad{(x, y, z)} triplet in
order to be compatible with the
\spadfunFrom{coordinates}{DrawOption} \spadtype{DrawOption}.
%-% \HDexptypeindex{DrawOption}{ugGraphCoordPage}{7.2.7.}{Coordinate System Transformations}
Here is an example.

\xtc{
Define the identity function.
}{
\spadpaste{cartesian(point:Point DFLOAT):Point DFLOAT == point \bound{cart}}
}
\psXtc{
Pass \spad{cartesian} as the \spadfunFrom{coordinates}{DrawOption}
parameter to the \spadfun{draw} command.
}{
\graphpaste{draw(m,0..3,0..5,coordinates==cartesian) \free{m cart}}
}{
\epsffile[0 0 295 295]{../ps/cartcoord.ps}
}
%

What happened?
The option {\tt coordinates == cartesian} directs \Language{} to
treat the dependent variable \spad{m} defined by
\texht{$m=u^2$}{m=u^2} as the \spad{x} coordinate.
Thus the triplet of values \spad{(m, u, v)} is transformed to
coordinates \spad{(x, y, z)} and so we get the graph of
\texht{$x=y^2$}{x=y^2}.

Here is another example.
The \spadfunFrom{cylindrical}{CoordinateSystems} transform takes
%-% \HDindex{coordinate system!cylindrical}{ugGraphCoordPage}{7.2.7.}{Coordinate System Transformations}
input of the form \spad{(w,u,v)}, interprets it in the order
%-% \HDindex{cylindrical coordinate system}{ugGraphCoordPage}{7.2.7.}{Coordinate System Transformations}
\texht{($r$,$\theta$,$z$)}{(\spad{r}, \spad{theta}, \spad{z})}
and maps it to the Cartesian coordinates
\texht{$x=r\cos(\theta)$, $y=r\sin(\theta)$, $z=z$}
{\spad{x = r * cos(theta)}, \spad{y = r * sin(theta)}, \spad{z = z}}
in which
\texht{$r$}{\spad{r}} is the radius,
\texht{$\theta$}{\spad{theta}} is the angle and
\texht{$z$}{\spad{z}} is the z-coordinate.
\xtc{
An example using the \spadfunFrom{cylindrical}{CoordinateSystems}
coordinates for the constant \spad{r = 3}.
}{
\spadpaste{f(u:DFLOAT,v:DFLOAT):DFLOAT == 3 \bound{f}}
}
\psXtc{
Graph plotted in cylindrical coordinates.
}{
\graphpaste{draw(f,0..\%pi,0..6,coordinates==cylindrical) \free{f}}
}{
\epsffile[0 0 295 295]{../ps/cylCoord.ps}
}

Suppose you would like to specify \smath{z} as a function of
\smath{r} and \texht{$\theta$}{\spad{theta}} instead of just
\smath{r}?
Well, you still can use the \spadfun{cylindrical} \Language{}
transformation but we have to reorder the triplet before
passing it to the transformation.

\xtc{
First, let's create a point to
work with and call it \spad{pt} with some color \spad{col}.
}{
\spadpaste{col := 5 \bound{c}}
}
\xtc{
}{
\spadpaste{pt := point[1,2,3,col]\$(Point DFLOAT) \free{c} \bound{pt}}
}
The reordering you want is
\texht{$(z,r, \theta)$}{\spad{(z,r,theta)}} to
\texht{$(r, \theta,z)$}{\spad{(r,theta,z)}}
so that the first element is moved to the third element, while the second
and third elements move forward and the color element does not change.
\xtc{
Define a function \userfun{reorder} to reorder the point elements.
}{
\spadpaste{reorder(p:Point DFLOAT):Point DFLOAT == point[p.2, p.3, p.1, p.4] \bound{freo}}
}
\xtc{
The function moves the second and third elements
forward but the color does not change.
}{
\spadpaste{reorder pt \free{pt freo}}
}
\xtc{
The function \userfun{newmap} converts our reordered version of
the cylindrical coordinate system to the standard
\texht{$(x,y,z)$}{\spad{(x,y,z)}} Cartesian system.
}{
\spadpaste{newmap(pt:Point DFLOAT):Point DFLOAT == cylindrical(reorder pt) \free{freo} \bound{fnewmap}}
}
\xtc{
}{
\spadpaste{newmap pt \free{fnewmap pt} \bound{new}}
}
%
\psXtc{
Graph the same function \spad{f} using the coordinate mapping of the function
\spad{newmap}, so it is now interpreted as
\texht{$z=3$}{\spad{z = 3}}:
}{
\graphpaste{draw(f,0..3,0..2*\%pi,coordinates==newmap) \free{f new}}
}{
\epsffile[0 0 295 295]{../ps/newmap.ps}
}

{\texht{\sloppy}{}
The \spadtype{CoordinateSystems} package exports the following
%-% \HDindex{coordinate system}{ugGraphCoordPage}{7.2.7.}{Coordinate System Transformations}
operations:
\spadfun{bipolar},
\spadfun{bipolarCylindrical},
\spadfun{cartesian},
\spadfun{conical},
\spadfun{cylindrical},
\spadfun{elliptic},
\spadfun{ellipticCylindrical},
\spadfun{oblateSpheroidal},
\spadfun{parabolic},
\spadfun{parabolicCylindrical},
\spadfun{paraboloidal},
\spadfun{polar},
\spadfun{prolateSpheroidal},
\spadfun{spherical}, and
\spadfun{toroidal}.
Use \Browse{} or the \spadcmd{)show} system command
%-% \HDsyscmdindex{show}{ugGraphCoordPage}{7.2.7.}{Coordinate System Transformations}
to get more information.

}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphClipTitle}{Three-Dimensional Clipping}
\newcommand{\ugGraphClipNumber}{7.2.8.}
%
% =====================================================================
\begin{page}{ugGraphClipPage}{7.2.8. Three-Dimensional Clipping}
% =====================================================================
\beginscroll

A \threedim{} graph can be explicitly clipped within the \spadfun{draw}
%-% \HDindex{graphics!advanced!clip}{ugGraphClipPage}{7.2.8.}{Three-Dimensional Clipping}
command by indicating a minimum and maximum threshold for the
%-% \HDindex{clipping}{ugGraphClipPage}{7.2.8.}{Three-Dimensional Clipping}
given function definition.
These thresholds can be defined using the \Language{} \spadfun{min}
and \spadfun{max} functions.
\xtc{
}{
\begin{spadsrc}[\bound{g}]
gamma(x,y) ==
  g := Gamma complex(x,y)
  point [x, y, max( min(real g, 4), -4), argument g]
\end{spadsrc}
}
\psXtc{
Here is an example that clips
the gamma function in order to eliminate the extreme divergence it creates.
}{
\graphpaste{draw(gamma,-\%pi..\%pi,-\%pi..\%pi,var1Steps==50,var2Steps==50) \free{g}}
}{
\epsffile[0 0 295 295]{../ps/clipGamma.ps}
}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphThreeDControlTitle}{Three-Dimensional Control-Panel}
\newcommand{\ugGraphThreeDControlNumber}{7.2.9.}
%
% =====================================================================
\begin{page}{ugGraphThreeDControlPage}{7.2.9. Three-Dimensional Control-Panel}
% =====================================================================
\beginscroll
%-% \HDindex{graphics!3D control-panel}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
Once you have created a viewport, move your mouse to the viewport
and click with your left mouse button.
This displays a control-panel on the side of the viewport
that is closest to where you clicked.


\subsubsection{Transformations}

We recommend you first select the {\bf Bounds} button while
%-% \HDindex{graphics!3D control-panel!transformations}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
executing transformations since the bounding box displayed
indicates the object's position as it changes.
%
\indent{0}
\beginitems
%
\item[Rotate:]  A rotation transformation occurs by clicking the mouse
%-% \HDindex{graphics!3D control-panel!rotate}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
within the {\bf Rotate} window in the upper left corner of the
control-panel.
The rotation is computed in spherical coordinates, using the
horizontal mouse position to increment or decrement the value of
the longitudinal angle \texht{$\theta$}{\spad{theta}} within the
range of 0 to \texht{2$\pi$}{2*pi} and the vertical mouse position
to increment or decrement the value of the latitudinal angle
\texht{$\phi$}{\spad{phi}} within the range of \texht{-$\pi$}{pi}
to \texht{$\pi$}{pi}.
The active mode of rotation is displayed in green on a color
monitor or in clear text on a black and white monitor, while the
inactive mode is displayed in red for color display or a mottled
pattern for black and white.
%
\indent{0}
\beginitems
%
\item[origin:]  The {\bf origin} button indicates that the
rotation is to occur with respect to the origin of the viewing space, that is
indicated by the axes.
%
\item[object:]  The {\bf object} button indicates that the
rotation is to occur with respect to the center of volume of the object,
independent of the axes' origin position.
\enditems
\indent{0}
%
\item[Scale:]  A scaling transformation occurs by clicking the mouse
%-% \HDindex{graphics!3D control-panel!scale}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
within the {\bf Scale} window in the upper center of the
control-panel, containing a zoom arrow.
The axes along which the scaling is to occur are indicated by
selecting the appropriate button above the zoom arrow window.
The selected axes are displayed in green on a color monitor or in
clear text on a black and white monitor, while the unselected axes
are displayed in red for a color display or a mottled pattern for
black and white.
%
\indent{0}
\beginitems
%
\item[uniform:]  Uniform scaling along the {\tt x}, {\tt y}
and {\tt z} axes occurs when all the axes buttons are selected.
%
\item[non-uniform:]  If any of the axes buttons are
not selected, non-uniform scaling occurs, that is, scaling occurs only in the
direction of the axes that are selected.
\enditems
\indent{0}
%
\item[Translate:]  Translation occurs by indicating with the mouse in the
%-% \HDindex{graphics!3D control-panel!translate}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
{\bf Translate} window the direction you want the graph to move.
This window is located in the upper right corner of the
control-panel and contains a potentiometer with crossed arrows
pointing up, down, left and right.
Along the top of the {\bf Translate} window are three buttons
({\bf XY},
{\bf XZ}, and {\bf YZ}) indicating the three orthographic projection planes.
Each orientates the group as a view into that plane.
Any translation of the graph occurs only along this plane.
\enditems
\indent{0}

\subsubsection{Messages}
%-% \HDindex{graphics!3D control-panel!messages}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}

The window directly below the potentiometer windows for transformations is
used to display system messages relating to the viewport, the control-panel
and the current graph displaying status.

\subsubsection{Colormap}
%-% \HDindex{graphics!3D control-panel!color map}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}

Directly below the message window is the colormap range indicator
window.
%-% \HDindex{colormap}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
The \Language{} Colormap shows a sampling of the spectrum from
which hues can be drawn to represent the colors of a surface.
The Colormap is composed of five shades for each of the hues along
this spectrum.
By moving the markers above and below the Colormap, the range of
hues that are used to color the existing surface are set.
The bottom marker shows the hue for the low end of the color range
and the top marker shows the hue for the upper end of the range.
Setting the bottom and top markers at the same hue results in
monochromatic smooth shading of the graph when {\bf Smooth} mode is selected.
At each end of the Colormap are {\bf +} and {\bf -} buttons.
When clicked on, these increment or decrement the top or bottom
marker.

\subsubsection{Buttons}
%-% \HDindex{graphics!3D control-panel!buttons}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}

Below the Colormap window and to the left are located various
buttons that determine the characteristics of a graph.
The buttons along the bottom and right hand side all have special
meanings; the remaining buttons in the first row indicate the mode
or style used to display the graph.
The second row are toggles that turn on or off a property of the
graph.
On a color monitor, the property is on if green (clear text, on a
monochrome monitor) and off if red (mottled pattern, on a
monochrome monitor).
Here is a list of their functions.
%
\indent{0}
\beginitems
%
\item[Wire] displays surface and tube plots as a
%-% \HDindex{graphics!3D control-panel!wire}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
wireframe image in a single color (blue) with no hidden surfaces removed,
or displays space curve plots in colors based upon their parametric variables.
This is the fastest mode for displaying a graph.
This is very useful when you
want to find a good orientation of your graph.
%
\item[Solid] displays the graph with hidden
%-% \HDindex{graphics!3D control-panel!solid}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
surfaces removed, drawing each polygon beginning with the furthest
from the viewer.
The edges of the polygons are displayed in the hues specified by
the range in the Colormap window.
%
\item[Shade] displays the graph with hidden
%-% \HDindex{graphics!3D control-panel!shade}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
surfaces removed and with the polygons shaded, drawing each
polygon beginning with the furthest from the viewer.
Polygons are shaded in the hues specified by the range in the
Colormap window using the Phong illumination model.
%-% \HDindex{Phong!illumination model}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
%
\item[Smooth] displays the graph using a
%-% \HDindex{graphics!3D control-panel!smooth}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
renderer that computes the graph one line at a time.
The location and color of the graph at each visible point on the
screen are determined and displayed using the Phong illumination
%-% \HDindex{Phong!illumination model}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
model.
Smooth shading is done in one of two ways, depending on the range
selected in the colormap window and the number of colors available
from the hardware and/or window manager.
When the top and bottom markers of the colormap range are set to
different hues, the graph is rendered by dithering between the
%-% \HDindex{dithering}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
transitions in color hue.
When the top and bottom markers of the colormap range are set to
the same hue, the graph is rendered using the Phong smooth shading
model.
%-% \HDindex{Phong!smooth shading model}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
However, if enough colors cannot be allocated for this purpose,
the renderer reverts to the color dithering method until a
sufficient color supply is available.
For this reason, it may not be possible to render multiple Phong
smooth shaded graphs at the same time on some systems.
%
\item[Bounds] encloses the entire volume of the
viewgraph within a bounding box, or removes the box if previously selected.
%-% \HDindex{graphics!3D control-panel!bounds}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
The region that encloses the entire volume of the viewport graph is displayed.
%
\item[Axes] displays Cartesian
%-% \HDindex{graphics!3D control-panel!axes}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
coordinate axes of the space, or turns them off if previously selected.
%
\item[Outline] causes
%-% \HDindex{graphics!3D control-panel!outline}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
quadrilateral polygons forming the graph surface to be outlined in black when
the graph is displayed in {\bf Shade} mode.
%
\item[BW] converts a color viewport to black and white, or vice-versa.
%-% \HDindex{graphics!3D control-panel!bw}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
When this button is selected the
control-panel and viewport switch to an immutable colormap composed of a range
of grey scale patterns or tiles that are used wherever shading is necessary.
%
\item[Light] takes you to a control-panel described below.
%
\item[ViewVolume] takes you to another control-panel as described below.
%-% \HDindex{graphics!3D control-panel!save}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
%
\item[Save] creates a menu of the possible file types that can
be written using the control-panel.
The {\bf Exit} button leaves the save menu.
The {\bf Pixmap} button writes an \Language{} pixmap of
%-% \HDindex{graphics!3D control-panel!pixmap}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
the current viewport contents.  The file is called {\bf fricas3D.pixmap} and is
located in the directory from which \Language{} or {\bf viewAlone} was
started.
The {\bf PS} button writes the current viewport contents to
%-% \HDindex{graphics!3D control-panel!ps}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
PostScript output rather than to the viewport window.
By default the file is called {\bf fricas3D.ps}; however, if a file
%-% \HDindex{file!.Xdefaults @{\bf .Xdefaults}}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
name is specified in the user's {\bf .Xdefaults} file it is
%-% \HDindex{graphics!.Xdefaults!PostScript file name}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
used.
The file is placed in the directory from which the \Language{} or
{\bf viewAlone} session was begun.
See also the \spadfunFrom{write}{ThreeDimensionalViewport}
function.
%-% \HDindex{PostScript}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
%
\item[Reset] returns the object transformation
%-% \HDindex{graphics!3D control-panel!reset}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
characteristics back to their initial states.
%
\item[Hide] causes the control-panel for the
%-% \HDindex{graphics!3D control-panel!hide}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
corresponding viewport to disappear from the screen.
%
\item[Quit]  queries whether the current viewport
%-% \HDindex{graphics!3D control-panel!quit}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
session should be terminated.
\enditems
\indent{0}

\subsubsection{Light}
%-% \HDindex{graphics!3D control-panel!light}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}

%
%>>>\begin{texonly}
%
%>>>\begin{figure}[htbp]
%>>>\begin{picture}(183,252)(-125,0)
%>>>\special{psfile=../ps/3Dlight.ps}
%>>>\end{picture}
%>>>\caption{Three-Dimensional Lighting Panel.}
%>>>\end{figure}
%>>>\end{texonly}
%

The {\bf Light} button changes the control-panel into the
{\bf Lighting Control-Panel}.  At the top of this panel, the three axes
are shown with the same orientation as the object.  A light vector from
the origin of the axes shows the current position of the light source
relative to the object.  At the bottom of the panel is an {\bf Abort}
button that cancels any changes to the lighting that were made, and a
{\bf Return} button that carries out the current set of lighting changes
on the graph.
%
\indent{0}
\beginitems
%
\item[XY:]  The {\bf XY} lighting axes window is below the
%-% \HDindex{graphics!3D control-panel!move xy}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
{\bf Lighting Control-Panel} title and to the left.
This changes the light vector within the {\bf XY} view plane.
%
\item[Z:]  The {\bf Z} lighting axis window is below the
%-% \HDindex{graphics!3D control-panel!move z}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
{\bf Lighting Control-Panel} title and in the center.  This
changes the {\bf Z}
location of the light vector.
%
\item[Intensity:]
Below the {\bf Lighting Control-Panel} title
%-% \HDindex{graphics!3D control-panel!intensity}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
and to the right is the light intensity meter.
Moving the intensity indicator down decreases the amount of
light emitted from the light source.
When the indicator is at the top of the meter the light source is
emitting at 100\% intensity.
At the bottom of the meter the light source is emitting at a level
slightly above ambient lighting.
\enditems
\indent{0}

\subsubsection{View Volume}
%-% \HDindex{graphics!3D control-panel!view volume}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}

The {\bf View Volume} button changes the control-panel into
the {\bf Viewing Volume Panel}.
At the bottom of the viewing panel is an {\bf Abort} button that
cancels any changes to the viewing volume that were made and a
{\it Return} button that carries out the current set of
viewing changes to the graph.
%
%>>>\begin{texonly}
%
%>>>\begin{figure}[htbp]
%>>>\begin{picture}(183,252)(-125,0)
%>>>\special{psfile=../ps/3Dvolume.ps}
%>>>\end{picture}
%>>>\caption{Three-Dimensional Volume Panel.}
%>>>\end{figure}
%>>>\end{texonly}
%
\indent{0}
\beginitems
%
\item[Eye Reference:]  At the top of this panel is the
%-% \HDindex{graphics!3D control-panel!eye reference}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
{\bf Eye Reference} window.
It shows a planar projection of the viewing pyramid from the eye
of the viewer relative to the location of the object.
This has a bounding region represented by the rectangle on the
left.
Below the object rectangle is the {\bf Hither} window.
By moving the slider in this window the hither clipping plane sets
%-% \HDindex{hither clipping plane}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
the front of the view volume.
As a result of this depth clipping all points of the object closer
to the eye than this hither plane are not shown.
The {\bf Eye Distance} slider to the right of the {\bf Hither}
slider is used to change the degree of perspective in the image.
%
\item[Clip Volume:]  The {\bf Clip Volume} window is at the
%-% \HDindex{graphics!3D control-panel!clip volume}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
bottom of the {\bf Viewing Volume Panel}.
On the right is a {\bf Settings} menu.
In this menu are buttons to select viewing attributes.
Selecting the {\bf Perspective} button computes the image using
perspective projection.
%-% \HDindex{graphics!3D control-panel!perspective}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
The {\bf Show Region} button indicates whether the clipping region
of the
%-% \HDindex{graphics!3D control-panel!show clip region}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
volume is to be drawn in the viewport and the {\bf Clipping On}
button shows whether the view volume clipping is to be in effect
when the image
%-% \HDindex{graphics!3D control-panel!clipping on}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
is drawn.
The left side of the {\bf Clip Volume} window shows the clipping
%-% \HDindex{graphics!3D control-panel!clip volume}{ugGraphThreeDControlPage}{7.2.9.}{Three-Dimensional Control-Panel}
boundary of the graph.
Moving the knobs along the {\bf X}, {\bf Y}, and {\bf Z} sliders
adjusts the volume of the clipping region accordingly.
\enditems
\indent{0}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugGraphThreeDopsTitle}{Operations for Three-Dimensional Graphics}
\newcommand{\ugGraphThreeDopsNumber}{7.2.10.}
%
% =====================================================================
\begin{page}{ugGraphThreeDopsPage}{7.2.10. Operations for Three-Dimensional Graphics}
% =====================================================================
\beginscroll

Here is a summary of useful \Language{} operations for \threedim{}
graphics.
Each operation name is followed by a list of arguments.
Each argument is written as a variable informally named according
to the type of the argument (for example, {\it integer}).
If appropriate, a default value for an argument is given in
parentheses immediately following the name.

%
\texht{\bgroup\hbadness = 10001\sloppy}{}
\indent{0}
\beginitems
%
\item[\spadfun{adaptive3D?}]\funArgs{}
tests whether space curves are to be plotted
%-% \HDindex{graphics!plot3d defaults!adaptive}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
according to the
%-% \HDindex{adaptive plotting}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
adaptive refinement algorithm.

%
\item[\spadfun{axes}]\funArgs{viewport, string\argDef{"on"}}
turns the axes on and off.
%-% \HDindex{graphics!3D commands!axes}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}

%
\item[\spadfun{close}]\funArgs{viewport}
closes the viewport.
%-% \HDindex{graphics!3D commands!close}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}

%
\item[\spadfun{colorDef}]\funArgs{viewport,
\subscriptIt{color}{1}\argDef{1}, \subscriptIt{color}{2}\argDef{27}}
sets the colormap
%-% \HDindex{graphics!3D commands!define color}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
range to be from
\subscriptIt{color}{1} to \subscriptIt{color}{2}.

%
\item[\spadfun{controlPanel}]\funArgs{viewport, string\argDef{"off"}}
declares whether the
%-% \HDindex{graphics!3D commands!control-panel}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
control-panel for the viewport is to be displayed or not.

%
\item[\spadfun{diagonals}]\funArgs{viewport, string\argDef{"off"}}
declares whether the
%-% \HDindex{graphics!3D commands!diagonals}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
polygon outline includes the diagonals or not.

%
\item[\spadfun{drawStyle}]\funArgs{viewport, style}
selects which of four drawing styles
%-% \HDindex{graphics!3D commands!drawing style}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
are used: {\tt "wireMesh", "solid", "shade",} or {\tt "smooth".}

%
\item[\spadfun{eyeDistance}]\funArgs{viewport,float\argDef{500}}
sets the distance of the eye from the origin of the object
%-% \HDindex{graphics!3D commands!eye distance}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
for use in the \spadfunFrom{perspective}{ThreeDimensionalViewport}.

%
\item[\spadfun{key}]\funArgs{viewport}
returns the operating
%-% \HDindex{graphics!3D commands!key}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
system process ID number for the viewport.

%
\item[\spadfun{lighting}]\funArgs{viewport,
\subscriptText{float}{x}\argDef{-0.5},
\subscriptText{float}{y}\argDef{0.5}, \subscriptText{float}{z}\argDef{0.5}}
sets the Cartesian
%-% \HDindex{graphics!3D commands!lighting}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
coordinates of the light source.

%
\item[\spadfun{modifyPointData}]\funArgs{viewport,integer,point}
replaces the coordinates of the point with
%-% \HDindex{graphics!3D commands!modify point data}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
the index {\it integer} with {\it point}.

%
\item[\spadfun{move}]\funArgs{viewport,
\subscriptText{integer}{x}\argDef{viewPosDefault},
\subscriptText{integer}{y}\argDef{viewPosDefault}}
moves the upper
%-% \HDindex{graphics!3D commands!move}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
left-hand corner of the viewport to screen position
\allowbreak
({\small \subscriptText{integer}{x}, \subscriptText{integer}{y}}).

%
\item[\spadfun{options}]\funArgs{viewport}
returns a list of all current draw options.

%
\item[\spadfun{outlineRender}]\funArgs{viewport, string\argDef{"off"}}
turns polygon outlining
%-% \HDindex{graphics!3D commands!outline}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
off or on when drawing in {\tt "shade"} mode.

%
\item[\spadfun{perspective}]\funArgs{viewport, string\argDef{"on"}}
turns perspective
%-% \HDindex{graphics!3D commands!perspective}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
viewing on and off.

%
\item[\spadfun{reset}]\funArgs{viewport}
resets the attributes of a viewport to their
%-% \HDindex{graphics!3D commands!reset}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
initial settings.

%
\item[\spadfun{resize}]\funArgs{viewport,
\subscriptText{integer}{width} \argDef{viewSizeDefault},
\subscriptText{integer}{height} \argDef{viewSizeDefault}}
resets the width and height
%-% \HDindex{graphics!3D commands!resize}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
values for a viewport.

%
\item[\spadfun{rotate}]\funArgs{viewport,
\subscriptText{number}{\texht{$\theta$}{\spad{theta}}}\argDef{viewThetaDefault},
\subscriptText{number}{\texht{$\phi$}{\spad{phi}}}\argDef{viewPhiDefault}}
rotates the viewport by rotation angles for longitude
({\it \texht{$\theta$}{\spad{theta}}}) and
latitude ({\it \texht{$\phi$}{\spad{phi}}}).
Angles designate radians if given as floats, or degrees if given
%-% \HDindex{graphics!3D commands!rotate}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
as integers.

%
\item[\spadfun{setAdaptive3D}]\funArgs{boolean\argDef{true}}
sets whether space curves are to be plotted
%-% \HDindex{graphics!plot3d defaults!set adaptive}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
according to the adaptive
%-% \HDindex{adaptive plotting}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
refinement algorithm.

%
\item[\spadfun{setMaxPoints3D}]\funArgs{integer\argDef{1000}}
 sets the default maximum number of possible
%-% \HDindex{graphics!plot3d defaults!set max points}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
points to be used when constructing a \threedim{} space curve.

%
\item[\spadfun{setMinPoints3D}]\funArgs{integer\argDef{49}}
sets the default minimum number of possible
%-% \HDindex{graphics!plot3d defaults!set min points}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
points to be used when constructing a \threedim{} space curve.

%
\item[\spadfun{setScreenResolution3D}]\funArgs{integer\argDef{500}}
sets the default screen resolution constant
%-% \HDindex{graphics!plot3d defaults!set screen resolution}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
used in setting the computation limit of adaptively
%-% \HDindex{adaptive plotting}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
generated \threedim{} space curve plots.

%
\item[\spadfun{showRegion}]\funArgs{viewport, string\argDef{"off"}}
declares whether the bounding
%-% \HDindex{graphics!3D commands!showRegion}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
box of a graph is shown or not.
%
\item[\spadfun{subspace}]\funArgs{viewport}
returns the space component.
%
\item[\spadfun{subspace}]\funArgs{viewport, subspace}
resets the space component
%-% \HDindex{graphics!3D commands!subspace}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
to {\it subspace}.

%
\item[\spadfun{title}]\funArgs{viewport, string}
gives the viewport the
%-% \HDindex{graphics!3D commands!title}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
title {\it string}.

%
\item[\spadfun{translate}]\funArgs{viewport,
\subscriptText{float}{x}\argDef{viewDeltaXDefault},
\subscriptText{float}{y}\argDef{viewDeltaYDefault}}
translates
%-% \HDindex{graphics!3D commands!translate}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
the object horizontally and vertically relative to the center of the viewport.

%
\item[\spadfun{intensity}]\funArgs{viewport,float\argDef{1.0}}
resets the intensity {\it I} of the light source,
%-% \HDindex{graphics!3D commands!intensity}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
\texht{$0 \le I \le 1.$}{{\it 0 \le I \le 1}.}

%
\item[\spadfun{tubePointsDefault}]\funArgs{\optArg{integer\argDef{6}}}
sets or indicates the default number of
%-% \HDindex{graphics!3D defaults!tube points}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
vertices defining the polygon that is used to create a tube around
a space curve.

%
\item[\spadfun{tubeRadiusDefault}]\funArgs{\optArg{float\argDef{0.5}}}
sets or indicates the default radius of
%-% \HDindex{graphics!3D defaults!tube radius}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
the tube that encircles a space curve.

%
\item[\spadfun{var1StepsDefault}]\funArgs{\optArg{integer\argDef{27}}}
sets or indicates the default number of
%-% \HDindex{graphics!3D defaults!var1 steps}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
increments into which the grid defining a surface plot is subdivided with
respect to the first parameter declared in the surface function.

%
\item[\spadfun{var2StepsDefault}]\funArgs{\optArg{integer\argDef{27}}}
sets or indicates the default number of
%-% \HDindex{graphics!3D defaults!var2 steps}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
increments into which the grid defining a surface plot is subdivided with
respect to the second parameter declared in the surface function.

%
\item[\spadfun{viewDefaults}]\funArgs{{\tt [}\subscriptText{integer}{%
point}, \subscriptText{integer}{line}, \subscriptText{integer}{axes},
\subscriptText{integer}{units}, \subscriptText{float}{point},
\allowbreak\subscriptText{list}{position},
\subscriptText{list}{size}{\tt ]}}
resets the default settings for the
%-% \HDindex{graphics!3D defaults!reset viewport defaults}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
point color, line color, axes color, units color, point size,
viewport upper left-hand corner position, and the viewport size.

%
\item[\spadfun{viewDeltaXDefault}]\funArgs{\optArg{float\argDef{0}}}
resets the default horizontal offset
%-% \HDindex{graphics!3D commands!deltaX default}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
from the center of the viewport, or returns the current default offset if no argument is given.

%
\item[\spadfun{viewDeltaYDefault}]\funArgs{\optArg{float\argDef{0}}}
resets the default vertical offset
%-% \HDindex{graphics!3D commands!deltaY default}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
from the center of the viewport, or returns the current default offset if no argument is given.

%
\item[\spadfun{viewPhiDefault}]\funArgs{\optArg{float\argDef{-\texht{$\pi$}{{\it pi}}/4}}}
resets the default latitudinal view angle,
or returns the current default angle if no argument is given.
%-% \HDindex{graphics!3D commands!phi default}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
\texht{$\phi$}{{\it phi}} is set to this value.

%
\item[\spadfun{viewpoint}]\funArgs{viewport, \subscriptText{float}{x},
\subscriptText{float}{y}, \subscriptText{float}{z}}
sets the viewing position in Cartesian coordinates.

%
\item[\spadfun{viewpoint}]\funArgs{viewport,
\subscriptText{float}{\texht{$\theta$}{\spad{theta}}},
\subscriptText{Float}{\texht{$\phi$}{\spad{phi}}}}
sets the viewing position in spherical coordinates.

%
\item[\spadfun{viewpoint}]\funArgs{viewport,
\subscriptText{Float}{\texht{$\theta$}{\spad{theta}}},
\subscriptText{Float}{\texht{$\phi$}{\spad{phi}}},
\subscriptText{Float}{scaleFactor},
\subscriptText{Float}{xOffset}, \subscriptText{Float}{yOffset}}
sets the viewing position in spherical coordinates,
the scale factor, and offsets.
%-% \HDindex{graphics!3D commands!viewpoint}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
\texht{$\theta$}{{\it theta}} (longitude) and
\texht{$\phi$}{{\it phi}} (latitude) are in radians.

%
\item[\spadfun{viewPosDefault}]\funArgs{\optArg{list\argDef{[0,0]}}}
sets or indicates the position of the upper
%-% \HDindex{graphics!3D defaults!viewport position}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
left-hand corner of a \twodim{} viewport, relative to the display root
window (the upper left-hand corner of the display is \spad{[0, 0]}).

%
\item[\spadfun{viewSizeDefault}]\funArgs{\optArg{list\argDef{[400,400]}}}
sets or indicates the width and height dimensions
%-% \HDindex{graphics!3D defaults!viewport size}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
of a viewport.

%
\item[\spadfun{viewThetaDefault}]\funArgs{\optArg{float\argDef{\texht{$\pi$}{{\it pi}}/4}}}
resets the default longitudinal view angle,
or returns the current default angle if no argument is given.
%-% \HDindex{graphics!3D commands!theta default}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
When a parameter is specified, the default longitudinal view angle
\texht{$\theta$}{{\it theta}} is set to this value.

%
\item[\spadfun{viewWriteAvailable}]\funArgs{\optArg{list\argDef{["pixmap",
"bitmap", "postscript", "image"}}}
indicates the possible file types
%-% \HDindex{graphics!3D defaults!available viewport writes}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
that can be created with the \spadfunFrom{write}{ThreeDimensionalViewport} function.

%
\item[\spadfun{viewWriteDefault}]\funArgs{\optArg{list\argDef{[]}}}
sets or indicates the default types of files
that are created in addition to the {\bf data} file when a
\spadfunFrom{write}{ThreeDimensionalViewport} command
%-% \HDindex{graphics!3D defaults!viewport writes}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
is executed on a viewport.

%
\item[\spadfun{write}]\funArgs{viewport, directory, \optArg{option}}
writes the file {\bf data} for {\it viewport}
in the directory {\it directory}.
An optional third argument specifies a file type (one of {\tt
pixmap}, {\tt bitmap}, {\tt postscript}, or {\tt image}), or a
list of file types.
An additional file is written for each file type listed.

%
\item[\spadfun{zoom}]\funArgs{viewport, float\argDef{2.5}}
specifies the scaling factor.
%-% \HDindex{graphics!3D commands!zoom}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
%-% \HDindex{scaling graphs}{ugGraphThreeDopsPage}{7.2.10.}{Operations for Three-Dimensional Graphics}
\enditems
\indent{0}
\texht{\egroup}{}

\endscroll
\autobuttons
\end{page}
%
%
\newcommand{\ugXdefaultsTitle}{Customization using .Xdefaults}
\newcommand{\ugXdefaultsNumber}{7.2.11.}
%
% =====================================================================
\begin{page}{ugXdefaultsPage}{7.2.11. Customization using .Xdefaults}
% =====================================================================
\beginscroll
%-% \HDindex{graphics!.Xdefaults}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}

Both the \twodim{} and \threedim{} drawing facilities consult
the {\bf .Xdefaults} file for various defaults.
%-% \HDindex{file!.Xdefaults @{\bf .Xdefaults}}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
The list of defaults that are recognized by the graphing routines
is discussed in this section.
These defaults are preceded by {\tt FriCAS.3D.}
for \threedim{} viewport defaults, {\tt FriCAS.2D.}
for \twodim{} viewport defaults, or {\tt FriCAS*} (no dot) for
those defaults that are acceptable to either viewport type.

%
\indent{0}
\beginitems
%
\item[{\tt FriCAS*buttonFont:\ \it font}] \ \newline
This indicates which
%-% \HDindex{graphics!.Xdefaults!button font}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
font type is used for the button text on the control-panel.
\xdefault{Rom11}
%
\item[{\tt FriCAS.2D.graphFont:\ \it font}] \quad (2D only) \newline
This indicates
%-% \HDindex{graphics!.Xdefaults!graph number font}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
which font type is used for displaying the graph numbers and
slots in the {\bf Graphs} section of the \twodim{} control-panel.
\xdefault{Rom22}
%
\item[{\tt FriCAS.3D.headerFont:\ \it font}] \ \newline
This indicates which
%-% \HDindex{graphics!.Xdefaults!graph label font}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
font type is used for the axes labels and potentiometer
header names on \threedim{} viewport windows.
This is also used for \twodim{} control-panels for indicating
which font type is used for potentionmeter header names and
multiple graph title headers.
%for example, {\tt FriCAS.2D.headerFont: 8x13}.
\xdefault{Itl14}
%
\item[{\tt FriCAS*inverse:\ \it switch}] \ \newline
This indicates whether the
%-% \HDindex{graphics!.Xdefaults!inverting background}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
background color is to be inverted from white to black.
If {\tt on}, the graph viewports use black as the background
color.
If {\tt off} or no declaration is made, the graph viewports use a
white background.
\xdefault{off}
%
\item[{\tt FriCAS.3D.lightingFont:\ \it font}] \quad (3D only) \newline
This indicates which font type is used for the {\bf x},
%-% \HDindex{graphics!.Xdefaults!lighting font}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
{\bf y}, and {\bf z} labels of the two lighting axes potentiometers, and for
the {\bf Intensity} title on the lighting control-panel.
\xdefault{Rom10}
%
\item[{\tt FriCAS.2D.messageFont, FriCAS.3D.messageFont:\ \it font}] \ \newline
These indicate the font type
%-% \HDindex{graphics!.Xdefaults!message font}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
to be used for the text in the control-panel message window.
\xdefault{Rom14}
%
\item[{\tt FriCAS*monochrome:\ \it switch}] \ \newline
This indicates whether the
%-% \HDindex{graphics!.Xdefaults!monochrome}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
graph viewports are to be displayed as if the monitor is black and
white, that is, a 1 bit plane.
If {\tt on} is specified, the viewport display is black and white.
If {\tt off} is specified, or no declaration for this default is
given, the viewports are displayed in the normal fashion for the
monitor in use.
\xdefault{off}
%
\item[{\tt FriCAS*titleFont \it font}] \ \newline
This
%-% \HDindex{graphics!.Xdefaults!title font}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
indicates which font type is used
for the title text and, for \threedim{} graphs,
in the lighting and viewing-volume control-panel windows.
%-% \HDindex{graphics!Xdefaults!2d}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
\xdefault{Rom14}
%
\item[{\tt FriCAS.2D.unitFont:\ \it font}] \quad (2D only) \newline
This indicates
%-% \HDindex{graphics!.Xdefaults!unit label font}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
which font type is used for displaying the unit labels on
\twodim{} viewport graphs.
\xdefault{6x10}
%
\item[{\tt FriCAS.3D.volumeFont:\ \it font}] \quad (3D only) \newline
This indicates which font type is used for the {\bf x},
%-% \HDindex{graphics!.Xdefaults!volume label font}{ugXdefaultsPage}{7.2.11.}{Customization using .Xdefaults}
{\bf y}, and {\bf z} labels of the clipping region sliders; for the
{\bf Perspective}, {\bf Show Region}, and {\bf Clipping On} buttons under
{\bf Settings}, and above the windows for the {\bf Hither} and
{\bf Eye Distance} sliders in the {\bf Viewing Volume Panel} of the
\threedim{} control-panel.
\xdefault{Rom8}
\enditems
\indent{0}
\endscroll
\autobuttons
\end{page}
%
