Skip to content

Instantly share code, notes, and snippets.

@pmalin
Created November 2, 2020 13:15
Show Gist options
  • Save pmalin/fa4f36e897e466bc7d85e63c09f80961 to your computer and use it in GitHub Desktop.
Save pmalin/fa4f36e897e466bc7d85e63c09f80961 to your computer and use it in GitHub Desktop.
BBC Micro Bot - Raytracer
1MO.2:V.5:F.V=0TO255:F.U=0TO159:x=U/64-1:y=V/128-1.4:z=1/SQR(x*x+y*y+1):x=x*z:y=y*z:X=0:Y=.4:Z=-2:I=6:R=RND(1):P=-Y*y-Z*z:i=x*P:j=Y+y*P:k=Z+z*P:C=i*i+j*j+k*k
2IFC<1w=P-SQR(1-C):X=w*x:Y=Y+w*y:Z=Z+w*z:D=X*x+Y*y+Z*z:x=x-2*X*D:y=y-2*Y*D:z=z-2*Z*D
3IFy<0t=(Y+1)/-y:u=X+x*t:v=Z+z*t:L=u*u+v*v:IF9/L>R I=3+SIN(u*7)+SIN(v*7)
4IFC<1A.R>.9ORL<R I=0
5IFR<y*y*y I=7
6GC.0,I:PL.69,U*8,V*4:N.,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment