! Scatter Method ! library "TB Library:PictLib*" clear let d = .08 if y$ = "y" then ! call Copy_printer(1) set window -d, 1+d, -d, 1+d else set window -d, 1+d, -d, 1+d end if option angle degrees let a=-1 let b=3 let c=-1 let gold = (-b+SQR(b^2-4*a*c))/(2*a) call setMacPallette ! Grey background (60% white) let bgr = 3 let bgg = 3 let bgb = 3 call setrgb( bgr, bgg, bgb ) plot area: 0, 0; 0, 1; 1, 1; 1, 0 for w = 0 to 15 let a = 180 * 1/15 * w + 45 ! let a = 180 * gold * w let dx = d * .8 * cos(a) let dy = d * .8 * sin(a) let ex = dx / 3 let ey = dy / 3 let fx = ex / 3 let fy = ey / 3 for r = max( 0, w - 10 ) to min( w, 5 ) let cy = w - r for g = max( 0, cy - 5 ) to min( cy, 5 ) let b = cy - g call setrgb( r, g, b ) let x = g/5 * .8 + b/5 * .2 let y = r/5 * .7 + b/5 * .3 plot area: x+dx-ey,y+dy+ex;x+dx+ey,y+dy-ex;x-dx+fy,y-dy-fx;x-dx-fy,y-dy+fx if r=0 or r=5 then let redge = 1 else let redge = 0 if g=0 or g=5 then let gedge = 1 else let gedge = 0 if b=0 or b=5 then let bedge = 1 else let bedge = 0 if r = g and g = b then if g > 2 then call setrgb( 2, 2, 2 ) else call setrgb( 3, 3, 3 ) ! call setrgb( r + 2*sgn(2.5-r), g + 2*sgn(2.5-g), b + 2*sgn(2.5-b) ) let doborder = 1 else if redge + gedge + bedge = 3 then call setrgb( 0, 0, 0 ) let doborder = 1 else let doborder = 0 end if if doborder = 1 then plot x+dx-ey,y+dy+ex; x+dx+ey,y+dy-ex; x-dx+fy,y-dy-fx; plot x-dx-fy,y-dy+fx; x+dx-ey,y+dy+ex end if next g next r next w if y$ = "y" then ! call Copy_done end if end sub setrgb( r, g, b ) if r=0 and g=0 and b=0 then set color 255 else set color 36 * (5-r) + 6 * (5-g) + (5-b) end if end sub sub setMacPallette for r = 0 to 5 for g = 0 to 5 for b = 0 to 5 if r=0 and g=0 and b=0 then set color mix(255) r/5, g/5, b/5 else set color mix(36*(5-r)+6*(5-g)+(5-b)) r/5, g/5, b/5 end if next b next g next r end sub