TweetFollow Us on Twitter

3-D Math
Volume Number:3
Issue Number:3
Column Tag:Basic School

The 3-D Math Package

By Dave Kelly, MacTutor Editorial Board

Benchmark Wars

Benchmarks are not always what they seem to be. If you recall, in February, MacTutor printed results from benchmark tests which Microsoft provided to compare the MS Compiler 1.0 with ZBasic. To make a short story longer some of the benchmarks do not provide a true realistic view of the capabilities of each product. As a matter of fact, Zedcor says that "several of the benchmark times Microsoft claims they are grossly misleading and, in some cases, intentionally deceptive". Well, since you are such an intelligent audience, you may decide for yourself.

The Microsoft benchmark for math operations basically is as follows:

FOR i% = 1 TO 10000
    FOR j% = 1 TO 10
        c = 1.2345 + 3.1415
    NEXT j%
NEXT i%

It is interesting to note that if the values used in the math are declared beforehand that the MS times are much slower.

a!=1.2345: b!=3.1415
FOR i% = 1 TO 10000
    FOR j% = 1 TO 10
        c! = a! (math)  b!
    NEXT j%
NEXT i%

It appears that in the first benchmark the MS Compiler computes the variable to be assigned to c! at compile time, thus making this benchmark become a test to see how long it takes to assign a variable. When run, this explains why all the Microsoft results for math were 1 second. Since these benchmarks are supposed to check math operations the results are now invalid. It might be interesting for those of you that want to use the MS Compiler that your programs will run faster when you use actual numbers instead of variables in calculations. The math operations in this case were not really done at runtime. The actual results (for the second benchmark) are given in the next figure.

MS (b) MS (d) ZBasic

Addition 14 sec 40 sec 52 sec

Subtraction 13 sec 48 sec 64 sec

Multiply 16 sec 249 sec 211 sec

Division 39 sec 457 sec 446 sec

Now that we are comparing like operations, it may be concluded then that ZBasic (BCD math) math is about the same speed as MS Basic (d) (SANE math) with more accuracy. MS Basic (b) is fastest but gets wrong answers. Also not previously mentioned before, if you use ZBasic's LONG INTEGER mode the times are much faster, but keep in mind that you have to keep track of all decimal points yourself. Since the MS Compiler doesn't have the LONG INTEGER mode it is impossible to compare it.

Some notes on the integer FOR-NEXT loop benchmark (30,000 iterations). If the loop is modified to do 900,000 iterations (impossible without LONG INTEGERS) then ZBasic comes out faster (10 sec). To simulate this we have the loop:

FOR j = 1 TO 30
    FOR i = 1 TO 30000
    NEXT i
NEXT j

the times are : MS Basic (b) or (d) = 52 sec

ZBasic 3.04 = 7 sec.

Please realize that now the rules have changed. These are times for a loop inside another loop. But the time difference is at least 5X.

In the Random Disk I/O benchmark for ZBasic there is an extra RECORD statement in the PUT benchmark. With this line deleted the result was 16 sec. for PUT and 7 sec GET. That's a 2 to 3 times advantage over the MS Compiler.

In the Sequential PRINT# benchmark a comma delimiter is printed to the file in a corrected benchmark (with PRINT #1,x$;","). When corrected the Sequential INPUT# routine does not crash. In fact the crash could have been avoided by setting the string length error checking flag on in the ZBasic configuration. The new times are PRINT# =27 sec and INPUT# = 14 sec. Also if the string is 200 characters long instead of one character, the ZBasic times are 72 sec for PRINT# and 232 sec for INPUT#; MS Compiler times are 193 sec for print and 921 sec for INPUT#.

In summary, it appears after all this that ZBasic is better than the original benchmark had indicated. Because of this and the support and determination that Zedcor has to make ZBasic successful, I have to say that the two products have an equal rating (MS Compiler had a slight advantage before). But the war is not over. Zedcor is working on more bug repairs and improvements. I hope that Microsoft will be doing the same. The competition is good, but I hope that we haven't gone too far off the deep end with faulty benchmark tests.

Let's step around the controversy surrounding the continuing saga of Basic Wars to get into some programming. I'm still wondering when the dust will settle. Of course, the implementation of our programming efforts here will be different depending on the version of Basic that we use. I'm extremely grateful for the library routines that have been provided by CLR thus far. There are two new library packages from CLR: Graph3DLib and VWLib. CLR Graph3DLib allows you to access Apple's 3D graphics package from within your MS Basic program. CLR VWLib allows you to play VideoWorks movies from your MS Basic program.

Graph3DLib

When will I ever want to use 3D graphics anyway? Much of the time two dimensional graphics will be sufficient for what you would like to display (examples: a map, a x-y graph), however, there are some types of data or some objects that are difficult to express in 2D. With other types of graphics where you want to show depth or perspective just as your eye would truly see it. (examples: a orthographic picture, a painting or illustration, x-y-z graph, animation). As they say: "A picture is worth a thousand words". Sometimes, the visualization of something can mean the difference between understanding and confusion.

Fig. 1 Output of our 2-d function demo

Intro to 3D

First we should think about what is going on in the 3D world vs. the 2D world. When you look at your computer screen (or when graphics are output to your screen or printer) you see a plane with points or lines on the plane which are arranged so as to display what we call 2 dimensional graphics. Your Macintosh screen is only capable of displaying two dimensional objects. When objects are seen in three dimensions, an object which is close to us seems larger than the object appears when it is far away. The trick is converting the 3 dimensional display into 2 dimensions so we can display it on the Macintosh screen. The new CLR library Graph3DLib will assist us in this conversion.

Way back in algebra I was taught that a straight line is represented mathematically by the equation y = mx + b. Many of you remember this. The m and b are constants where m is the slope of the line and b is the value of y when x = 0. Plotting this equation (where only x and y are involved) requires only 2 dimensions, one for x and one for y.

In three dimensions, the equation of a line (y = mx+b) would appear only in the x-y plane. There would be no displacement in the z direction as z is a constant (z=0) in the equation. It should be noted that the axes shown are pointing in a positive direction. There are various mathematical equations involving x, y and z as variables in the same equation. This type of equation can best be visualized by building a 3D model of the equation.

We have all seen 3D models of one sort or another. Remember the 3D models of molecules used in physics and chemistry to help the student visualize the subject being studied. If you take a 3D model in your hand and look at it you will see that the various coordinates of the model will look larger or small to the human eye depending on the angle which you are viewing the model (i.e. parts in the back are further away and therefore appear to be smaller to the eye). Now for just a moment, pretend you are looking at one of these models through a glass window. If the model is smaller than the window, you can see the entire object. If the model is bigger than the window, you can only see the part of the object that is in line with your eye and the window.

Note that it also depends on where you are standing (at what angle to the right or left of the window) and where the model is located. The size of the object makes a difference too. If the model is close to the window and very large you may not be able to see the entire model (kind of like looking straight into the side of a wall in Maze Wars).

I found that using CLR Graph3DLib was both easy and hard. The concepts are easy to execute but the hard part is finding just the right angle to view the object. Of course that won't be a problem is you are going to rotate the object anyway. First it is important to understand how the coordinate axes are organized. The coordinate axes are not explained in the CLR Graph3DLib manual. In order to be consistent with the Macintosh screen coordinates the axes are arranged differently. The x axis points to the right, y axis points down (toward higher screen coordinate numbers) and because the y axis is pointing down the z axis must point into the Macintosh screen (z is perpendicular to x and y axes and must conform to the "right hand rule").

Making your own 3D!

The graph3D statments use a variable type called fixed point (a static variable). Like single precision numbers, fixed point numbers are four bytes long. But, Basic does not have the fixed variable type. Therefore, Graph3DLib uses single precision numbers to store the fixed point numbers. Graph3DLib provides conversion statements to convert to and from single precision and fixed point. The manual explains the conversion statements sufficiently. The conversion of numbers is the most cumbersome of the entire 3D process. Beware! If you forget to convert a number, the routines won't work properly and you probably think that it is the routines fault. Beware of pilot error! You may want to initialize all the variables you will use at the beginning of the program and use them as needed in the 3D statements. For example you may want to set the variable zero! to '0' using Fs2Fix 0!,zero! at the beginning of your program so that the variable zero! will already be converted when needed. All 3D statements use the fixed point variables so remember to convert to fixed point first.

To use Graph3DLib you first open up a 3-dimensional drawing port with the OpenPort3D statement (note there is a typo in the manual on page 7 Open3DPort should be OpenPort3D). You may specify more than one port if you want to use multiple windows for your output.

The next step is to specify a viewport. A viewport is like the viewing window a mentioned above; a viewport identifies what coordinates will be able to be seen in the 3D drawing port. A viewport is identified in two-dimensional screen coordinates. You indicate the screen rectangle in which the drawing will be made.

Next our 3 dimensional coordinate system will be mapped to the viewport rectangle by using the LookAt statment. LookAt tells the viewport what coordinates we will 'look at' through the viewport. This can be a bit confusing unless you think of the viewport as an x-y plane and lookat is defining the 3D coordinates of the plane. The following statements from my function demo program will set the viewport coordinates from -10 to 10 in the x direction (x1=-10, x2=10) and -10 to 10 in the y direction (y1=-10 and y2=10).

Fs2Fix -10!,x1!
Fs2Fix -10!,y1!
Fs2Fix 10!,x2!
Fs2Fix 10!,y2!
LookAt x1!,y1!,x2!,y2!

It is recommended that the center of the viewport be the origin of the coordinate system although it is not a requirement. If you try to rotate an object when the origin is on the edge of the viewport you won't be able to see the object when it rotates off the edge of the viewport. If the viewport is not a perfect square then the object will be drawn somewhat distorted. If you want it that way then there is nothing wrong with doing it that way. Notice that there is no mention made of the z axis when defining the what we will LookAt when we see the viewport. Since we are looking (physically) at a two dimensional screen, Graph3DLib references the x and y coordinates (3D) to the x and y on the Macintosh screen (2D). When the z axis is shown it will have the proper dimensions in relation to the x and y coordinates. In other words, if the z axis is rotated so that it points in the vertical (2D y direction) then it will have dimensions of the vertical direction. You don't need to worry about it because the 3D package takes care of that for you.

The only thing left to define before you can draw is the viewangle. The viewangle is defined as the horizontal angle (in degrees) subtended by the viewing pyramid. The viewing pyramid is defined by the pyramid formed by drawing lines from the corners of the viewport to the eye. To visualize the viewangle, image you are standing very close to your window. If you are standing very close to the edge of your window you must turn your head a wide angle to see the edges of the window. If your eye was right on the surface of the window then you would have to turn by 90 degrees to see the edge. This also gives you a very wide viewport. If you are standing much further away from the window, the angle which you must turn your head in order to see the edges is much smaller. According to the Graph3dLib manual, 25 degrees is the normal perspective of the human eye. 10 degrees gives the effect of a telephoto lens whereas a large viewangle of 80 degrees give the effect of a wide angle lens.

You may specify the Pitch(x Angle), Yaw (y Angle) or Roll (z Angle) using the Pitch, Yaw and Roll statements respectively. By changing this angle before drawing the object will make the object appear to rotate in space. The Scale statement lets you shrink or expand the drawing on each axis in the proportion factor specified. You may move the pen to any 2D or 3D coordinate (using MoveTo2D or MoveTo3D) and then draw lines from the pen location to another point (LineTo2D or LineTo3D). You may also draw from the current pen location to a point dx, dy or dz units away. (dx is a displacement in the x direction). There are a few math operation statements provided for doing math operations on fixed point variables, but they won't be faster than the operations in Basic because of the time Basic takes to call the library routines.

The 3D function demo program sets up two viewports in the same window and calculates and displays the following 3D plots:

y = sin(x)

y = 9 - z2

Other functions may be substituted for the samples that I've used here. Some simple functions will provide some interesting patterns etc. While Graph3DLib is not fancy in that it doesn't have routines to draw circles and other shapes, you may find that it will still be a worthwhile product to include in your library of routines. It would have been nice if it inclued some of the functions found in other comercial 3D graphics packages. For example, the 3-Dimensional Graphics package for True Basic is much more complete with statements for circles, grids and oblique projections (but you have to use True Basic).

For comparison purposes, I have provided a 2-dimensional demo using MS Basic routines and another using CLR Graph3DLib routines (2D routines). The Graph3DLib routines run slower probably because of the time that Basic takes to access the library routines. If you are not going to use 3D graphics then you don't need Graph3DLib. It is easier to draw the 2D stuff with the MS Basic routines rather than using the Graph3DLib stuff.

You may want to experiment with the view angles for special effects. It could be interesting. The demo programs are available on the source code disk disk through the MacTutor store to save you trouble when typing them in. Feel free to modify or play with them as you like.

Using VWLib

Another new library package from CLR is the VWLib (Videoworks library). VideoWorks is a powerful program for creating animation sequences called "movies". CLR VWLib allows you to play these VideoWorks movies from MS Basic. VideoWorks is NOT included with CLR VWLib.

First, a few words about VideoWorks. Many of you have been impressed with the animation produced by VideoWorks. You may create animation by two methods: real time recording and frame by frame. With real time recording you can records animation as you move objects around on the screen. In frame by frame animation, you produce each frame one at a time. Objects may be imported from MacPaint or MacDraw (or equivalent applications) or you can use CheapPaint, a frame editor built into VideoWorks for creating or editing. Creating animation is very easy (at least it was for me). You may add sound effects to the animation (sound effects are included). I can see why MacUser magazine gives VideoWorks a five mice rating!

There were only a couple of annoying drawbacks with VideoWorks which I'd like to mention. One of the worst was copy protection. UGH! This is worst now that the CLR VWLib supports playback of movies. And since VWLib requires that VideoWorks be present it is a pain and a half! It is better with a hard disk however, because after I installed VidoWorks on my hard disk I could run it without the system disk being present. The other problem that I noticed was that the DEMO movies would not run in demo mode when not in the same folder as VidoWorks. This implies that VideoWorks has not been updated or improved since HFS was introduced. I won't go into any other comments about VideoWorks as it is a product that has been out for quite awhile and many of you are already familiar with it.

Professor Mac goes to the movies

Using CLR VWLib is just about as easy as playing back a movie from within VideoWorks. There are a couple of things that you must do first. First, the VWLib must be on the same directory (same folder) as Basic even for MS Basic 3.0. Also if you want to use sound you must have the sound file in the same folder as Basic. The routine vwopen from the VWLib will bomb if everythng is not in the same HFS folder as Basic. Apparently this routine is not at all HFS compatible. Movies can be in any folder if you are using Basic 3.0. If you have not upgraded to 3.0 I would strongly recommend it.

There are two ways to play a movie. The first way plays back the entire move. The second way advances the movie one frame at a time so that you may have other things going on at the same time. In the demo program, I used the second method and added optional SpeechLib support (for those of you that have CLR SpeechLib). The demo is provided so you can see for yourself how it works.

My thanks go to Hayden software for supplying me with a sample copy of VideoWorks. I can highly recommend it to anyone that wants to do any kind of animation. (Hayden Software, 600 Suffolk St.,Lowell, MA 01854) Ask them to remove their copy protection. VideoWorks is a trademark of MacroMind.

The CLR Graph3DLib ($35) and VWLib ($50) are available from Clear Lake Research, 5615 Morningside, Suite 127, Houston, TX. 77005 (1-800-835-2246 X199 except Kansas).

Editor's Remarks

[This program points up some serious problems with the new Basic Compiler, version 1.0, if you try to compile this demo. Nearly all Basic programs must include at least one library statement if they are to use any of the CLR toolbox routines that are now distributed by Microsoft. This demo has two such statements; one for the video works stuff (VWLib) and one for the speech stuff (SpeechLib). Naturally the goal of compiling a program is to create a stand-alone application. So you want to combine the library files with the basic program. Library files are machine code resources that are called from Basic as subroutines. They can be merged with the resources of the main program by using the statement mover program. According to the documentation, you use the name of the program in the library statement when the library resources are part of the program file. When this was tried with the video works demo, the video works library routines bombed with a run time error 5. It appears the VWLib makes incorrect use of the file refnum so that the library will not work properly under HFS unless the VWLib is available as a seperate file at the same level as Basic. Thus there is no way to create stand alone applications which use the VWLib. The library statement is also a very poorly designed statement since it requires a complete path name to find the library, which is a definite no-no on the Macintosh. If you create a program and move the libraries into the program file, the program will only work if the user doesn't change the program name or move it to another folder and change the path name! Nothing could be more ridiculous than to include in your program documentation the warning "Please do not move this program to any folder or change its name or it will fail to run!". This single statement shows that Microsoft has yet to fully address the HFS issue, even in version 3.0. The correct solution of course is for the Microsoft run time package to detect a file not found error at run time when the library statement executes and put up a Standard File Dialog asking the user to locate the needed library file. The library statement also needs an option to indicate the required library is part of the compiled program file so that no path name is needed. It is assumed that the Basic run time package knows how to find itself, but then seeing the problems Microsoft Fortran has had with HFS, maybe that is a bad assumption. Obviously no serious commercial Basic applications can be created that must use libraries until this bug is fixed. -Ed]

' 3D Function Plot
' ©MacTutor 1987
' By Dave Kelly

DIM y!(100,100)
' Be sure to set library volume to your own volume
LIBRARY "Hard Disk:Basic:CLR Graph3D:Graph3DLib"
LIBRARY "Hard Disk:Basic:CLR Graph3D:Toolbox"
initialize:
WINDOW 1 'Be sure a window is open!
OpenPort3D  'Set 3D output to window 1
' Next initialize variables to be used in library calls.
x1!=0:x2!=0:y1!=0:y2!=0:zero!=0
xpt!=0:ypt!=0:zpt!=0:z!=0
xAngle!=0:yAngle!=0:zAngle!=0:Angle!=0
SetRect viewrect1%(1),50,50,250,250  'set the viewport rect.
' convert single precision to fixed point values
Fs2Fix -10!,x1!
Fs2Fix -10!,y1!
Fs2Fix 10!,x2!
Fs2Fix 10!,y2!
Fs2Fix 0!,zero!
Fs2Fix 45!,xAngle!
Fs2Fix 45!,yAngle!
Fs2Fix 0!,zAngle!
Fs2Fix 25!,Angle!
viewport viewrect1%(1)
FRAMERECT (VARPTR(viewrect1%(1)))
SetRect viewrect2%(1),275,50,475,250
LookAt x1!,y1!,x2!,y2!
ViewAngle Angle!
roll zAngle!
yaw yAngle!
Pitch xAngle!
GOSUB Drawaxis
GOSUB Drawing1
viewport viewrect2%(1)
FRAMERECT (VARPTR(viewrect2%(1)))
GOSUB Drawaxis
GOSUB Drawing2
WHILE MOUSE(0)<>1:WEND
END
Drawaxis:
    ' Draw x axis
    moveto3d zero!,zero!,zero!
    lineto3d x2!,zero!,zero!
    ' Draw y axis
    moveto3d zero!,zero!,zero!
    lineto3d zero!,x2!,zero!
    ' Draw z axis
    moveto3d zero!,zero!,zero!
    lineto3d zero!,zero!,x2!
RETURN
Drawing1:
Calculate:  ' calulate equation y = SIN(z)
    FOR x!=0 TO 10
        FOR z=0 TO 10
            y!(x,z)=SIN(z)
        NEXT z
    NEXT x
Plot:
    FOR x!=0 TO 10
        Fs2Fix x!,xpt!
            moveto3d xpt!,zero!,zero!
            FOR z!=0 TO 10
                Fs2Fix y(x,z),ypt!
                Fs2Fix z!,zpt!
                lineto3d xpt!,ypt!,zpt!
            NEXT
    NEXT
RETURN
Drawing2:
Calculate:  ' calulate equation y = 9 - (Z^2)
    FOR x!=-5 TO 5
        FOR z=-5 TO 5
            y!(x+5,z+5)=9-(z^2)
        NEXT z
    NEXT x
Plot:
    FOR x!=-5 TO 5
        Fs2Fix x!,xpt!
        Fs2Fix y!(x+5,0),ypt!
        Fs2Fix -5!,zpt!
        moveto3d xpt!,ypt!,zpt!
            FOR z!=-5 TO 5
                Fs2Fix y(x+5,z+5),ypt!
                Fs2Fix z!,zpt!
                lineto3d xpt!,ypt!,zpt!
            NEXT
    NEXT
RETURN


' 2D Circle Demo
' ©MacTutor March 1987
' By Dave Kelly
' MS Basic version

WINDOW 1,"",(122,22)-(424,324),3
MainRoutine:
    DIM x!(360),y!(360)
    pi!=3.141593
    DEF FNrad(deg)=pi!*deg/180
    LOCATE 2,2:TEXTSIZE 9:INPUT "Enter step value: <25> ";Stp
    IF Stp=0 THEN Stp=25
    CLS
    PENMODE(8)
    LOCATE 2,2: PRINT"Step =";Stp
    FOR n=1 TO 360
        Angle=FNrad(n)
        x(n)=(SIN(Angle)+1)/2*WINDOW(2)
        y(n)=(COS(Angle)+1)/2*WINDOW(3)
    NEXT n
    FOR n=1 TO 360 STEP Stp
        m=n+1
        WHILE m<>n
            MOVETO x(n),y(n)
            LINETO x(m),y(m)
            m=m+Stp
            IF m>360 THEN m=1
        WEND
    NEXT n
LOCATE 25,2:PRINT "Press any key";
key$=""
WHILE key$=""
    key$=INKEY$
WEND
WINDOW CLOSE 1
END

' 2D Circle Demo
' ©MacTutor March 1987
' By Dave Kelly
' CLR Graph3DLib version
' Requires CLR Graph3DLib

' Set your own volume names
LIBRARY "Hard Disk:Basic:CLR Graph3D:Graph3DLib"
LIBRARY"Hard Disk:Basic:CLR Graph3D:ToolBox"
initialize:
WINDOW 1,"",(122,22)-(424,324),3
OpenPort3D  'Set 3D output to window 1
' Next initialize variables to be used in library calls.
x1!=0:x2!=0:y1!=0:y2!=0
s!=0:t!=0:u!=0:v!=0
xAngle!=0:yAngle!=0:zAngle!=0:Angle!=0
SetRect viewrect1%(1),2,2,300,300  'set the viewport rectangle
' convert single precision to fixed point values
Fs2Fix 0!,x1!
Fs2Fix 0!,y1!
Fs2Fix 1!,x2!
Fs2Fix 1!,y2!
Fs2Fix 0!,xAngle!
Fs2Fix 0!,yAngle!
Fs2Fix 0!,zAngle!
Fs2Fix 25!,Angle!
viewport viewrect1%(1)
' frame rect. so we can see it.
FRAMERECT (VARPTR(viewrect1%(1)))
LookAt x1!,y1!,x2!,y2!
ViewAngle Angle!
roll zAngle!
yaw yAngle!
Pitch xAngle!

MainRoutine:
    DIM x!(360),y!(360)
    pi!=3.141593
    DEF FNrad(deg)=pi!*deg/180
    LOCATE 2,2:TEXTSIZE 9:INPUT "Enter step value: <25> ";Stp
    IF Stp=0 THEN Stp=25
    CLS
    PENMODE(8)
    LOCATE 2,2: PRINT"Step =";Stp
    FOR n=1 TO 360
        Angle=FNrad(n)
        x!(n)=(SIN(Angle)+1)/2
        y!(n)=(COS(Angle)+1)/2
    NEXT n
    FOR n=1 TO 360 STEP Stp
        m=n+1
        WHILE m<>n
            Fs2Fix x!(n),s
            Fs2Fix y!(n),t
            Fs2Fix x!(m),u
            Fs2Fix y!(m),v
            MoveTo2D s,t
            lineTo2d u,v
            m=m+Stp
            IF m>360 THEN m=1
        WEND
    NEXT n
LOCATE 25,2:PRINT "Press any key";
key$=""
WHILE key$=""
    key$=INKEY$
WEND
WINDOW CLOSE 1
END

' Professor Mac's Movie Demo
' ©MacTutor 1987
' By Dave Kelly
' Requires CLR VWLib (VideoWorks not required)
' with optional support for CLR SpeechLib

CLEAR, 30000!
false=0:true=NOT false
LIBRARY"Hard Disk:Basic:CLR VWLib:VWlib"
ON ERROR GOTO 10
SpeechStatus=true
LIBRARY "Hard Disk:Basic:CLR SpeechLib:SpeechLib"
ON ERROR GOTO 0
IF SpeechStatus=true THEN
    SpeechHand!=0!
    SpeechErr%=0
    Phon$=""
    SpeechOn "",SpeechHand!,SpeechErr%
    ReaderString SpeechHand!,"Hello",Phon$,SpeechErr%
END IF

DIM A%(300)
refnum%=0
done%=0
movie$="Hard Disk:Mactutor™:Mar87:Professor Mac Movie"
CLS
ON ERROR GOTO 20
vwopen movie$,0,0,refnum%
ON ERROR GOTO 0
ON TIMER (4) GOSUB Wait1
TIMER ON
advance:
    vwanimate refnum%,done%
    IF done%=0 THEN advance
done:
IF SpeechStatus=true THEN SpeechOff SpeechHand!
vwclose refnum%
INITCURSOR
END
Wait1:
TIMER OFF
IF SpeechStatus=true THEN GOSUB Speak
ON TIMER(13) GOSUB Wait2
TIMER ON
RETURN
Wait2:
IF SpeechStatus=true THEN GOSUB Speak
TIMER OFF
RETURN

Speak:

GET (15,15)-(85,55),A%
SoundOutString SpeechHand!,Phon$,SpeechErr%
PUT (15,15),A%,PSET
HIDECURSOR
ReaderString SpeechHand!,"Welcome to MacTutor",Phon$,SpeechErr%
RETURN

10 NoSpeech:
IF ERR=53 THEN SpeechStatus=false
RESUME NEXT
20 NoMovie:
movie$=FILES$(1,"VWSCVWZP")
IF movie$="" THEN END
RESUME

*
*Resource lfile: "3D Demo".
*

3D.rsrc
????????

Type SB3D=STR 
 ,0
Graf3D Demo by Scott 
Berfield for MacT
utor -- Version 1.0


Type FREF
 ,15007
APPL 0

Type BNDL
 ,15007
SB3D 0
ICN#
0 15012
FREF
0 15007

Type ALRT
     ,128
65 95 305 415
128
5555


Type DITL
     ,128
5
*   1
BtnItem Enabled
205 120 237 200
Gee Whiz!

*   2
StatText Disabled
5 110 21 200
Graf3D Demo

*   3
StatText Disabled
30 25 66 285
Created by Scott Berfield for Mactutor Magazine, October 29, 1986

*   4
StatText Disabled
70 25 166 300
Use the scroll bars to rotate about each axis. Whether the entire 3D 
world or just the tetrahedron is rotated is set from the Rotate What? 
menu. The default is to rotate the object.

*   5
StatText Enabled
160 25 197 300
Written in Lightspeed Pascal, 
for which I am truly thankful!

Type MENU
     ,130
Edit
Undo/Z
(-
Cut/X
Copy/C
Paste/V
Clear

     ,129
File
Quit/Q

     ,128
\14
About Graf3D Demo
(-

     ,131
Rotate What?
Rotate Space /R


Type WIND
     ,32000
Graf3D Demo
42 5 265 506
Visible GoAway
0
0

     ,32001
control window
270 5 338 506
Visible GoAway
3
0


Type CNTL
     ,128
X Rotation
25 10 41 160
Visible
16
0
0 359 0

     ,129
Y Rotation
25 175 41 325
Visible
16
1
0 359 0

     ,130
Z Rotation
25 340 41 490
Visible
16
2
0 359 0


Type ICN#=GNRL
     ,15012
.H
FFFF FFF0 8000 0018
8000 801C BFFF FFDE
BFFC BFDE BAB0 95DE
B560 9ADE BAB0 8DDE
B558 86DE BAAC 8DDE
B556 9ADE BBFF BDDE
B422 E2DE B822 21DE
BFFF FFDE A042 105E
C082 083E FFFF FFFE
B555 55DE BBFF FEDE
B7FF FFDE BFFF FFDE
BFFF FFDE BFFF FF9E
FFFF FF9E FFFF FFDE
800F E01E 8003 C01E
FFFF FFFC 7FFF FFFC
4000 0038 7FFF FFF0
*
FFFF FFF0 FFFF FFF8
FFFF FFFC FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFE FFFF FFFE
FFFF FFFC 7FFF FFFC
7FFF FFF8 7FFF FFF0

Type ICON=GNRL
     ,451
.H
FFFF FFF0 8000 0018
8000 801C BFFF FFDE
BFFC FFDE BAB0 AADE
B560 B5DE BAB0 9ADE
B558 95DE BAAC 8ADE
B556 955E BBFF BEDE
B444 E3DE B844 21DE
BFFF FFDE A084 105E
C104 083E FFFF FFFE
B555 55DE BBFF FEDE
B7FF FFDE BFFF FFDE
BFFF FFDE BFFF FF9E
FFFF FF9E FFFF FFDE
801F C01E 8007 801E
FFFF FFFC 7FFF FFFC
4000 0038 7FFF FFF0
 
AAPL
$98.38
Apple Inc.
-0.64
MSFT
$43.89
Microsoft Corpora
-0.09
GOOG
$585.61
Google Inc.
-4.99

MacTech Search:
Community Search:

Software Updates via MacUpdate

Drive Genius 3.2.4 - Powerful system uti...
Drive Genius is an OS X utility designed to provide unsurpassed storage management. Featuring an easy-to-use interface, Drive Genius is packed with powerful tools such as a drive optimizer, a... Read more
Vitamin-R 2.15 - Personal productivity t...
Vitamin-R creates the optimal conditions for your brain to work at its best by structuring your work into short bursts of distraction-free, highly focused activity alternating with opportunities for... Read more
Toast Titanium 12.0 - The ultimate media...
Toast Titanium goes way beyond the very basic burning in the Mac OS and iLife software, and sets the standard for burning CDs, DVDs, and now Blu-ray discs on the Mac. Create superior sounding audio... Read more
OS X Yosemite Wallpaper 1.0 - Desktop im...
OS X Yosemite Wallpaper is the gorgeous new background image for Apple's upcoming OS X 10.10 Yosemite. This wallpaper is available for all screen resolutions with a source file that measures 5,418... Read more
Acorn 4.4 - Bitmap image editor. (Demo)
Acorn is a new image editor built with one goal in mind - simplicity. Fast, easy, and fluid, Acorn provides the options you'll need without any overhead. Acorn feels right, and won't drain your bank... Read more
Bartender 1.2.20 - Organize your menu ba...
Bartender lets you organize your menu bar apps. Features: Lets you tidy your menu bar apps how you want. See your menu bar apps when you want. Hide the apps you need to run, but do not need to... Read more
TotalFinder 1.6.2 - Adds tabs, hotkeys,...
TotalFinder is a universally acclaimed navigational companion for your Mac. Enhance your Mac's Finder with features so smart and convenient, you won't believe you ever lived without them. Tab-based... Read more
Vienna 3.0.0 RC 2 :be5265e: - RSS and At...
Vienna is a freeware and Open-Source RSS/Atom newsreader with article storage and management via a SQLite database, written in Objective-C and Cocoa, for the OS X operating system. It provides... Read more
VLC Media Player 2.1.5 - Popular multime...
VLC Media Player is a highly portable multimedia player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, MP3, OGG, ...) as well as DVDs, VCDs, and various streaming protocols. It... Read more
Default Folder X 4.6.7 - Enhances Open a...
Default Folder X attaches a toolbar to the right side of the Open and Save dialogs in any OS X-native application. The toolbar gives you fast access to various folders and commands. You just click... Read more

Latest Forum Discussions

See All

Note Review
Note Review By Jennifer Allen on July 29th, 2014 Our Rating: :: TOO SIMPLEiPhone App - Designed for the iPhone, compatible with the iPad Note is a note taking app that’s a little too short on features to be worth its asking price... | Read more »
Chainsaw Warrior Goes on Sale & Ther...
Chainsaw Warrior Goes on Sale & There’s a Chance to Win a Copy of the Original Board Game Posted by Jennifer Allen on July 29th, 2014 [ permalink | Read more »
It Came From Canada: Tiny Tower Vegas
If you go to a casino, you might make a lot of money. If you run a casino, you’re guaranteed to make a lot of money. The choice seems pretty obvious. So while waiting for your shady real estate deals to move forward, get prepared with Tiny Tower... | Read more »
Z Hunter Review
Z Hunter Review By Lee Hamlet on July 29th, 2014 Our Rating: :: RIGHT ON TARGETUniversal App - Designed for iPhone and iPad While it might not necessarily break new ground, Z Hunter has enough tricks up its sleeve to ensure that... | Read more »
Huge Update Comes To Duet, Adding 48 New...
Huge Update Comes To Duet, Adding 48 New Stages Posted by Jennifer Allen on July 29th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Sharknado: The Video Game Available Now....
Sharknado: The Video Game Available Now. Seriously. Posted by Rob Rich on July 29th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Frog Orbs 2 Review
Frog Orbs 2 Review By Nadia Oxford on July 29th, 2014 Our Rating: :: THIS MAGIC IS A TAD MONOTONOUS Universal App - Designed for iPhone and iPad Frog Orbs 2 is repetitive, but younger players should enjoy it nonetheless.   | Read more »
Puzzix Review
Puzzix Review By Jennifer Allen on July 29th, 2014 Our Rating: :: NICE IDEAUniversal App - Designed for iPhone and iPad A little like Tetris, Puzzix is all about piecing together blocks and watching them vanish. It could do with... | Read more »
Cannonball eMail is Now Live – Works Wit...
Cannonball eMail is Now Live – Works With Gmail, Yahoo, Outlook, Hotmail, and AOL Posted by Jessica Fisher on July 29th, 2014 [ permalink ] | Read more »
To The End Review
To The End Review By Lee Hamlet on July 29th, 2014 Our Rating: :: A VICIOUS CYCLEUniversal App - Designed for iPhone and iPad To The End will test players’ patience, timing, and dedication as they try to navigate all 13 levels in... | Read more »

Price Scanner via MacPrices.net

Up to $250 price drop on leftover 15-inch Mac...
B&H Photo has dropped prices on 2013 15″ Retina MacBook Pros by as much as $250 off original MSRP. Shipping is free, and B&H charges NY sales tax only: - 15″ 2.3GHz Retina MacBook Pro: $2349... Read more
Updated MacBook Pro Price Trackers
We’ve updated our MacBook Pro Price Trackers with the latest information on prices, bundles, and availability on the new 2014 models from Apple’s authorized internet/catalog resellers as well as... Read more
Apple updates MacBook Pros with slightly fast...
Apple updated 13″ and 15″ Retina MacBook Pros today with slightly faster Haswell processors. 13″ models now ship with 8GB of RAM standard, while 15″ MacBook Pros ship with 16GB across the board. Most... Read more
Apple drops price on 13″ 2.5GHz MacBook Pro b...
The Apple Store has dropped their price for the 13″ 2.5GHz MacBook Pro by $100 to $1099 including free shipping. Read more
Apple drops prices on refurbished 2013 MacBoo...
The Apple Store has dropped prices on Apple Certified Refurbished 13″ and 15″ 2013 MacBook Pros, with model now available starting at $929. Apple’s one-year warranty is standard, and shipping is free... Read more
iOS 8 and OS X 10.10 To Support DuckDuckGo As...
Writing for Quartz, Dan Frommer reports that Apple’s forthcoming iOS 8 and OS X 10.10 operating systems version updates will allow users to select DuckDuckGo as their default search engine. He notes... Read more
U.K. Hospital Using iPods and iPads To Record...
British news journal GazetteLive’s. Ian McNeal notes that the old “an apple a day keeps the doctor away” proverb is being turned on its head at http://southtees.nhs.uk/hospitals/james-cook/ James... Read more
13-inch 2.5GHz MacBook Pro on sale for $1099,...
Best Buy has the 13″ 2.5GHz MacBook Pro available for $1099.99 on their online store. Choose free shipping or free instant local store pickup (if available). Their price is $100 off MSRP. Price is... Read more
Roundup of Apple refurbished MacBook Pros, th...
The Apple Store has Apple Certified Refurbished 13″ and 15″ MacBook Pros available for up to $400 off the cost of new models. Apple’s one-year warranty is standard, and shipping is free. Their prices... Read more
Record Mac Shipments In Q2/14 Confound Analys...
A Seeking Alpha Trefis commentary notes that Apple’s fiscal Q3 2014 results released July 22, beat market predictions on earnings, although revenues were slightly lower than anticipated. Apple’s Mac’... Read more

Jobs Board

Sr Software Lead Engineer, *Apple* Online S...
Sr Software Lead Engineer, Apple Online Store Publishing Systems Keywords: Company: Apple Job Code: E3PCAK8MgYYkw Location (City or ZIP): Santa Clara Status: Full Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
Sr. Product Leader, *Apple* Store Apps - Ap...
**Job Summary** Imagine what you could do here. At Apple , great ideas have a way of becoming great products, services, and customer experiences very quickly. Bring Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.