Intersection of polygon and circle

Computes the area and shape of the intersection of a polygon with a circle
5.0 次下载
更新时间 2023/3/22

查看许可证

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

引用格式

Simão Pedro da Graça Oliveira Marto (2024). Intersection of polygon and circle (https://www.mathworks.com/matlabcentral/fileexchange/126645-intersection-of-polygon-and-circle), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2023a
兼容任何版本
平台兼容性
Windows macOS Linux
标签 添加标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.1

added image, updated description

1.0.0