SGcell2SG

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SG/Solids
Introduced first in SolidGeometry 3.8, Creation date: 2017-05-15, Last change: 2025-09-14

converts all cells into one solid geometry

Description

Old Name was SGunitecells
Quick and Dirty - Does not support frames yet
Better name would be SGcell2SG or SGC2SG

See Also: , SGcat2 , VLFLofSG , SGofVLFL

Example Illustration

 missing image of SGcell2SG(SGc)

Syntax

SG=SGcell2SG(SGc)

Input Parameter

SGc: {SGA; SGB; SGC;}

Output Parameter

SG: SG.VL, SG.FL

Examples


SGcell2SG(SGsample(20))
SGcell2SG(SGsample(23))




Copyright 2017-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, SGcell2SG, is designed to convert a collection of solid geometries (SG) stored in a cell array into a single solid geometry structure. It is part of the SG-Library and was developed by Tim Lueth.

Input Parameters

Output Results

Algorithm Steps

  1. Check if the input SGc is a cell array using iscell(SGc).
  2. If SGc is a cell array:
    • Set cell to true.
    • Call the function VLFLofSG(SGc) to obtain the vertices list (VL) and face list (FL) of the combined solid geometry.
    • Assign these lists to SG.VL and SG.FL.
  3. If SGc is not a cell array, assign SGc directly to SG.
  4. Call SGstripfields(SG) to remove any unnecessary fields from the SG structure.
  5. If no output is requested (nargout==0):
    • Open a new figure using SGfigure and set the view angle to view(-30,30).
    • If SGc is a cell array, iterate over each element in SGc and plot it using SGplot with a color determined by colofn(i,'rgbmcywk').
    • If SGc is not a cell array, plot SG using SGplot.
Algorithm explaination created using ChatGPT on 2025-08-18 23:38. (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