Syntax
VLN=SGlim(VL,[dim,lim,rat])
Input Parameter
VL : | | Vertex list |
dim : | | dimension 1 2 3 ord 'x' 'y' 'z' |
lim : | | limit max or [min max] |
rat : | | compression ratio default is 1000; |
Output Parameter
Examples
SGgearwormDIN(1,'','',CPLmotorshaft); A=ans; view(-30,30);
SGlim(A,'y',[-18 18])
SGlim(A,'x',[-5 5])
SGlim(A,'y',[-18 18],.1)
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, SGlim
, is designed to compress vertex coordinates outside a specified limit without altering the vertex list (VL) or face list (FL). It is part of the SG-Library and was introduced in SolidGeometry 4.4.
Input Parameters
- VL: Vertex list, a matrix where each row represents a vertex in 3D space.
- dim: Dimension to apply the limit, can be 1, 2, 3 or 'x', 'y', 'z'. Default is 'z'.
- lim: Limit for compression, can be a single value (max) or a two-element vector [min, max]. Default is [0, inf].
- rat: Compression ratio, default is 1000. A value < 1 results in elongation.
Output
- VLN: The modified vertex list after applying the compression.
Algorithm Steps
- Retrieve input parameters using
getfuncparams
function, setting defaults if not provided.
- If
lim
has less than two elements, set it to [-inf, lim].
- Check if
VL
is a solid geometry object using isSG
. If true, extract the vertex list from the object.
- Convert
dim
from character to numeric index if necessary.
- Initialize
VLN
as a copy of VL
.
- For vertices with coordinates greater than
lim(2)
in the specified dimension, compress them using the formula: lim(2) + (coordinate - lim(2)) / rat
.
- For vertices with coordinates less than
lim(1)
, compress them using the formula: lim(1) + (coordinate - lim(1)) / rat
.
- If
VL
was a solid geometry object, update its vertex list with VLN
.
- If no output is requested, plot the original and modified vertex lists using
SGplot
or VLplot
functions.
Algorithm explaination created using ChatGPT on 2025-08-19 08:26. (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