BBofCPL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Geometric Queries
Introduced first in SolidGeometry 3.8, Creation date: 2017-04-23, Last change: 2025-09-14

returns the bounding box of a CPL



See Also: CPLofBB , BBofVL , BBofSG , BBofCPS , BBofPS , BBofSGcutT

Example Illustration

 missing image of BBofCPL(CPL,zmax,d)

Syntax

bb=BBofCPL(CPL,[zmax,d])

Input Parameter

CPL: Closed Polygon Line
zmax:
d:

Output Parameter

bb: bb [xmin xmax ymin ymax]




Copyright 2017-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, BBofCPL, calculates the bounding box of a Closed Polygon Line (CPL). It is part of the SolidGeometry library and was introduced in version 3.8. The function can handle both individual CPLs and cell arrays of CPLs.

Input Parameters

Output Results

Algorithm Steps

  1. Initialize zmax and d to 0. If additional arguments are provided, update these values accordingly.
  2. Check if CPL is a cell array. If so, iterate over each element, recursively calling BBofCPL for each CPL in the cell array.
  3. If CPL is a polyshape, convert it to its vertices.
  4. Call BBofVL with the vertices and optional parameters to compute the bounding box.
  5. If the bounding box is not empty, extract the first four elements to get [xmin xmax ymin ymax].
  6. If a second output is requested, calculate the center point of the bounding box using CPLofBB and compute the mean of the vertices.
  7. If no output is requested, plot the CPL and its bounding box using CPLplot.
Algorithm explaination created using ChatGPT on 2025-08-19 00:42. (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