We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionGeneral Discussion,  Status › Math question: Is coord inside circle
Page Index Toggle Pages: 1
Math question: Is coord inside circle? (Read 1350 times)
Math question: Is coord inside circle?
Mar 16th, 2010, 2:43am
 
I was wondering how to write a function to check if a coordinate is inside a circle. Has anyone tackled this before?
Re: Math question: Is coord inside circle?
Reply #1 - Mar 16th, 2010, 3:35am
 
Found it  Smiley Here's the equation:

(x - a)2 + (y - b)2 <= r2

with (a, b) being the center of the circle and (x, y) the coordinate you want to check.
Re: Math question: Is coord inside circle?
Reply #2 - Mar 16th, 2010, 4:52am
 
Simply: dist() between coordinate and center of circle < radius of circle (or <=)
Re: Math question: Is coord inside circle?
Reply #3 - Mar 21st, 2010, 12:48pm
 
hehe, what PhiLho says.  Wink
Page Index Toggle Pages: 1