You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
For a circle of radius R, and a polygon with nV vertices defined in the 2 X nV matrix P, the following code will compute the area of the intersection in A, as well as its shape in pointList and isArc:
[A, pointList, isArc] = polygonCircleIntersection(R, P)
pointList is the list of points in the new shape, and isArc is an array of logicals where isArc(i) is true if if the segment between pointList(i-1) and pointList(i) is an arc, and is false if it is a line segment.
The following function contains examples, which you can go through one by one by running
testPolygonCircleIntersection
and pressing ENTER to go to the next example. This function will also draw the shapes of the intersections.
If you find any issues, please let me know.
Known issues:
- If the intersection produces a disjoint shape, this code will fail. If the shape P is not convex, this is a possibility, in which case you should triangulate it, using, for example, the function triangulation, and provide the resulting triangles separately
Cite As
Simão Pedro da Graça Oliveira Marto (2026). Intersection of polygon and circle (https://www.mathworks.com/matlabcentral/fileexchange/126645-intersection-of-polygon-and-circle), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.0.1 (4.81 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
