Polygon_Intersectio​n

This function computes n-times intersection region of shapes collection
5.8K Downloads
Updated 19 Jun 2009

View License

This function computes n-times intersection region of shapes collection and allows to identify every intersection region in which shapes intersect.

The function takes one argument as input, a structure S containing geometrical descriptions of shapes, and delivers one output argument, a structure containing the different shape intersections, with the shape indexes involded in the intersection and the associated area. The second argument is optional. Display_result is a binary value which indicates whether the result should be displayed (1) or not (0).

Input: S : Structure containing geometrical description of polygons.
S(i) contains all information relative to the i-th shape
S(i).P(j) gives access to the geometrical description of the j-th
element of the i-th shape.
XData : S(i).P(j).x : Vector
YData : S(i).P(j).y : Vector
Hole : S(i).P(j).hole : Binary value (1= hole, 0= fill).
This binary variable indicates whether the consider polygon
S(i).P(j) is a hole or not. Hole are represented with
dotted lines on figures.

Output: Geo : Structure containing geometrical description of the
intersection polygons, their area, and shape indexes used
to compute the intersection.

Geo(i).index contains the polygon indexes
Geo(i).P contains the geometry of the polygon
P is a structure containing XData &
YData of polygons.
XData : Geo(i).P(j).x : Vector
YData : Geo(i).P(j).y : Vector
Hole : Geo(i).P(j).hole : Binary value (1
= hole, 0= fill)
Geo(i).area contains the area of the i-th shape.

Cite As

Guillaume JACQUENOT (2024). Polygon_Intersection (https://www.mathworks.com/matlabcentral/fileexchange/18173-polygon_intersection), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Elementary Polygons in Help Center and MATLAB Answers
Acknowledgements

Inspired by: Polygon Clipper

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.1.0.0

One bug corrected: degenerated polygons that created crashes are automatically deleted

1.0.0.0