Syntax
SG=SGboxsphere([S,n])
Input Parameter
S : | | Diameter [x y z] |
n : | | number of edges in x y |
Output Parameter
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
- S: A vector representing the dimensions of the box in the format [x y z]. Default is [30 20 10].
- n: The number of edges in the x and y directions. Default is 4.
- ns: An optional parameter, default is an empty string.
Output
- SG: The resulting solid geometry object.
Algorithm Steps
- Retrieve the parameters
S
, n
, and ns
using the getfuncparams
function, which assigns default values if not provided.
- Create a box geometry
SGB
using the SGbox
function with parameters S
and n
.
- Calculate the bounding box of
SGB
using BBofSG
and determine the sphere's size using sofBB
.
- Determine a factor
f
using the function dofn
with parameter n
.
- Create a sphere geometry
SGC
using the SGsphere
function with calculated dimensions based on the bounding box and factor f
.
- Perform a boolean subtraction of the sphere from the box using
SGbool
to create the final geometry SG
.
- 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