Code covered by the BSD License

Highlights from Check Whether a Point Lies Inside,Outside or On a Circle

Be the first to rate this file! 17 Downloads (last 30 days) File Size: 1.37 KB File ID: #8284

Check Whether a Point Lies Inside,Outside or On a Circle

12 Aug 2005 (Updated )

Checks whether a point lies inside,outside or on a circle defined by 3 other points.

File Information
Description

This program checks whether a point (x,y) lies inside,outside or on a circle defined by 3 other points.

Syntax: iscircle(X,Y,x,y), where X=[x1 x2 x3] and Y=[y1 y2 y3]. Thus, a circle can be made out of these 3 points-->(x1,y1), x2,y2)&(x3,y3).
Program checks whether point (x,y) lies inside,outside or on the circle.
ans=0 ==> lie on the circle.
ans=1 ==> lie outside the circle.
ans=-1 ==> lie inside the circle.

MATLAB release MATLAB 7.11 (R2010b)
29 Jan 2007

nice work. simple and fast

16 Aug 2005

Hi,

val=(x-h).*(x-h)+(y-k).*(y-k)-r*r;
result=sign(val);

This will let you check multiple points location at the same time.
Use SIGN here to avoid "if" condition.

Jérôme