X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fbb9d,ce31cf396284cd16 X-Google-Attributes: gidfbb9d,public From: Andrew Garrard Subject: talk: sphere intersecting a plane Date: 1996/02/08 Message-ID: <4fc5v7$dak@miso.wwa.com>#1/1 X-Deja-AN: 138438647 sender: boba@sashimi.wwa.com references: <4f9v79$dhm@miso.wwa.com> organization: rec.arts.ascii newsgroups: rec.arts.ascii In article <4f9v79$dhm@miso.wwa.com> bgriffin@ic.sunysb.edu (Eli the bearded) wrote: > It's output is a sphere intersecting a plane. The image is > a little rough in places, and I am considering a different > shading, but overall I am quite happy. This program assumes > a vt100. It could be adapted to other terminals fairly > easily, if you know what to modify. I'm impressed. I'll have a look at it on a vt100 when I'm at work. > This was inspired by a guy with a piece of signature code to > generate a full screen ascii mandelbrot. Something like this? /* o._.o (C) 1996 Andrew Garrard, fluppeteer@fluppet.demon.co.uk o~\_/~o */ /* ((^)) */main(c){float x,y=2,X,Y,Z;for(;(x=-2)<(y-=.1);puts(""/* (/\ /\) */ /* O)_(O */ ))for(;(X=x+=.05)<2;c=printf("%c"," .-:|O8M#"[c])) /* (\@o@/) */ /* O/ \O */for(Y=y;X*X+Y*Y<4&&c++<8;Z=x+X*X-Y*Y,Y=y+2*X*Y,X=Z);}/* ~~~ ~~~ */ >Elijah >------ /* cc -Dp=putchar signature.c -lm */ >main(){int i,j,k,l;char m[]=" .,:;i!1I]fJYVOQZXHKNSWM";for(i=-12;i<13;i++){for >(k=0,l=7379124;k<6;k++)p((l&0xf)+(k?97:65)),l>>=4;for(j=-12;j<12;j++){for(k=(j >+12?-12:-6);k<12;k++)((l=i*i+j*j+k*k)<144)?p(m[l=sqrt(l+2)*2]):p((l<25)?39:32) >;(j!=11)?p('\n'):0;}p(27),p(91),p(72);}puts("Elijah:bgriffin@ic.sunysb.edu");} I thoroughly approve. (gcc signature.c -lm, btw). -- main(c){float x,y=1,s,f;for(;-1<(y-=.1);puts(""))for(x=-2;2>(x+=.05);printf( "%c","@#MHX]:' "[9>2*(f=4+x*x+y*y)?c=(9+(y+x*2-12)/f*(3-sqrt(9-2*f)))/6.7*16 :y>-.5?8:3*((c=8+x/y)&1^1&(c=400/y))+(s=y*(x*8+y*6+48)+72,s*s/676>8+12*y+y*y *f?3:4)]));puts("(C) 1996 Andrew Garrard, fluppeteer@fluppet.demon.co.uk");}