Syntax
[NVL,a,b]=VLdownsample(VL,[gs,ongrid])
Input Parameter
VL : | | Vertex list |
gs : | | grid size; default is 1 percent (100x100x100) = 10000 |
ongrid : | | 'grid','mean','stable','first','last' |
Output Parameter
NVL : | | New vertex list |
a : | | selection index of VL |
b : | | mapping index of VL |
Examples
loadweb IntelRealsense.mat
VLdownsample(VL_D415a); NVL=ans; whos('VL_D415a'), whos ('NVL')
Copyright 2018-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, VLdownsample, is designed to downsample a vertex list (VL) based on a specified grid size and method of downsampling. It is part of the SolidGeometry library.
Input Parameters
- VL: The vertex list to be downsampled.
- gs: Grid size, which defaults to 1% of the bounding box size if not specified. It can be provided as an optional argument.
- ongrid: Method of downsampling, which can be 'grid', 'mean', 'stable', 'first', or 'last'. The default is 'stable'.
Output Results
- NVL: The new, downsampled vertex list.
- a: Selection index of the original vertex list (VL).
- b: Mapping index of the original vertex list (VL).
Algorithm Steps
- Calculate the bounding box size of the vertex list using the function sofBB(VL).
- Set the grid size (gs) to 1% of the bounding box size by default. If a grid size is provided as an argument, use that instead.
- Set the ongrid method to 'stable' by default. If a method is provided as an argument, use that instead.
- Round the vertex list (VL) to the nearest grid size using the function rounddiv(VL, gs).
- Use the unique function to find unique rows in the rounded vertex list, returning the new vertex list (NVL), and indices a and b.
- Check the ongrid method:
- If 'grid' or 'mean' is specified, keep NVL as is.
- If 'mean' is specified, iterate over each unique vertex and replace it with the mean of all original vertices that map to it.
- If neither 'grid' nor 'mean' is specified, set NVL to the original vertices corresponding to the indices in a.
- If no output arguments are specified, plot the original and downsampled vertex lists using SGfigure and VLplot functions.
Algorithm explaination created using ChatGPT on 2025-08-19 01:14. (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