[net.micro.amiga] balls.c - some lines were truncated

perry@well.UUCP (Perry S. Kivolowitz) (11/28/85)

Captain Crunch has told me that the macintosh used to get balls.c onto
the WELL has trunctated three lines  in the source code. Here's a list
of these three lines and what's wrong with each.

line 366:  We are computing the length of the vector. The code which
	   squares the z component is missing.

line 404:  We are computing a dot product here. The multiplication of
	   the two z components was truncated.

line 414:  Same as 404

	Hope your balls look as good as mine. (Dear god! Did I say that?).

						Perry S. Kivolowitz
						pstfa!well!perry

fnf@unisoft.UUCP (11/29/85)

In article <306@well.UUCP> perry@well.UUCP (Perry S. Kivolowitz) writes:
>Captain Crunch has told me that the macintosh used to get balls.c onto
>the WELL has trunctated three lines  in the source code. Here's a list
>of these three lines and what's wrong with each.
>

Here are the fixes I made.  They seem to work, but no guarantees.  By the
way, the first time I tried it, I thought it was broken.  It drew three
balls in the bottom center of the screen, then nothing else happened for
a LONG time.  After about 15 seconds, I got bored, popped the workbench
screen to the front and did a few other things.  Then when I came back to
the screen later, things were chugging along (don't want to spoil the fun
for those that haven't seen it yet!)...  Guess you just have to be 
patient.

-Fred

-----------------------------------

177c177
<    if(!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library")
---
>    if(!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library")))
250c250
<    ClipBlit(&right[NSTEPS-1].rp,0,0,w->RPort,right[NSTEPS-1].sx,right[NSTEPS-1];
---
>    ClipBlit(&right[NSTEPS-1].rp,0,0,w->RPort,right[NSTEPS-1].sx,right[NSTEPS-1]);
365,366c365,371
<  
<    length.i = SPSqrt(SPAdd(SPAdd(SPMul(p->x.i,p->x.i) , SPMul(p->y.i,p->y.i)) ,;
---
>    int xsquared, ysquared, zsquared;
> 
>    xsquared = SPMul (p -> x.i, p -> x.i);
>    ysquared = SPMul (p -> y.i, p -> y.i);
>    zsquared = SPMul (p -> z.i, p -> z.i);
>    length.i = SPSqrt (SPAdd (SPAdd (xsquared, ysquared), zsquared));
> 
404c409,410
<          d.i = SPAdd(SPAdd(SPMul(pnt.z.i , l.z.i) , SPMul(pnt.y.i , l.y.i)) , S;
---
> 	 d.i = SPAdd(SPMul(pnt.x.i , l.x.i) , SPMul(pnt.y.i, l.y.i));
> 	 d.i = SPAdd(d.i , SPMul(pnt.z.i , l.z.i));
414c420,421
<             d.i = SPAdd(SPAdd(SPMul(H.x.i , pnt.x.i) , SPMul(H.y.i , pnt.y.i)) ;
---
> 	    d.i = SPAdd(SPMul(H.x.i , pnt.x.i), SPMul(H.y.i , pnt.y.i));
> 	    d.i = SPAdd(d.i, SPMul(H.z.i , pnt.z.i)); 

hamilton@uiucuxc.CSO.UIUC.EDU (12/03/85)

i had to make a fix to one of fred's fixes:

|250c250
|<    ClipBlit(&right[NSTEPS-1].rp,0,0,w->RPort,right[NSTEPS-1].sx,right[NSTEPS-1];
|---
|>    ClipBlit(&right[NSTEPS-1].rp,0,0,w->RPort,right[NSTEPS-1].sx,right[NSTEPS-1]);

i think should be:

>    ClipBlit(&right[NSTEPS-1].rp,0,0,w->RPort,right[NSTEPS-1].sx,right[NSTEPS-1].sy,D,D,0xC0);

	wayne hamilton
	U of Il and US Army Corps of Engineers CERL
UUCP:	{ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton
ARPA:	hamilton@uiucuxc.cso.uiuc.edu
CSNET:	hamilton%uiucuxc@uiuc.csnet
USMail:	Box 476, Urbana, IL 61801
Phone:	(217)333-8703