GRAPH3D.85G  draws 3-D graphs; group contains Graph3D.85P, ProjG3D.85P
These programs were written by Greg Ferrar.


Graph3D is a program for the TI-85 graphing calculator that creates graphs
of three-dimensional surfaces.  It has many features, including hidden line
removal, error checking, and the ability to customize the appearance of the
graph completely.

REQUIREMENTS

The program itself takes up approximately 9000 bytes of storage, and it
requires an additional 8000 bytes for its variables.  So you need to have
17000 bytes free to run Graph3D.

The Graph3D program is in two parts, one called "Graph3D" and another called
"ProjG3D".  Download both of these parts to your TI-85 to run Graph3D.

RUNNING GRAPH3D

Once you have downloaded both parts of the program, store a 0 (zero) in the
variable RunBfore, by typing

  0>RunBfore    (Note case-sensitivity)

where the > in the above line is the TI-85 Store character, which can be
entered by pressing the STO> button.  Storing a 0 in RunBfore tells Graph3D
that this is the first time you have run Graph3D on that calculator.  This
causes Graph3D to perform some initializations, and to reset the defaults. 
If you later want to reset the defaults at a later time, you can do so by
storing 0 into RunBfore before running Graph3D.

To run the program, select Graph3D from the PRGM/NAME menu.

HOW GRAPH3D GRAPHS

To use Graph3D effectively, you need to understand how it creates its
graphs, and what the various parameters mean.  The most important variable
is y1, the function.  Graph3D creates a graph of the function

  z = y1(x,y)

y1 can be any function of x and y.  The name y1 is used because in the
TI-85, y1 can easily be edited in the y(x)= editor.  It is also possible to
enter y1 from within the Graph3D program using the Eq option on the Main
menu.  If you have not defined y1 in the y(x) editor, Graph3D uses the 
default: 15e^(-.04(x^2+y^2))cos (.15(x^2+y^2))

The function y1 is plotted by evaluating it at a number of points, and then
connecting those points in a grid.  The points plotted are a rectangular
lattice ranging from xMin3D to xMax3D in the x direction, and from yMin3D
to yMax3D in the y direction.  The number of points between xMin3D and
xMax3D is determined by the value of xCuts3D, and the number of points
between yMin3D and yMax3D is determined by the value of yCuts3D.  xCuts3D
and yCuts3D, like xMin3D, xMax3D, and all other variables mentioned here,
can be easily viewed or edited from within Graph3D (see the menu commands
descriptions below for more information).

For instance, if xMin3D = -10, xMax3D = 10, yMin3D = -10, yMax3D = 10,
zMin3D = -10, zMax3D = 10, xCuts3D = 10, and yCuts3D = 10, then the lattice
would be composed of all points (x,y) where -10<x<10 and -10<y<10, and
where x and y were divisible by 2 (since there are 10 x cuts between -10
and 10, they are 2 apart; similarly for y cuts).  The function would be
plotted by evaluating y1 at each of these points (x,y) and, using y1 as z,
plotting each point (x,y,z).  Each point would be connected with its
neighbors with a line to make a grid.

The appearance of a three-dimensional surface changes when you look at it
from another angle.  For instance, the graph of z = 0 looks like a bunch of
squares when viewed from directly above, on the z axis.  But when viewed
from the x or y axis (or anywhere on the xy plane) it looks like a line. 
It is therefore necessary to select a point from which you wish the graph
to be viewed.  This is done in Graph3D through the use of three variables:
theta, phi, and magnification.  (On the TI-85, theta and phi appear as the
actual Greek letters.)  Graph3D automatically assumes that you are looking
directly at the center of the "viewing cube," defined by xMin3D, xMax3D,
yMin3D, yMax3D, zMin3D, and zMax3D.  With that as the center of the graph,
theta and phi are the spherical coordinates of the vantage point.

To understand what theta and phi are, get a piece of paper.  Draw a set of
x, y, and z axes.  Choose any vantage point, call it P.  Now drop a
perpendicular from P to the xy plane.  Call the point it hits A.  Theta is
the angle between the x axis and the line segment OA that connects the
origin to A.  Theta is measured counterclockwise, when looking down on the
xy plane from positive z.  Phi is the angle between the line segment OP
connecting the origin to P and the line segment OA.  Phi is positive when P
is above the xy plane, and negative when P is below.  For example, to
describe a view down the x axis from the positive side, you should use
theta = 0, phi = 0.  To describe a view down x from the negative side, use
theta = pi, phi = 0 (like theta and phi, pi appears on the TI-85 as the
actual Greek letter).  To describe a view from directly above down the
positive z axis, use theta = 0, phi = pi/2.  Using these angles, you can
choose any vantage point in the entire sphere.  The default is theta =
pi/6, phi = pi/6, which is a reasonable setting for viewing most graphs.

Graph3D also allows you to change the distance from the vantage point to
the center of the graph, by changing the magnification factor.  If the
graph appears too small, increasing the magnification will increase the
size of the graph.  Similarly, decreasing the magnification will decrease
the size of the graph.

Some functions like z = sqrt(100-x^2-y^2), are not defined at all points. 
When Graph3D encounters a point that is undefined, it uses the alternate
equation, y2.  For that point only, it chooses z = y2(x,y) instead of z =
y1(x,y).  It plots all lattice points of y1 that are defined, and uses y2
for all points that are not defined.  If you have not defined y2 in the
y(x) editor, Graph3D uses the default y2=0 (z = 0) instead.

The alternate equation can also be used in another way.  When the equation
AltFl (alternate flag) is TRUE (in other words, has a nonzero result when
evaluated), the alternate equation y2 is used instead of y1.  If AltFl is
a function in terms of x and y, a single graph can contain some sections of
y1 and some sections of y2, depending on AltFl.  For instance if y1 = 4,
y2 = -4, and AltFl = x>y, then the function plotted has value 4 when
x<=y, and -4 when x>y.  Note that AltFl can (and usually will) contain
Boolean expressions like "x>y" or "not ((x>y) and (2y>4))".

Graph3D has several options that affect the appearance of the graph.  One
is the hidden line removal option.  When hidden line removal is on, any
part of the surface that would be "behind" the rest of the surface (when
viewed from the specified vantage point) will not be drawn.  This makes
MUCH better looking graphs.  However, due to the additional computation
necessary to determine which lines are hidden, a graph drawn with hidden
lines removed takes several times longer to draw.

Another option is the aspect ratio type.  If you choose "true" aspect
ratio, a graph will be drawn with all proportions correct; in other words,
a sphere will always look spherical.  If you choose "cubic" aspect ratio,
the viewing area (defined by xMin3D, xMax3D, yMin3D, yMax3D, zMin3D, and
zMax3D) will be stretched or shrunk to appear cubic.  This allows you to
see aspects of a surface that are visible only when one direction is
stretched considerably while the other is maintained.

Finally, Graph3D allows you to choose whether to display the axes and the
viewing "cube."  If you choose to display axes, the x, y, and z axes will
be drawn before the graph is.  They will extend a little beyond the
boundaries of the viewing "cube."  If you choose to display the viewing
"cube," then a wire frame rectangular structure will be drawn, enclosing the
viewing "cube." Note that neither the axes nor the viewing "cube" honor the
hidden line removal option--portions that would be obscured by the surface
will still be drawn.  For this reason, it is probably best not to make the
axes or the viewing cube visible when hidden line removal is turned on.

THE MENUS

Graph3D has many menus, organized to give easy access to all Graph3D
variables and options.  Below are the menus, their commands, and what each
one does.

The Main Menu
The main menu appears after the title screen.

Graph: graphs the surface.
Eq:    brings up the equation menu; allows you to change the function to be
       graphed, and also to change the alternate function and the alternate
       function condition.
Range: allows you to view or change the viewing "cube" (xMin3D, xMax3D,
       yMin3D, yMax3D, zMin3D, zMax3D) and the number of x cuts and y cuts.
Parms: brings up the parameters menu; allows you to change the vantage
       point, the magnification, and the preferences (hidden line removal,
       aspect ratio, axis visibility, viewing cube visibility).
Quit:  exits the Graph3D program.

The Eq (Equation) Menu
The equation menu lets you change the equation, the alternate equation, or
the alternate equation condition.

y1=:   allows you to change the main function (y1).
y2=:   allows you to change the alternate function (y2).
Cond:  allows you to change the alternate function condition (wherever the
       alternate function condition is TRUE, y2 is used instead of y1).
Back:  returns to the main menu.

The Parms (Parameters) Menu
The parameters menu lets you change the vantage point (theta and phi), the
magnification, and the preferences.

Angle: allows you to change the vantage point by changing theta and phi.
Magnf: allows you to change the magnification.
Prefs: brings up the preferences menu, which allows you to change hidden
       line removal, aspect ratio, axis visibility, and viewing cube
       visibility.
Back:  returns to the main menu.

The Prefs (Preferences) Menu
The preferences menu allows you to select whether or not you want hidden
lines to be removed, what kind of aspect ratio you want, and whether or not
the axes and viewing cube should be drawn.

HidLn: allows you to choose whether you want hidden lines to be removed. 
       If hidden lines are removed, the plot is much slower, but all
       sections of a surface that are "behind" the rest of the surface are
       not drawn, so the graph looks much better.
Axes:  allows you to choose whether you want the x, y, and z axes to be
       drawn in before the graph is drawn.  The axes do not honor hidden
       line removal, so you should probably not show them when hidden lines
       are being removed.
Cube:  allows you to choose whether you want the viewing cube to be drawn
       in before the graph is drawn.  When this option is on, a wire frame
       of viewing cube is drawn.  The viewing cube does not honor hidden
       line removal, so you should probably not show it when hidden lines
       are being removed.
AspRt: allows you to select cubic or true aspect ratio.  When the aspect
       ratio is cubic, the viewing "cube" (and the surface) is stretched or
       squeezed to a cubic shape.  When the aspect ratio is true, no
       stretching occurs, and distances look correct.
Back:  return to the parameters menu.

THE DEFAULTS

Graph3D sets up the variables to certain defaults when it is run with
RunBfore set to 0.  The default values are:

  xMin3D = -10
  xMax3D = 10
  yMin3D = -10
  yMax3D = 10
  zMin3D = -10
  zMax3D = 10
  xCuts3D = 10
  yCuts3D = 10
  theta = pi/6
  phi = pi/6
  magnification = 1
  xhidden line removal is off
  axes are invisible
  the viewing "cube" is invisible
  aspect ratio is cubic
  y1 = 15e^(-.04(x^2+y^2))cos (.15(x^2+y^2))
  y2 = 0
  AltFl = 0 (FALSE; y2 used only when y1 is imaginary)
