File Exchange

image thumbnail

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

version (1.37 KB) by Divakar Roy
Checks whether a point lies inside,outside or on a circle defined by 3 other points.


Updated 24 Jun 2011

View License

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.

Comments and Ratings (6)

Thanks a lot..It Worked!!


i want to find out the N coordinate point in space of 2000 m x 2000m. but constraints is that two co ordinate point are does not intersect within the radius of 200m of each other.
pl. help me for making such program in matlab.


hi, i looked for a code to check a point is inside a circle and i found this one. i tried to work on this code. but i didn't understand the 3 points--> (x1,y1),(x2,y2),(x3,y3). pls help me find that.

Nilimb Misal

nice work. simple and fast

Jérôme My Last Name


add these modifications to your code :


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



Added screenshot.

As suggested by Jerome, i have made the modifications.
So now it works very fast.Thank you Jerome.

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor