Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Plugged
21
Years of Service
User Offline
Joined: 30th Nov 2002
Location: Hertfordshire
Posted: 10th Nov 2005 21:11
guys how do you draw a filled circle to the screen because circle command just draws the out line?

cheers
Plugged


Work Hard; Play Harder ;
Me!
18
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 10th Nov 2005 22:06 Edited at: 10th Nov 2005 22:34


if you get gaps then make the steps smaller , feel free to make it into a function, in fact I just did, and locked pixels to speed it somewhat, heres a demo.





if there is one thing I can NOT tolerate, it`s intolerant people.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Nov 2005 22:22
My fast filled circle function, guaranteed no gaps



For free Plug-ins and source code http://www.matrix1.demon.co.uk
Me!
18
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 10th Nov 2005 22:37 Edited at: 10th Nov 2005 22:40
mines not only prettier but I gave myself a headache working out the math, so mines better (cos it took more effort) lol

seriously, IanM`s must do more drawing by the looks of it, all those boxes repeatedly drawn, I don`t know which would be faster tbh, I forgot lines are slower than boxes, I could rewrite the code with boxes I suppose , nah! can`t be ..er...bothered



if there is one thing I can NOT tolerate, it`s intolerant people.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Nov 2005 00:10
You really should benchmark your code before you make statements like that



On my aging laptop, your code runs in 815ms, while mine runs in 56ms. The step size of 0.55 was chosen to give a perfectly filled circle at that radius, just so that I was comparing like-for-like.

I also applied a fix to your line command - the last pixel isn't drawn when using line, so you have to add 1. I also removed the '*0.9' that made the circle flattened

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Me!
18
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 11th Nov 2005 19:21
? without 0.9 the circle was too tall on my screen, anti ellipse correction

I didn`t say mine was faster, I wondered if yours was slower since it did a lot of drawing over large regions compared to mine that only drew each row once, then I remembered that line was slower than box by a whole heap (when are they gonna fix that btw).

the time differential is larger than I would have thought too, my code is shorter, yet yours is faster , mine obviously executes more loops, yours counts from 70 to 100 (30 loops), mine from 0 to 180 in halves (360 loops), thats where the time difference comes in, your code is by far the faster, but I like mine better cos it took me so much work to solve it, I can`t bear to think it was all in vain .



if there is one thing I can NOT tolerate, it`s intolerant people.

Login to post a reply

Server time is: 2024-05-18 13:34:56
Your offset time is: 2024-05-18 13:34:56