5.0

5.0 | 2 ratings Rate this file 48 downloads (last 30 days) File Size: 19.43 KB File ID: #18173

Polygon_Intersection

by Guillaume JACQUENOT

 

01 Jan 2008 (Updated 19 Jun 2009)

Code covered by BSD License  

This function computes n-times intersection region of shapes collection

Download Now | Watch this File

File Information
Description

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.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Polygon Clipper

MATLAB release MATLAB 7 (R14)
Other requirements The function uses Polygon Clipper, a function posted by Hölz. The MEX DLL of this function for Windows is included (Matlab 7 - Win 32). For other platforms, one needs to compile the source code, which can be found on Matlab Exchange (File Id: 8818)
Zip File Content  
Other Files license.txt,
Matlab_Polygons_intersection/PolygonClip.dll,
Matlab_Polygons_intersection/Polygons_intersection.m,
Matlab_Polygons_intersection/private/Polygons_intersection_Compute_area.m,
Matlab_Polygons_intersection/private/Polygons_intersection_Create_combination.m,
Matlab_Polygons_intersection/private/Polygons_intersection_Polygon_cleanup.m,
Matlab_Polygons_intersection/private/Polygons_intersection_Posttreatment.m,
Matlab_Polygons_intersection/private/Polygons_intersection_Posttreatment_data.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
06 Feb 2009 Ashok Prajapati  
30 Jul 2009 Richard Branch  
Please login to add a comment or rating.
Updates
19 Jun 2009

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

Tag Activity for this File
Tag Applied By Date/Time
specialized Guillaume JACQUENOT 22 Oct 2008 09:41:19
plotting Guillaume JACQUENOT 22 Oct 2008 09:41:19
intersection Guillaume JACQUENOT 22 Oct 2008 09:41:19
overlap Guillaume JACQUENOT 22 Oct 2008 09:41:19
polygon Guillaume JACQUENOT 22 Oct 2008 09:41:19
graphics Guillaume JACQUENOT 22 Oct 2008 09:41:19
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com