Syntax
PHL=PLconvexhull(PL)
Input Parameter
PL : | | Single Contour Point List |
Output Parameter
PHL : | | Convex hull point list |
Examples
PLconvexhull(PLstar(10))
Copyright 2013-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, PLconvexhull
, computes the convex hull of a given 2D point list, PL
. The convex hull is the smallest convex boundary that encloses all the points in the list.
Input Parameters
- PL: A single contour point list, represented as an
[nx2]
matrix, where each row corresponds to a point in 2D space.
Output Results
- PHL: The convex hull point list, which is an open polyline. The first and last points are different, and points on straight lines are not removed.
Algorithm Steps
- Create a Delaunay triangulation of the input point list
PL
using delaunayTriangulation
.
- Suppress warnings related to empty triangulations using
warning('off', 'MATLAB:triangulation:EmptyTri2DWarnId')
.
- Check if the triangulation connectivity list is not empty:
- If not empty, compute the convex hull indices using
convexHull
and extract the corresponding points from the triangulation.
- Sort the convex hull points using
PLsortC
.
- If the connectivity list is empty, grow the line using
PLgrowline
with a parameter of 0.1
.
- Restore the previous warning state.
- If no output is requested, plot the original point list and the convex hull using
SGfigure
, PLplot
, and set the view to top-down with view(0,90)
.
Example Usage
To compute the convex hull of a star-shaped point list with 10 points, use:
PLconvexhull(PLstar(10))
Algorithm explaination created using ChatGPT on 2025-08-19 07:33. (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