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.

Newcomers DBPro Corner / Drawing "Filled" circles?

Author
Message
300happy
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location: Indiana, USA
Posted: 3rd Mar 2008 20:34
This is a silly little issue, but I can't figure it out on my own.

I've got this function:



I thought by using a for loop, I could draw filled circles, but I quickly found that with a radius of 20, the "solid" circles have little holes in them. I know this is probably because the calculated circles don't actually cover the entire space inside the largest circle.

I need to be able to draw a filled circle. This is for a small terrain editor type of thing, and so it needs to be as pixel precise as possible. Having little holes in the terrain, especally just a few pixels under the edges of the terrain, won't work well later.

How can I draw a filled circle?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Mar 2008 21:12
Use the forum search facility - "Circles" gets an incredible number of hits for this topic
Paul08
16
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
300happy
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location: Indiana, USA
Posted: 3rd Mar 2008 23:18
I get a compile error when using the code found here:

http://developer.thegamecreators.com/?m=codebase_view_code&i=c6a376253a019691f5fcc97de1c5247a

Using #include to add it to my program appears to work fine, but then I get this error on compiling:

Current Line: Compiler Error
The name 'MoveTo' duplicated in the program inside
extra2dfunctions.dba

I looked at the code in extra2dfunctions(which is an exact copy of the code in the codebase), and can't find what it's talking about. There is a function that contains MoveTo(X,Y), but it's after the creation of the MoveTo function itself.

Needless to say, without being able to compile my project, I have no idea if this code works or not for what I need to do.
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 5th Mar 2008 02:09
OR! i think you can use ellipticals... or whatever they are..


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 5th Mar 2008 03:05
Check this out:

http://en.wikipedia.org/wiki/Flood_fill


Whatever...
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Mar 2008 14:32
Quote: "I get a compile error when using the code found here"

So remove all of the functions except for FilledCircle - none of the others are needed for the circle function.

Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 6th Mar 2008 16:17 Edited at: 7th Mar 2008 04:34
Sorry, that flood fill stuff might be overkill for makeing solid circles. Also, your program could crash with a stack overflow on a larger circle.

I thought that filled circle routine in the codebase was just a little too fancy for my taste so I wrote this:



Edit: The codebase one is about ten times faster though.

Here is one with both routines, (mine=leftclick, codebase=rightclick), have fun.




Whatever...

Login to post a reply

Server time is: 2024-09-27 12:17:45
Your offset time is: 2024-09-27 12:17:45