Syntax
pc=centerPL(PL)
Input Parameter
Output Parameter
Examples
try:
centerPL(rand(10,2))
Copyright 2017-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, centerPL
, calculates the mean of the convex hull of a given point list. It is part of the SolidGeometry library and was introduced in version 3.4. The function is designed to handle 2D point lists and can also visualize the results if no output arguments are specified.
Input Parameters
- PL: A point list represented as an n x 2 matrix, where each row corresponds to a point in 2D space.
Output Results
- pc: The center of the point list, calculated as the mean of the convex hull.
- Rm (optional): The maximum norm of the point list relative to the center.
- NL (optional): The normalized vector norms of the point list relative to the center.
Algorithm Steps
- Suppress specific warnings related to duplicate points in Delaunay triangulation.
- Remove any NaN values from the input point list
PL
using the function woNaN
.
- Compute the Delaunay triangulation of the cleaned point list
PLN
.
- Check if the triangulation connectivity list is not empty:
- If not empty, calculate the convex hull of the triangulation.
- Remove the last point from the convex hull list to avoid duplication.
- Calculate the bounding box of the convex hull using
BBofCPL
.
- Compute the center
pc
as the midpoint of the bounding box.
- If the triangulation connectivity list is empty, calculate the mean of the non-NaN points as the center
pc
.
- If the point list has a third dimension, retain the z-coordinate from the first point.
- If additional output arguments are requested or none are specified:
- Calculate the normalized vector norms
NL
of the point list relative to the center.
- Determine the maximum norm
Rm
.
- If no output arguments are specified, visualize the results:
- Plot the original point list.
- Plot the convex hull in blue.
- Mark the center point in magenta.
- Draw a circle with radius
Rm
around the center in red dashed lines.
Algorithm explaination created using ChatGPT on 2025-08-19 00:44. (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