Syntax
CPL=CPLofSGcutTBB([SG,zz])
Input Parameter
SG : | | Solid Geometry |
zz : | | [zmin zmax]; default is [-inf +inf]); |
Output Parameter
CPL : | | CPLofBB of the considered Solid shape between zmin and zmax |
Examples
CPLofSGcutTBB(SGsample(17),[0 15])
CPLofSGcutTBB(SGsample(17),[10 15])
CPLofSGcutTBB(SGsample(17),[15 inf])
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, CPLofSGcutTBB
, is designed to return a Closed Polygon List (CPL) based on the bounding box of a solid geometry (SG) within a specified z-range. Below is a detailed explanation of the algorithm and its parameters.
Input Parameters
- SG: This is the Solid Geometry input, representing the 3D shape to be processed.
- zz: A two-element vector [zmin, zmax] specifying the range along the z-axis. The default value is [-inf, +inf], meaning the entire z-range of the solid is considered.
Algorithm Steps
- Retrieve Parameters: The function begins by extracting the solid geometry (SG) and the z-range (zz) from the input arguments using
getfuncparams
.
- Bounding Box Calculation: It calculates the bounding box of the solid geometry using
BBofSG
, which returns the extents of the solid in all three dimensions.
- Adjust z-range: The z-range is adjusted to ensure it lies within the bounding box of the solid. If
zz(1)
is less than the minimum z-value of the bounding box, it is set to one unit below the minimum. Similarly, if zz(2)
is greater than the maximum z-value, it is set to one unit above the maximum.
- Cut Solid Geometry: The function
SGcut
is used to slice the solid geometry into two parts, A and B, based on the adjusted z-range.
- Calculate CPL: The Closed Polygon List (CPL) is generated from the bounding box of the second part (B) using
CPLofBB
.
- Visualization (Optional): If no output is requested, the function visualizes the results. It uses
SGfigure
to set up the figure, CPLplot
to plot the CPL, and SGplotalpha
to plot the two parts of the solid geometry with different transparency levels.
Output
- CPL: The function returns a Closed Polygon List representing the bounding box of the solid geometry within the specified z-range.
This function is particularly useful for designing covers for solids by providing a 2D representation of the 3D shape's bounding box within a specified z-range.
Algorithm explaination created using ChatGPT on 2025-08-19 00:40. (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