Serprex likes drawing circles

Posted by s on Jan. 11, 2008, 4:45 p.m.

Serprex draws circles better than GM

Josh likes, and has decided to incorporate an equiv for ENIGMA. And the best part is, this uses no trig

Though it does run sqrt relative to the radius

//0=x 1=y 2=r

var r2,xx,yy,x1,x2;

x1=argument0-argument2//left edge

x2=argument0+argument2//right edge

r2=sqr(argument2)//To avoid computation in loop

draw_primitive_begin(pr_linelist)//This draws horizontal lines. I'm thinking it could be made to have about 70% on the loop count if I cut the drawings into 4sections

for(yy=0;yy<argument2;yy+=1){//I think this is the best loop to chose

xx=argument2-sqrt(r2-sqr(yy))//This finds half the width of the circle based on the height

draw_vertex(x1+xx,argument1-yy);draw_vertex(x2-xx,argument1-yy)//This draws the top half of the circle

draw_vertex(x1+xx,argument1+yy);draw_vertex(x2-xx,argument1+yy)//This draws the bottom half of the circle

}

draw_primitive_end()

Optimizations welcome

Comments

FireflyX 18 years, 1 month ago

Ah the random circles comment you made on msn is becoming clearer now :p

Jaxx 18 years, 1 month ago

Why not just post it as an example altogether?

s 18 years, 1 month ago

Will do, once I add in a few bells

PY 18 years, 1 month ago

No whistles?

Also, those circles in the image look cool, but why are they better than GMs?

s 18 years, 1 month ago

Top is mine,bottom is GM's

And whistles are for eMac lovers

edmunn 18 years, 1 month ago

draw_set_circle_precision()?

stampede 18 years, 1 month ago

Whistlers please.

No, looks great!