Colin Meyer: Rotate 3d objects on HP48
Rotate 3d V1 for HP48's.

Here is my nifty program for rotating three dimensional shapes.
It even does perspectives, but no hidden line removal. Maybe on V2.

It is based on Three-Dimensional Graphics in Turbo Pascal, Computer 
Language, Sept. 1990.

The Programs/Variables:

 SROTATE: start rotation.
 SANIMATE: save grobs on stack (in FRAMES), start animation.
 ANIMATE: start animation of previously saved grobs.
 FRAMES: a list of grobs to animate.
 OCTO: shape - an octohedron
 CONE: shape - actually a six sided pyramid
 CUBE: shape - cube!
 
(Don't worry about the rest of the programs, they're just my strange
 attempt at modular programming!)

Shapes are specified by a list of two lists, a list of vertices (3d 
vectors) and a list of lines between vertices:

{ { [x1 y1 z1]
    [x2 y2 z2]
    ...
    [xn yn zn] }
  { v1 v2
    v3 v4
    ...
    vn vn+1 } }

Each pair of vertices in the line list specifies one line. For instance, 
{ 1 2 } would be a list with only one line, between vertex 1 and vertex 2.
{ 1 2 2 3} would be a list with two lines, the first between vertices 1
and 2, and the second between vertices 2 and 3.

To Use:

1: shape (list of lists, as described about)

[SROTATE]

The Initial View is how the object is initially oriented.
The object will be rotated on the third axis (the one not chosen for one 
of the initial rotations).
X axis = 1, Y axis = 2, Z = 3.

Distance views from: is in user units (try about the same as the width
of the screen).

Rotation options: are as follows:

:Start\<): - the angle to start the rotation at.
:End\<): - the angle to end the rotation at.
:inc: - the increment of the angle between views.

(to do a complete circle, start at 0 degrees, end at 351 and do an 
 increment of 9 - I've found 9 degrees is a small enough jump for smooth
 animation.)

Rotate on new or 
original axes?

-this refers to the initial view. Before that view is the original axes, 
 during that view is the new axes. Confused? Just try both ways & you'll
 understand.

Save as grobs for 
later animation?

-self explanatory.
 If you do choose to save grobs, You'll have to choose how big a grob to 
 save. The program will draw the first frame, and prompt you for corners
 of the grob to save. Move the cursor to each corner, and press [ENTER]
 at each. Make sure to make the grob a bit bigger than the picture, 
 because as it rotates, it may go out of close boundaries. After marking
 corners, you must push [ATTN], then [ORANGE] [CONT].

The program will then go ahead and draw all the frames, saving them as 
grobs on the stack if you chose so. 

When you end up with a bunch of grobs on the stack, Press [SANIMATE] to
save them in the variable FRAMES and then animate them.

Whenever you already have grobs saved in FRAMES, just press [ANIMATE].     

To start, try a cube, and these options:

1: (the cube)

[SROTATE]

:Axis1:1
:\<)1:30 [ENTER]

:Axis2:2
:\<)2:30 [ENTER] 

Distance viewed from:

7 [ENTER]

Rotation options:
:Start\<):0
:End\<):351
:inc:9 [ENTER]

Rotate on new or 
original axes?

[ORIG]

Save as grobs for 
later animation?

[NO]

(sit back and enjoy).


-----CUT HERE-----

-----END CUT-----
