Syntax
CPLN=CPLconvexhull(CPL)
Input Parameter
Output Parameter
Examples
CPLconvexhull(PLstar(10))
CPLconvexhull(CPLsample(14))
delaunayofCPL(CPLsample(14))
Copyright 2018-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, CPLconvexhull
, computes the convex hull of a given closed polygon list (CPL). The algorithm is part of the SolidGeometry library and was introduced in version 4.3.
Input Parameters
- CPL: The closed polygon list for which the convex hull is to be calculated.
- varargin: Optional parameters that can be passed to the function. In this context, it is used to determine a buffer value.
Output Results
- CPLN: The vertices of the convex hull of the input CPL.
Algorithm Steps
- Check if the input
CPL
is empty. If it is, return an empty result.
- Retrieve any additional function parameters using
getfuncparams
. This is used to determine if a buffer should be applied to the convex hull.
- Suppress specific warnings related to polygon simplification using
warning('off','MATLAB:polyshape:repairedBySimplify')
.
- Create a
polyshape
object from the input CPL
with simplification enabled.
- Compute the convex hull of the
polyshape
object using convhull
.
- Restore the previous warning state.
- Extract the vertices of the convex hull and assign them to
CPLN
.
- If a buffer value is specified, apply the buffer to the convex hull using
CPLbuffer
.
- If no output argument is specified, plot the original CPL and its convex hull using
SGfigure
and CPLplot
.
Example Usage
CPLconvexhull(PLstar(10))
: Computes the convex hull of a star-shaped polygon with 10 points.
CPLconvexhull(CPLsample(14))
: Computes the convex hull of a sample polygon with 14 points.
delaunayofCPL(CPLsample(14))
: Related function that computes the Delaunay triangulation of a sample polygon.
Algorithm explaination created using ChatGPT on 2025-08-18 23:58. (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