SGboxsphere

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Samples
Introduced first in SolidGeometry 4.9, Creation date: 2020-01-09, Last change: 2025-09-14

Solid of a box with an containing sphere, mainly used for testing



See Also: SGbox , SGcone , SGsphere , SGarrow , SGspherelink , SGtrapezoid

Example Illustration

 missing image of SGboxsphere(S,n)

Syntax

SG=SGboxsphere([S,n])

Input Parameter

S: Diameter [x y z]
n: number of edges in x y

Output Parameter

SG: Solid Geometry

Examples


SGboxsphere([30,20,10],6)




Copyright 2020-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, SGboxsphere, creates a solid geometry of a box with an inscribed sphere. It is primarily used for testing purposes. Below is a detailed explanation of the algorithm and its parameters.

Input Parameters

Output

Algorithm Steps

  1. Retrieve the parameters S, n, and ns using the getfuncparams function, which assigns default values if not provided.
  2. Create a box geometry SGB using the SGbox function with parameters S and n.
  3. Calculate the bounding box of SGB using BBofSG and determine the sphere's size using sofBB.
  4. Determine a factor f using the function dofn with parameter n.
  5. Create a sphere geometry SGC using the SGsphere function with calculated dimensions based on the bounding box and factor f.
  6. Perform a boolean subtraction of the sphere from the box using SGbool to create the final geometry SG.
  7. If no output is requested, visualize the result using SGfigure and SGplotalpha with specified view angles and transparency.
Algorithm explaination created using ChatGPT on 2025-08-18 23:45. (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