Be Excellent To Each Other

And, you know, party on. Dude.

All times are UTC [ DST ]




Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Fucking circles fuck
PostPosted: Sat Jun 09, 2012 0:04 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69713
Location: Your Mum
So, imagine you've got a big old grid of little squares. Some might even call them pixels.

All these pixels are labelled grid-reference style, so top left is 0:0, top right is 0:100, middle is 50:50, etc (this assumes an overall size of 100x100, obviously).

So, say someone picks one of these points, maybe 21:45. How do I work out which pixelsI have to recolour to draw a 5 pixel radius circle around the chosen one?

I can do diamonds. Diamonds are easy. And squares and shit. I like right angles.

I can also do drinking. Maybe this will be easier in the morning.

It would be double easier if one of you tells me.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Fucking circles fuck
PostPosted: Sat Jun 09, 2012 1:38 
User avatar
MR EXCELLENT FACE

Joined: 30th Mar, 2008
Posts: 2568
I asked paint.net and it said:
Image
hmm, bit small.
Try this:
Image


(obviously that's a non blended or anti-aliased one.)

_________________
This man is bound by law to clear the snow away


Top
 Profile  
 
 Post subject: Re: Fucking circles fuck
PostPosted: Sat Jun 09, 2012 1:56 
User avatar
Skillmeister

Joined: 27th Mar, 2008
Posts: 27023
Location: Felelagedge Wedgebarge, The River Tib
So two rectangles then.

_________________
Washing Machine: Fine. Kettle: Needs De-scaling. Shower: Brand new. Boiler: Fine.
Archimedes Hotdog Rhubarb Niner Zero Niner.


Top
 Profile  
 
 Post subject: Re: Fucking circles fuck
PostPosted: Sat Jun 09, 2012 7:52 
User avatar
What's this bit for exactly?

Joined: 6th Dec, 2008
Posts: 880
Location: Caerdydd
Cheap way (i.e easy for a computer to calculate)...
Process a square around the center point +/- the radius.
For each pixel, work out...
(x - center_x)*(x - center_x) + (y - center_y)*(y - center_y) - radius*radius
If this us <0 then fill it with the colour, otherwise leave it alone.
Huzzah for Pythagoras!


Top
 Profile  
 
 Post subject: Re: Fucking circles fuck
PostPosted: Sat Jun 09, 2012 9:53 
User avatar
Heavy Metal Tough Guy

Joined: 31st Mar, 2008
Posts: 6607
en.m.wikipedia.org/wiki/Midpoint_circle_algorithm

Midpoint Circle Algorithm might be your chum here!


Top
 Profile  
 
 Post subject: Re: Fucking circles fuck
PostPosted: Sat Jun 09, 2012 12:19 
User avatar
Hibernating Druid

Joined: 27th Mar, 2008
Posts: 49352
Location: Standing on your mother's Porsche
You need to invent the squircle.

_________________
SD&DG Illustrated! Behance Bleep Bloop

'Not without talent but dragged down by bass turgidity'


Top
 Profile  
 
 Post subject: Re: Fucking circles fuck
PostPosted: Sat Jun 09, 2012 18:24 
User avatar
MR EXCELLENT FACE

Joined: 30th Mar, 2008
Posts: 2568
Pod wrote:
I asked paint.net and it said:
Image
hmm, bit small.
Try this:
Image


(obviously that's a non blended or anti-aliased one.)



I realised that you asked for 5px radius, and this is 5px diameter. BAD. If I could be bothered I'd load up paint.net and use a size-9 brush and do the same. But that's less trivial. Just use the x^2+y^2-r=0 given above.

_________________
This man is bound by law to clear the snow away


Top
 Profile  
 
 Post subject: Re: Fucking circles fuck
PostPosted: Mon Jun 11, 2012 11:18 
User avatar
Gogmagog

Joined: 30th Mar, 2008
Posts: 48897
Location: Cheshire
Zardoz wrote:
You need to invent the squircle.


I'm sorry, I'm really not that into Pokemon.

_________________
Mr Chris wrote:
MaliA isn't just the best thing on the internet - he's the best thing ever.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Mimi and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search within this thread:
You are using the 'Ted' forum. Bill doesn't really exist any more. Bogus!
Want to help out with the hosting / advertising costs? That's very nice of you.
Are you on a mobile phone? Try http://beex.co.uk/m/
RIP, Owen. RIP, MrC. RIP, Dimmers.

Powered by a very Grim... version of phpBB © 2000, 2002, 2005, 2007 phpBB Group.