%! % Copyright (C) 1988 by Bruce Schwartz and Mark Lentczner. All rights % reserved. This program is provided for unrestricted use, provided that % this copyright message is preserved. There is no warranty, and no % author or distributer accepts responsibility for any damage caused by % this program. % % This is an interactive screen saver program. % % The algorithms used in this program are based on an idea of Dan Ingalls. % /boxHeight 75 def /boxWidth 75 def /bs { [boxWidth boxHeight] {mul} arrayop } def /pt1 [ .2 .2 ] bs def /pt2 [ .3 .6 ] bs def /pt3 [ .6 .8 ] bs def /pt4 [ .8 .6 ] bs def /pts [ pt1 pt2 pt3 pt4 ] def /ptl [ .5 0 ] bs def /dotSize boxWidth boxHeight min 24 div 2 max def /curveWidth 1 def /labelFont /Times-Roman findfont 20 scalefont def /coordinates % pt -> x y { aload pop } def /string2Index % s -> a b c d convert a string to the four indicies { 0 1 3 { 1 index exch 1 getinterval cvi exch } for pop } def /dot { coordinates dotSize 0 360 arc fill } def /paintPoints % - -> - show the points { pt1 dot pt2 dot pt3 dot pt4 dot } def /drawCurve % a b c d -> - draw the curve in the order given { 10 dict begin 1 sub /d exch def 1 sub /c exch def 1 sub /b exch def 1 sub /a exch def curveWidth setlinewidth pts a get coordinates moveto pts b get coordinates pts c get coordinates pts d get coordinates curveto stroke end } def /labelCurve % s -> - label a curve { labelFont setfont ptl coordinates moveto cshow } def /locateCurve % a b c d -> a b c d translate the world for the given spot { 10 dict begin 0 index 1 sub /v exch def 3 index 1 sub /h exch def h boxWidth mul v boxHeight mul translate end } def /doCurve % s -> - do it all! { gsave dup string2Index % locateCurve paintPoints drawCurve labelCurve grestore } def /doAllCurves % - -> - paint all 24 curves { (1234) doCurve (1243) doCurve (1342) doCurve (2341) doCurve (2134) doCurve (2143) doCurve (3124) doCurve (3142) doCurve (3241) doCurve (4123) doCurve (4132) doCurve (4231) doCurve } def /curveMenuItem % s keyword -> - { /paint eq {currentpoint translate doCurve} {pop boxHeight boxWidth} ifelse } def /doHysterisisMenuItem % - -> - { userdict begin /hysterisis currentkey cvi def initState end } def /doLineMenuItem % - -> - { userdict begin /drawNextThing { drawNextLine } def initState end } def /doCurveMenuItem % - -> - { userdict begin /drawNextThing { drawNextCurve } def /CurveType currentkey 0 get def initState end } def /doAboutMenuItem % -> - { currentcursorlocation [ ( Created by Mark Lentczner and Bruce Schwartz.) ( Based on an idea by Dan Ingalls.) ] popmsg } def /nullMenuItem % keyword -> - { /paint ne {boxHeight boxWidth} if } def /doNullMenuItem % - -> - { } def /hysterisismenu [ (5) (10) (20) (30) (40) (50) ] [ { doHysterisisMenuItem} ] /new DefaultMenu send def /curvemenu [ [ (1234) {curveMenuItem} ] { doCurveMenuItem } [ (1243) {curveMenuItem} ] { doCurveMenuItem } [ (1342) {curveMenuItem} ] { doCurveMenuItem } { nullMenuItem } { doNullMenuItem } [ (2134) {curveMenuItem} ] { doCurveMenuItem } [ (2143) {curveMenuItem} ] { doCurveMenuItem } { nullMenuItem } { doNullMenuItem } [ (2341) {curveMenuItem} ] { doCurveMenuItem } [ (3124) {curveMenuItem} ] { doCurveMenuItem } { nullMenuItem } { doNullMenuItem } [ (3142) {curveMenuItem} ] { doCurveMenuItem } [ (3241) {curveMenuItem} ] { doCurveMenuItem } { nullMenuItem } { doNullMenuItem } [ (4123) {curveMenuItem} ] { doCurveMenuItem } [ (4132) {curveMenuItem} ] { doCurveMenuItem } [ (4231) {curveMenuItem} ] { doCurveMenuItem } ] /new DefaultMenu send def { /LayoutStyle [4 4] def /StrokeSelection? true def /CellHorzGap 5 def /CellVertGap 5 def % /RetainCanvas? true def } curvemenu send /lockmenu [ (About...) { doAboutMenuItem } (Lines) { doLineMenuItem } (Curves ->) curvemenu (History ->) hysterisismenu ] /new DefaultMenu send def