Syntax
SG=SGreadSTLreducedFL([PAR,"nFL"])
Input Parameter
PAR : | | same parameter set as SGreadSTL |
"nFL" : | | optional string parameter; default is 60000 |
Output Parameter
Copyright 2023-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, SGreadSTLreducedFL
, is designed to read an STL file and reduce the number of faces in the geometry. It is particularly useful for processing large CAD files, natural landscapes, or medical data.
Input Parameters
- PAR: This parameter set is the same as used in the
SGreadSTL
function. It contains the necessary parameters to read the STL file.
- "nFL": An optional string parameter that specifies the number of faces to reduce to. The default value is 60000.
Output Results
- SG: The output is a Solid Geometry object that represents the reduced geometry of the STL file.
Algorithm Steps
- The function begins by extracting the
nFL
parameter from the input arguments using getfuncparamStr
. If not provided, it defaults to 60000.
- The STL file is read using the
SGreadSTL
function with the provided parameters.
- The size of the bounding box of the solid geometry is calculated using
sofBB
.
- The point cloud distance matrix is computed using
VLpointclouddistance
on the vertex list SG.VL
.
- The minimum distance
m
is found from the distance matrix.
- The ratio
k
is calculated as the size of the bounding box divided by the minimum distance.
- If
k
is greater than 500, the vertex list is scaled by a factor of 256 (this part is commented out in the code).
- The function
SGreduceVLFL
is called to reduce the number of faces in the solid geometry to numFL
.
- If the field
alpha
exists in the solid geometry and its value is not between 0 and 1, it is removed using rmfield
.
- If no output is requested, the function plots the solid geometry using
SGfigure
and SGplotalpha
with a white color.
Algorithm explaination created using ChatGPT on 2025-08-19 00:41. (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