Syntax
[sx,sy,sz,mx,my,mz]=sizeVL(VL)
Input Parameter
VL : | | Vertex list of the object |
Output Parameter
sx : | | size in x OR [xmin xmax ymin ymax zmin zmax] |
sy : | | size in y |
sz : | | size in z |
mx : | | minimal value in x |
my : | | minimal value in y |
mz : | | minimal value in z |
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 function, sizeVL
, calculates the size of the bounding box of a vertex list (VL) in a 3D coordinate system. It is part of the SolidGeometry library and was introduced by Tim Lueth.
Input Parameters
- VL: A vertex list of the object. It can be a matrix or a structure containing the vertex list.
Output Results
- sx: Size in the x-direction or a vector containing the bounding box limits [xmin, xmax, ymin, ymax, zmin, zmax] if only one output is specified.
- sy: Size in the y-direction.
- sz: Size in the z-direction.
- mx: Minimal value in the x-direction.
- my: Minimal value in the y-direction.
- mz: Minimal value in the z-direction.
Algorithm Steps
- Check if
VL
is a structure. If so, extract the vertex list from the structure using VL=VL.VL
.
- Check if the vertex list has only two columns. If true, add a third column of zeros to represent the z-coordinate using
VL=VLaddz(VL)
.
- Calculate the minimum values for each coordinate:
mx = min(VL(:,1))
: Minimum x-coordinate.
my = min(VL(:,2))
: Minimum y-coordinate.
mz = min(VL(:,3))
: Minimum z-coordinate.
- Calculate the size of the bounding box in each direction:
sx = max(VL(:,1)) - mx
: Size in the x-direction.
sy = max(VL(:,2)) - my
: Size in the y-direction.
sz = max(VL(:,3)) - mz
: Size in the z-direction.
- If only one output argument is specified, return a vector containing the bounding box limits:
sx = [mx, mx+sx, my, my+sy, mz, mz+sz]
.
Algorithm explaination created using ChatGPT on 2025-08-19 07:02. (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