View Single Post
Old 13th July 2006, 07:36   #256
The Earthquaker
Member
 
The Earthquaker's Avatar
 
Join Date: Jan 2006
Location: Environment
Posts: 87
Anybody could they say why the code is so unefficient...
Its purpose was to draw a border with length halfx*2, width halfy*2, and this code is supposed to be optimised. SuperScope, n=535.

//init
halfx=100; halfy=50; opts=0.5/(halfx+halfy); sqd=sqr(opts);
rej1=opts*halfx; rej2=opts*halfy;

//frame
rlw=halfx/w; rlh=halfy/h;

//point
x=if(above(i,rej1),if(above(i,0.5),if(above(i,0.5+rej1),-rlw,(i-0.5)*n*halfx*sqd*2-rlw),rlw),i*n*halfx*sqd*2-rlw);
y=if(above(i,rej1),if(above(i,0.5),if(above(i,0.5+rej1),(i+rej2-1)*n*halfy*sqd*4-rlh,rlh),(i-rej1)*n*halfy*sqd*4-rlh),-rlh);
The Earthquaker is offline   Reply With Quote