Syntax
[c,ci,d,n]=centerVL(VL)
Input Parameter
Output Parameter
c : | | center |
ci : | | index list of nearest vertices |
d : | | distance vector to center (nx3) |
n : | | distance norm to center (nx1) |
Examples
Show the center of a random list
centerVL (rand(100,3))
centerVL(VLtransR(VLaddz(PLcircle(2)),rot(0,pi/3,pi/3)))
Copyright 2016-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, centerVL
, is designed to find the center and distance indices of a vertex list. It is an auxiliary function to find the nearest points to a cloud center.
Input Parameters
- VL: A vertex list represented as an nx3 matrix, where n is the number of vertices, and each vertex has three coordinates (x, y, z).
Output Results
- c: The calculated center of the vertex list.
- ci: An index list of the nearest vertices to the center.
- d: A distance vector from each vertex to the center, represented as an nx3 matrix.
- n: A distance norm to the center, represented as an nx1 vector.
Algorithm Steps
- Suppress specific warnings related to duplicate points in Delaunay triangulation.
- Create a Delaunay triangulation object
TR3
from the vertex list VL
.
- Attempt to compute the convex hull of the triangulation. If it fails, use all vertices.
- Calculate the center
c
as the mean of the vertices forming the convex hull.
- Compute the distance vector
d
and the distance norm n
from each vertex to the center using the function VLnorm
.
- Identify the indices
ci
of the vertices closest to the center by finding the minimum distance.
- If no output arguments are specified, plot the vertex list and the center using
SGfigure
and VLplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:16. (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