All pastes #625502 Raw Edit

kreeme

public text v1 · immutable
·published 2007-07-18 23:45 UTC
rendered paste body
midX = ScreenWidth / 2
midY = ScreenHeight / 2
midZ = 256

float zangle = 0.2
float xyangle = 0
float xyrad = 40
float zrad = 100

for xyangle = 0 to 2*pi step 0.001
   x = midX + xyrad * cos(xyangle);
   y = midY - xyrad * sin(xyangle);	// compensate for non-cartesian coordinate plane
   z = midZ + zrad * sin(zangle);
   realX = MidX + (x*midZ) / z; 	// starfield algorithm to get 2d x,y from x,y,z
   realy = MidY + (y*midZ) / z;
   putpixel(realx, realy, color);
end for