CPLofSGcutTBB

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.2, Creation date: 2022-04-09, Last change: 2025-09-15

returns a CPL based on the Bounding Box of a solid

Description

Used in SGdesignMotorN40
Helpful to design covers for Solids

See Also: CPLofSGcutT , CPLofSGslice

Example Illustration

 missing image of CPLofSGcutTBB(SG,zz)

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

Algorithm Steps

  1. Retrieve Parameters: The function begins by extracting the solid geometry (SG) and the z-range (zz) from the input arguments using getfuncparams.
  2. 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.
  3. 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.
  4. 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.
  5. Calculate CPL: The Closed Polygon List (CPL) is generated from the bounding box of the second part (B) using CPLofBB.
  6. 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

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