CPLsimplify
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.8, Creation date: 2020-01-04, Last change: 2025-09-14
simplifies a CPL using polyshape simplyfy true
Description
Since 2019 there is a difference by keeping colinear points, which is not consistent to me, therefor this punction was programmed to make SGLib independt (or easier to maintain) from Mathworks
See Also: CPLofpolyshape
, CPLrepair
, CPLremstraightAmin
Example Illustration
Syntax
CPLN=CPLsimplify(CPL)
Input Parameter
Output Parameter
CPLN: | | 'repaired' or 'simplified' CPL with keep colinear points |
Examples
CPLsimplify(PLsample(14))
Copyright 2020-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 function, CPLsimplify, is designed to simplify a Closed Polygon List (CPL) using MATLAB's polyshape function. It is part of the SolidGeometry library and was created to maintain independence from MathWorks' updates.
Input Parameters
- CPL: A matrix representing a Closed Polygon List, where each row corresponds to a vertex of the polygon.
Output
- CPLN: The 'repaired' or 'simplified' version of the input CPL, with collinear points optionally kept.
Algorithm Steps
- Check if the input
CPL is empty. If it is, return an empty array CPLN.
- Suppress warnings related to the
polyshape simplification process using warning('off',...).
- Create a
polyshape object from the CPL coordinates with the 'simplify' option set to true. This step simplifies the polygon by removing unnecessary vertices.
- Re-enable the previously suppressed warnings using
warning('on',...).
- Convert the simplified
polyshape back to a CPL format using the CPLofpolyshape function.
- If no output argument is specified, plot the simplified polygon using
SGfigure and plot functions, and annotate it with CVLplot and textCVL.
Additional Notes
The function was introduced in SolidGeometry version 4.8 and is part of a suite of tools for handling polygonal data. It is designed to handle collinear points in a way that is consistent with the library's requirements.
Algorithm explaination created using ChatGPT on 2025-08-19 01:26. (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