(FILECREATED " 8-Sep-85 18:19:47" {ERIS}<LISPCORE>LISPUSERS>BOUNCE.;5 4363   

      changes to:  (VARS BOUNCECOMS)

      previous date: " 6-Aug-85 17:42:50" {ERIS}<LISPCORE>LISPUSERS>BOUNCE.;4)


(* Copyright (c) 1985 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT BOUNCECOMS)

(RPAQQ BOUNCECOMS [(FILES IDLEHAX)
		   (* this is needed for the function DEMOWINDOW)
		   (VARS (bounce.bouncing NIL)
			 (bounce.lines 100)
			 (bounce.maxa 6)
			 (bounce.maxd 360000)
			 (bounce.maxv 30)
			 (bounce.timeout 300)
			 (bounce.width 1))
		   (GLOBALVARS bounce.bouncing bounce.lines bounce.maxa bounce.maxd bounce.maxv 
			       bounce.width bounce.timeout)
		   (DECLARE: DONTCOPY (MACROS bounce.check.length bounce.update))
		   (FNS bounce.around)
		   [ADDVARS (IDLE.FUNCTIONS (Bounce (QUOTE bounce.around]
		   (P (LISTPUT IDLE.PROFILE (QUOTE DISPLAYFN)
			       (QUOTE bounce.around])
(FILESLOAD IDLEHAX)



(* this is needed for the function DEMOWINDOW)


(RPAQQ bounce.bouncing NIL)

(RPAQQ bounce.lines 100)

(RPAQQ bounce.maxa 6)

(RPAQQ bounce.maxd 360000)

(RPAQQ bounce.maxv 30)

(RPAQQ bounce.timeout 300)

(RPAQQ bounce.width 1)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS bounce.bouncing bounce.lines bounce.maxa bounce.maxd bounce.maxv bounce.width 
	    bounce.timeout)
)
(DECLARE: DONTCOPY 
(DECLARE: EVAL@COMPILE 
[PUTPROPS bounce.check.length MACRO (NIL (COND ((IGREATERP [SETQ distance
								 (IPLUS (ITIMES (IDIFFERENCE onex 
											     twox)
										(IDIFFERENCE onex 
											     twox))
									(ITIMES (IDIFFERENCE oney 
											     twoy)
										(IDIFFERENCE oney 
											     twoy]
							   bounce.maxd)
						(SETQ distance (SQRT (FQUOTIENT bounce.maxd distance))
						      )
						(SETQ twox (IPLUS onex (FTIMES (IDIFFERENCE twox onex)
									       distance)))
						(SETQ twoy (IPLUS oney (FTIMES (IDIFFERENCE twoy oney)
									       distance]
[PUTPROPS bounce.update MACRO ((pos vel pmin pmax vmax amax)
	   (PROGN (SETQ vel (IPLUS vel (RAND (IMINUS amax)
					     amax)))
		  [COND ((IGREATERP vel vmax)
			 (SETQ vel vmax))
			((ILESSP vel (IMINUS vmax))
			 (SETQ vel (IMINUS vmax]
		  (SETQ pos (IPLUS pos vel))
		  (COND ((IGREATERP pos pmax)
			 (SETQ pos (IDIFFERENCE pmax (IDIFFERENCE pos pmax)))
			 (SETQ vel (IMINUS vel)))
			((ILESSP pos pmin)
			 (SETQ pos (IPLUS pmin (IDIFFERENCE pmin pos)))
			 (SETQ vel (IMINUS vel]
)
)
(DEFINEQ

(bounce.around
(LAMBDA (W) (SETQ W (DEMOWINDOW W)) (LET ((left 4) (right (DIFFERENCE (WINDOWPROP W (QUOTE WIDTH)) 4))
 (top (DIFFERENCE (WINDOWPROP W (QUOTE HEIGHT)) 4)) (bottom 4)) (PROG (dsp (onex (RAND left right)) (
onexv (RAND (MINUS bounce.maxv) bounce.maxv)) (oney (RAND bottom top)) (oneyv (RAND (MINUS bounce.maxv
) bounce.maxv)) (twox (RAND left right)) (twoxv (RAND (MINUS bounce.maxv) bounce.maxv)) (twoy (RAND 
bottom top)) (twoyv (RAND (MINUS bounce.maxv) bounce.maxv)) history distance) (SETQ dsp (WINDOWPROP W 
(QUOTE DSP))) (bounce.check.length) (SETQ history (for i from 1 to bounce.lines collect (PROG1 (CONS (
CONS onex oney) (CONS twox twoy)) (BLOCK) (DRAWLINE onex oney twox twoy bounce.width (QUOTE INVERT) 
dsp) (bounce.update onex onexv left right bounce.maxv bounce.maxa) (bounce.update oney oneyv bottom 
top bounce.maxv bounce.maxa) (bounce.update twox twoxv left right bounce.maxv bounce.maxa) (
bounce.update twoy twoyv bottom top bounce.maxv bounce.maxa) (bounce.check.length)))) (RESETSAVE (
NCONC history history) (LIST (QUOTE RPLACD) (LIST (QUOTE QUOTE) history) NIL)) (do (BLOCK) (
DRAWBETWEEN (CAAR history) (CDAR history) bounce.width (QUOTE INVERT) dsp) (RPLACA (CAAR history) onex
) (RPLACD (CAAR history) oney) (RPLACA (CDAR history) twox) (RPLACD (CDAR history) twoy) (DRAWLINE 
onex oney twox twoy bounce.width (QUOTE INVERT) dsp) (bounce.update onex onexv left right bounce.maxv 
bounce.maxa) (bounce.update oney oneyv bottom top bounce.maxv bounce.maxa) (bounce.update twox twoxv 
left right bounce.maxv bounce.maxa) (bounce.update twoy twoyv bottom top bounce.maxv bounce.maxa) (
bounce.check.length) (SETQ history (CDR history)))))))
)

(ADDTOVAR IDLE.FUNCTIONS (Bounce (QUOTE bounce.around)))
(LISTPUT IDLE.PROFILE (QUOTE DISPLAYFN)
	 (QUOTE bounce.around))
(PUTPROPS BOUNCE COPYRIGHT ("Xerox Corporation" 1985))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (2464 4159 (bounce.around 2474 . 4157)))))
STOP