Syntax
C=SGCaddSG(C,SG)
Input Parameter
C : | | Solid geometry container |
SG : | | Solid Geometry (VL,FL) |
Output Parameter
C : | | Solid geometry container |
Copyright 2013-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, SGCaddSG
, is designed to add a solid geometry to a container. The function is part of the SG-Library and was created by Tim Lueth on August 3, 2013. The primary purpose of this function is to move the solid geometry into the first octant (where all coordinates are greater than or equal to zero), which simplifies the later compilation into a joint solid geometry.
Input Parameters
- C: The solid geometry container. It is a structure that holds multiple solid geometries.
- SG: The solid geometry to be added. It is provided as a variable-length argument list (
varargin
), allowing multiple solid geometries to be added in one function call.
Output Results
- C: The updated solid geometry container with the new solid geometries added.
Algorithm Steps
- Check if the container
C
is empty. If it is, initialize it with C.n = 0
and an empty solid geometry table C.ST = []
.
- Determine the number of solid geometries to add,
m = nargin - 1
.
- Iterate over each solid geometry provided in
varargin
:
- For each solid geometry
SG
, check if it is not empty.
- Increment the count of solid geometries in the container:
C.n = C.n + 1
.
- Add the solid geometry to the container:
C.SG{C.n} = SG
.
- Calculate the bounding box of the solid geometry using
BB = BBofVL(SG.VL)
.
- Translate the solid geometry to the first octant using
C.SG{C.n}.VL = VLtransP(SG.VL, -[BB(1); BB(3); BB(5)])
.
- Update the solid geometry table with the new geometry's index and dimensions:
C.ST = [C.ST; [C.n BB(2)-BB(1) BB(4)-BB(3) BB(6)-BB(5)]]
.
- If no output argument is specified (
nargout == 0
), plot the solid geometries using VLFLfigure
, set the view to view(-30,30)
, and call SGplot(C)
to display the container.
Algorithm explaination created using ChatGPT on 2025-08-19 00:24. (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