CPLconvexhull

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.3, Creation date: 2018-11-03, Last change: 2025-09-14

returns the convex hull for a CPL



See Also: delaunayofCPL , CPLconvexhulldelaunay

Example Illustration

 missing image of CPLconvexhull(CPL)

Syntax

CPLN=CPLconvexhull(CPL)

Input Parameter

CPL: CPL

Output Parameter

CPLN: convex hull

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

Output Results

Algorithm Steps

  1. Check if the input CPL is empty. If it is, return an empty result.
  2. Retrieve any additional function parameters using getfuncparams. This is used to determine if a buffer should be applied to the convex hull.
  3. Suppress specific warnings related to polygon simplification using warning('off','MATLAB:polyshape:repairedBySimplify').
  4. Create a polyshape object from the input CPL with simplification enabled.
  5. Compute the convex hull of the polyshape object using convhull.
  6. Restore the previous warning state.
  7. Extract the vertices of the convex hull and assign them to CPLN.
  8. If a buffer value is specified, apply the buffer to the convex hull using CPLbuffer.
  9. If no output argument is specified, plot the original CPL and its convex hull using SGfigure and CPLplot.

Example Usage

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