VLGrahamPVL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 1.0, Creation date: 2013-01-06, Last change: 2025-09-14

returns the convex hull for a given set of vertices that are in a plane

Description

Checks first, whether all vertices are in the same plane
replaces VLGraham of April 2012

See Also: VLGraham

Example Illustration

 missing image of VLGrahamPVL(PCVL)

Syntax

VL=VLGrahamPVL(PCVL)

Input Parameter

PCVL: planar contour vertex list

Output Parameter

VL: vertex list of the convex hull




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 algorithm computes the convex hull for a given set of vertices that are in a plane. It is part of the SG-Library and was developed by Tim Lueth.

Input Parameters

Output Results

Algorithm Steps

  1. The input vertex list PCVL is first processed to ensure uniqueness and precision. The vertices are rounded to a precision of 1e-5 and duplicates are removed.
  2. The algorithm checks if there are at least three vertices. If not, it throws an error because a convex hull cannot be formed with fewer than three points.
  3. If exactly three vertices are present, they form a triangle, which is the convex hull, and the function returns these vertices.
  4. The transformation matrix To is calculated using the function TofPCVL, which is used to transform the vertices.
  5. The vertices are transformed using VLtransT and the inverse of To to ensure they lie in a plane.
  6. The maximum absolute value of the z-coordinates of the transformed vertices is checked. If it exceeds 0.001, an error is thrown, indicating the vertices are not coplanar.
  7. A Delaunay triangulation is performed on the x and y coordinates of the transformed vertices using DelaunayTri.
  8. The convex hull is computed from the Delaunay triangulation using convexHull, and the corresponding vertices are extracted.
  9. The convex hull vertices are transformed back to the original coordinate system and rounded to a precision of 1e-5.
  10. If no output argument is specified, the convex hull is plotted using CVLplot.
Algorithm explaination created using ChatGPT on 2025-08-19 00:34. (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