SGvaryfrom

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Surfaces
Introduced first in SolidGeometry 5.2, Creation date: 2022-04-26, Last change: 2025-09-15

simply adds small values in a determinstic way to the vertices of a solid

Description

The set of fnctns
VLvaryfrom, PLvaryfrom, TLvaryfrom, SGvaryfrom
tries to compensate the weakness of the boolean operations in
combination with the weakness of 64 Bit numeric and the weakness of the
delaunay implementation of matlab.
this fnctn takes a solid and adds small values to the position of the solid to avoid problems with boolean operations!
Helpful in combination with SGunion, SGsubtract and SGsubtractnaddTL

See Also: TLvaryfrom , VLvaryfrom , PLvaryfrom , VLseparate

Example Illustration

 missing image of SGvaryfrom(SG,)

Syntax

SGN=SGvaryfrom(SG,[])

Input Parameter

SG: Solid to be modified

Output Parameter

SGN: Solid with slightly adjusted coordinates

Examples


load ADAM_Aframes.mat;
SGvaryfrom(ADAM_Aframes) % Natural Solid ==> Most probably only a few changes
SGvaryfrom(SGbox) % Ideal geometry ==> Almost all coordinates are changed




Copyright 2022-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, SGvaryfrom, is designed to modify a solid geometry by slightly adjusting its vertex coordinates. This adjustment helps to mitigate issues with boolean operations and numerical precision in MATLAB's 64-bit environment, particularly when using Delaunay triangulation.

Input Parameters

Output

Algorithm Steps

  1. The function begins by calling SGofSG(SG), which likely creates a copy or a new instance of the solid geometry object SG. This is stored in SGN.
  2. The vertex list of SGN is then modified by calling VLvaryfrom(SGN.VL, varargin{:}). This function is responsible for adding small deterministic values to the vertices, effectively "jittering" them to avoid precision issues.
  3. If no output is requested (i.e., nargout == 0), the function will plot the modified solid using SGfigure(-30,30) and SGTplotalpha(SGN). This visualization step is useful for verifying the changes made to the solid.

Example Usage

The function can be used with different types of solid geometries:

This function is part of a set of functions aimed at improving the robustness of geometric operations in MATLAB, particularly when dealing with complex boolean operations.

Algorithm explaination created using ChatGPT on 2025-08-19 06:53. (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