This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Game Development and the fly likes Optimizing circle drawer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Optimizing circle drawer" Watch "Optimizing circle drawer" New topic

Optimizing circle drawer

Meshulam Silk

Joined: Feb 12, 2012
Posts: 22
I'm making a game using a grid and I recently decided to make a circle drawer. After a bit of deep trig thinking I came up with a simple way to plot a circle:

I get the circle just fine I just wanted to know of there was a more efficient way to increment i instead of going through all the angles.
I came up with a this: i+=45/(radius-2)
I've tried it out and it seems to work pretty well for smaller circles but I think (haven't had a chance to test) it might screw up with bigger circles. Does anyone know of this is the most efficient incrementation (or if it's right)?
Tim Moores

Joined: Sep 21, 2011
Posts: 2409
This should be of interest:
Meshulam Silk

Joined: Feb 12, 2012
Posts: 22
Thanks for the quick reply. I'll have a look.
Don't get me started about those stupid light bulbs.
subject: Optimizing circle drawer
It's not a secret anymore!