Intersection of polygon and circle
Versión 1.0.1 (4,81 KB) por
Simão Pedro da Graça Oliveira Marto
Computes the area and shape of the intersection of a polygon with a circle
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
Citar como
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. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2023a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS LinuxEtiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.