Syntax
CPL=CPLremoveoverlap(CPL)
Input Parameter
Output Parameter
CPL : | | CPL without overlapping areas |
Examples
CPLremoveoverlap([CPLsample(25)]);
CPLoutercontour(CPLsample(25))
Copyright 2019-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This algorithm is designed to remove overlapping areas from a Closed Polygon List (CPL). It simplifies each contour of the CPL using MATLAB's polyshape functionality.
Input Parameters
- CPL: The original Closed Polygon List that may contain overlapping areas.
Output Results
- CPL: The Closed Polygon List with overlapping areas removed.
Algorithm Steps
- Determine the number of separate contours in the CPL using the
separateNaN
function, which identifies contours separated by NaN values.
- Store the original CPL in
CPLorg
for comparison or plotting purposes.
- Suppress warnings related to polyshape simplification using
warning('off','MATLAB:polyshape:repairedBySimplify')
.
- Iterate over each contour in the CPL:
- Extract the i-th contour using
separateNaN(CPL, i)
.
- Create a polyshape object from the contour with simplification enabled:
Ci=polyshape(Ci,'Simplify',true)
.
- Remove any holes in the polyshape using
rmholes(Ci)
.
- Extract the vertices of the simplified polyshape and update the CPL using
replaceNaN(CPL, i, Ci)
.
- Restore the original warning state using
warning(wstat)
.
- If no output argument is specified, plot the original and modified CPLs for visual comparison:
- Use
SGfigure
to create a new figure.
- Plot the original CPL with
CVLplot(CPLorg, '-')
.
- Annotate the plot with
textCVL(CPL)
.
- Plot the modified CPL with increased line width using
CVLplot(CPL, '-', 3)
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:27. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21