Syntax
PL=PLgridhull(PCL)
Input Parameter
Output Parameter
Copyright 2012-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 a convex hull around a given set of 3D points, PCL, by creating a grid-based boundary.
Input Parameters
- PCL: A matrix of 3D points where each row represents a point with x, y, and z coordinates.
Output Results
- PL: A matrix representing the convex hull around the input points.
Algorithm Steps
- Remove duplicate points from PCL using the 'unique' function.
- Initialize parameters:
- minb: Minimal structure width, set to 0.7.
- mins: Minimal slot distance, set to 0.5.
- dx: Grid spacing, set to 1.
- Initialize empty matrices PLMin and PLMax to store boundary points.
- Initialize variables maxy and miny to track maximum and minimum y-values.
- Initialize Pmax and Pmin to store current maximum and minimum points.
- Iterate over each point in PCL:
- Calculate the grid index ndx by dividing the x-coordinate by dx and rounding.
- If ndx is greater than ddx, update the grid point:
- If Pmax and Pmin are valid, append them to PLMax and PLMin.
- Reset ddx, maxy, and miny.
- Update Pmax if the current y-value is greater than maxy.
- Update Pmin if the current y-value is less than miny.
- After the loop, append the last Pmax and Pmin to PLMax and PLMin.
- Adjust the y-values of PLMax and PLMin by adding and subtracting mins, respectively.
- Adjust the x-values of the first and last points in PLMax and PLMin by subtracting and adding mins, respectively.
- Reverse the order of PLMax and concatenate PLMin and PLMax to form PL.
- Plot the original points PCL and the convex hull PL using the pplot function.
Algorithm explaination created using ChatGPT on 2025-08-19 08:27. (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