!!!!!!!!!!!HELLO WORLD!!!!!!!!!!!!!!!!!!!!!!!

****INTRODUCING THE NEXT PRODUCT*************
 ***           FROM THE        *************
****   IMAGINATOIN FACTORY      *************


   MODEL3D FOR THE TI-85/TI-86!!!!!!!!!!!!!

             VERSION 2.0 !!!!!!

by William Charles Deich IV
gospelsf@ufl.edu
http://www.geocities.com/williamiv.geo/

This is a group of programs for modeling 
3-Dimentional shapes & mathematical surfaces!

Main Programs:         Subrutenes:
---------------        ------------
CAN                    HOLD
CONE                   TMODE
CUBE                   Z3AXES
EGG                    Z3CYL
PRYMD                  Z3DRAW
TORUS                  Z3EYE
WORMHOLE               Z3INFO
SURF                   Z3MAT
                       Z3RNG
                       Z3XYZ

Lists:
-------                
FLAG (Self generating the 1st time you use SURF.
If you delete FLAG.86L it only rests SURF back 
to it's defaults)


Version 1.0 had a program MODEL3D, but this was only 
a menu program to access the other programs.  I found 
that it mostly just wastes memory, and besides there 
are lots of menu programs for the TI-86 like Rascall
that will do a better job at this anyway.




                  SURF
*****************************************************
SURF is the  mathematical Surface Grapher!
Like all user defined 3D equation graphers 
it works great for some graphs (like ln(X^2+Y^2))
and not for  others.  I think it's advantage is 
reasonable speed, and reasonable accuracy

-----------------------------
|Z[XY]|EYE|CLEAR| -> |Graph|

*Press F1 for Z[XY] and it will prompt 
you for Z(X,y).

You have to enter Z(X,Y)  in terms of X Y
-- Captiol X & Capitol Y.  I know it's a 
bit of a pain, but strange things can 
happen with little x & little y because 
they're system variables.  Sorry!!!!!!!


*Press F2 for EYE, and it calls up Z3MAT
to let you pick the Observer's View Point,
as well as Stretch & rotate the graph.

One nice thing about these programs is that
they run equally well in Radian/Degree MODE
since the "o" degree sysmbol is used on the
Start, End & Increment of the For( loops.

However, you may want to put the Calculator
into Radian/Degree mode depending on what
surface you're graphing.


*Press F3 and it clears the graph screen.


*Press F4 for "->" and it takes you to the
Settings menu.

Press F5 for Graph, and it Graphs :o)


Settings Menu:
|--------------------|
|F1:CYL/RECT         |
|F2:1/2 Graph        |
|F4:Disp Info        |
|                    |
|                    |
|                    |
|---------------------
|MODE|1/2|Range|Info|<-|

Press F1  for CYL/RECT and it swaps 
between Cylindrical & Rectangular Coordinate 
generation modes.  CYL is the default

//Note:  This does NOT effect how you enter Z(XY)
//       You always enter Z in terms of X & Y
//       Never theata or Phi!!!!!!!!!!!!!!!!!



Some surfaces come out better in Cylindrical XY mode
and other's come out better in Rectangular XY mode.
Some look good in both.  You'll have to play w/ it :o|


Press F2 for "1/2 Graph" and it toggles between
"1/2" & "whole" graph mode.

Basically I found a simple hidden line removal
method in EEGG by  John Powers. [see credit below]
All it does is 'slice off' the back 1/2 of the 
graph.  This works great for "convex" objects 
like Spheres & Cylinders, and graphs like
9-X^2-Y^2.  But it wouldn't work so well 
for ln(X^2+Y^2)  so you can turn it ON & OFF.


Press F3 for Range and it calls up Z3RNG to let
you set the view screen.  NOTE: Z3RNG always 
uses ZSQR after you select your other zooms 
to make the graph "look real"


Press F4 for Info, and it runs Z3INFO
to display the current 
SX,SY,SZXE,YE,ZE & f(focal length)

When SURF calls up Z3INFO 
it also displays CYL/Rect mode
right afterwards.



Press F5 for "<-" and it takes you back 
to the 1st menu.

If you start up SURF by accident, or 
decide you don't want to do a graph,
just press [ON] and then F5 for Quit.




===============================================
CAN, CONE, CUBE, EGG, PRYMD, TORUS & WORMHOLE
ARE GEOMETRIC SHAPE GENERATORS.  They work by creating a 
"basic object" which can then be stretched, roatated 
& moved using Z3MAT.


*CONE creates a circular cone with it's tip at 
[0,0,.5] (in basic object space - before stretch or rotations)
The circular base is at Z=-.5  The radius of the 
circular base is r=1

*CUBE, creates a cube with all the sides = 1.
But with Z3MAT it can be stretched 
into any Rectangular BOX.
Center = 0,0

*EGG creates a unit sphere with r = 1,
But with Z3MAT it can be stretched into any 
3D Ellipsoid.
Center = 0,0

*CAN creates a 'can' [cylinder] with r=1  h=1.
Again, with Z3MAT it can be stretched 
any amount in the X or Y or Z directions.
It can  also  be moved & rotated of course.
Center =0,0


*In the case of PYRMD it generates a pyramid 
with a base area of 4 and a height of 1
the tip is at [0,0,.5] (in basic object space) 
and the base is at Z=-.5

You can make the pyramid look less flat by 
giving it a larger SZ value than the SX & SY


*WORMHOLE creates "the space-time diagram of a worm hole"
(actually it's a cylinder w/ variable radius that 
curves in at the center to resemble the space-time 
diagram of a worm hole.)
The Worm Hole goes from -pi/2 to +pi/2 on the Z-Axis,
and the radius is pi at the top and bottom rings 
on the Z-Axis, and pi-1 at the middle.

This is a little different from most of the 
other objects which are basically "unit objects"
For Example, if you were streatching an ellipsoid 
with SX=9  SY=9  SZ=9  to achieve a simular 
proportion for a wormhole you might want to use 
SX=3  SY=3  SZ=3.

All I can say is "Remember, Worm  HOles are wierd."


*TORUS creates a torus w/ 'tube radius 1' and 
'diameter 3' (diameter=dist from center to center 
of the tube.)

As of 1/1/2004 1:14 AM TORUS doesn't have any 
hidden line removal at all.


==============================================




CAN, CONE, CUBE, EGG, PRYMD, TORUS & WORMHOLE
 HAVE BASICALLY THE SAME MENU SYSTEM
****************************************************
-----------------------------
|Range|CLEAR|EYE|info|Graph|

Press F1 for Range and it calls 
up the Z3RNG subrutene


|Range|CLEAR|EYE|info|Graph|

Press F2 for CLEAR and it clears 
the graph screen.  This is quite 
useful for when you're using the 
programs one right after another


-----------------------------
|Range|CLEAR|EYE|info|Graph|

[ F3 ] calls up Z3MAT to get 
your view point information, 
and create the 4X4 transformation
matrix


----------------------------
|Range|CLEAR|EYE|info|Graph|

[ F4 ] calls up Z3INFO to
display the current 
SX,SY,SZXE,YE,ZE & f(focal length)

You can add more information 
display to Z3INFO, but remember
it takes up more memory space.


[ F5 ] graphs object :o)



******Z3RNG************************

Z3RNG sets the graph screen size
----------------------------
|Zoom|Ask |     |     |     |

Press F1 and it prompts 
xMin,xMax,yMin,yMax


Press F2 and it gives you the
zoom option menu:
--------------------------
|STD|Decm|Trig|    |     |

F1 zooms to standard

F2 zooms Decmimal 

F3 zooms Trig (affected by Radian/Degree mode)

It always uses ZSQR afterwards
to make the graph look "real"


You could put more options into Z3RNG,
but I didn't to save memroy.



*********Z3MAT*************************

Z3MAT is the subrutene that 
sets the 4X4 matrix that
STRETCHES the object, 
MOVES the object, and
ROTATES the object.

In version 2.0 I came up w/ a menu 
|X->Y|X->Z|Y->Z|     | Go! |
 F1    F2   F3   F4    F5

The program starts w/ an Idenity matrix, and each
time you select F1, F2 or F3 it prompts you for an angle,
and then multiplies the preexisting matrix by the new 
rotatoin matrix.

TMODE is used to put a little 'o' or 'r' in the 
upper right hand corner of the window to let you 
know what angular mode the calculator is in.


The 'physical signfigance' of this is that you can 
apply as many of these rotations to the object as 
you want [or none if you want] and the order of the 
rotations will be the same as the order you entered 
them in.

F5 = Go!  escapes the loop of this menu and takes 
you to the rest of the Z3MAT program


HERE'S THE CODE FOR THE PROMPTS IN Z3MAT
---------------------------------------
XE -- x coordinate of eye
YE -- y coordinate of eye
ZE -- z coordinate of eye

TX -- X translation -- # added to all x values --- 0 for default
TY -- Y translation -- # added to all y values --- 0 for default
TZ -- Z translation -- # added to all z values --- 0 for default

SX -- X Stretch -- # multiplied by all x values --- 1 for default
SY -- Y Stretch -- # multiplied by all y values --- 1 for default
SZ -- Z Stretch -- # multiplied by all z values --- 1 for default

   

Z3MAT also calls up Z3EYE to 
determine the correct coordinate 
rotations for the Observer's View Point

[You enter coordinates for the eye of
 the observer.

   You can do this with XE,YE,ZE 
      or R, theata, phi]

-------------------------------------
It also has options to CLEAR the graph screen,
draw 3D axies, and change the focal length

[The regular 2D axies are turned off
 before the first object is graphed]

The focal length is automatically
set to R3, the radial distance from 
the origin ot your EYE POINT, but 
you can change it to any other value
you want.  100 is fairly standard.
Smaller values mean your "eye" is 
right up on top of the object.
It makes spheres "fish eye" :o)
 -- Just make sure your focal length 
is longer than the distance from the 
origin to the graphed object, otherwise
the surface is behind your head!

-----------------------------------------
It's also worth noting that Z3MAT & Z3EYE 
assume you're looking 'AT' the origin.

This can be improved by creating a 
LOOKAT point <AX,AY,AZ>, then subtracting 
this from each point to be evaluated.
This can be done by including this 
subtraction as part of the "MOVE" or
translation feature of Z3MAT.

Some programs assume you're looking at 
the midpoint of the window, but since 
my program doesn't place any limit on 
what Z can come out to, I decided 
not to deal with this issue, and just 
let the "observer's eye" be focused 
on the origin.  Besides, this saves a 
little memory
--------------------------------------



*********Z3INFO**********************
Z3INFO displays the current 
SX,SY,SZXE,YE,ZE & f(focal length)


It also uses TMODE to put a little "o"
in the upper right hand corner if 
the calculator is in degree mode, 
and a little "r" if it's in radian mode.



*********Z3DRAW***************************
Z3DRAW is the "line plotter"
It 'connects the dots' between 2 points 
on the graph, only it projects them 
from 3 space to 2 space at the same time 
using the equations:

Xs = X'*f
    -------
     f - Z'

Ys = Y'*f
    -------
     f - Z'

(X',Y',Z') = 3D coordinates that have already 
been rotated, stretched & moved.



********Z3AXES*******************************
Z3AXES uses the V matrix to plot 3D axies 
on the graph screen.  It's a little diffrent 
from  Z3DRAW since you need to throw in 
absolute values since at least one of the
axies 'end points' will be "behind your head"

You need Z3AXES because the regular 2D axes
that the calculator draws will almost never
be in the right position.



******Z3CYL*********************************
This is the subrutene that actually does the
Cylindrical coordinate graphing for SURF


******Z3XYZ*********************************
This is the subrutene that actually does the
Rectangular coordiante graphing for SURF





           FLAG CODE
*************************************************
FLAG(1)  3D function status

         0 = Z(X,Y) has not been set
         1 = Z(X,Y) has been set
---------------------------------------
FLAG(2)  Observer's View Point status

         0 = View has not been set
         1 = View has been set
-------------------------------------------------
FLAG(3)  Coordinate Mode Status

         0 = Cylindrical X Y Coordinate Generator
         1 = Rectangular X Y Coordinate Generator
-------------------------------------------------
FLAG(4)  Half grapher status

         0 = Graph front & back 1/2 of graph
         1 = Only Plot front 1/2 of graph


// Note:  Coordinate Status DOES NOT affect function entry
//  E.g.  in Cylindrical X Y generator mode
//        you still enter Z(X,Y)=...X...Y...
//        NOT Z(X,Y)= theata or phi !!!!!!!!!!!!!!




                 Credit where Credit is due:
*********************************************************
          But first I'd like to complain!!!!!
          There aren't enough good mathematical 
          3D graphics books out there!!!!!!!!!!
          Most of them assume you're either not 
          interested in the Math, or can't 
          understand it!!!!!!!!


I couldn't have gotten this far without a lot of research, 
and a little help from other people.

You can find a lot of good information from Dr Shoaff's page:

http://www.cs.fit.edu/~wds/classes/graphics/Lectures/lectures/


I also uploaded some info I found out at my web page:

http://www.geocities.com/williamiv.geo/Stories/Papers/Perspective3D.html
[my little .html paper is included inside the MODEL3D.zip file.]



I admit my TMODE is a cheap BASIC take off of Andy Johnson's 
and Brad Wissel's Trigtogg ASSEMBLY program  -- but the 
TI-85 doesn't take well to assembly install programs!!!!!
At least it gives you a heads up as to which mode you're in :)



My EGG program is an alteration of EEGG by John P. Powers who 
used to work for Texas Instruments.

It was from John Power's EEGG that I got the main form of 
HIDDEN LINE REMOVAL used in these programs.  It involves
translating [moving], stretching, & rotating the ZeroVector,
and then comparing the Z' coordinate of the point to be 
plotted with the Z coodinate of your new ZeroVector.
If it's lower than "Z-Zero"  you don't graph it.

I used this in EGG, and CAN, and in SURF, I gave the 
option to turn it on or off, since some mathematical 
surfaces look great with it, and other look abolutely 
terrible with it.




CUBE, PYRMD, and the top & bottom planes of CAN use 
a different method I discovered on page 108 of COMPUTER 
GRAPHICS: for graphic DEsigners by John Vince, Knowledge 
Industry Publications, White Planes NY, 1985.

Basically, consider the object to be modeled by polygons 
on it's surface.  In the case of a CUBE it's surface is 
made up of 6 squares.   Each of these squares has a 'normal 
vector' or a vector that is perpendicular to the square, 
pointing out of the object.   You can also make a vector 
between the Eye Point, and the perpendicular vector of the
square [polygon].  If the angle between these two vectors 
is Greater than Or Equal to 90 degrees, than that part of 
the surface should be invisible.

Although I am having a little trouble getting the perfectly 
general algorithm that will work for ANY Translation (move) 
stretch, and rotation.  If anyone out there has any ideas, 
please drop me a line at

gospelsf@ufl.edu
http://www.geocities.com/williamiv.geo/