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
- CPL: A Closed Polygon Line, which can be a matrix of vertices or a
polyshape
object.
- zmax: An optional parameter, defaulting to 0, which can be used for additional calculations.
- d: Another optional parameter, defaulting to 0, for further calculations.
Output Results
- bb: The bounding box represented as [xmin xmax ymin ymax].
- cp: The center point of the bounding box, calculated if requested.
Algorithm Steps
- Initialize
zmax
and d
to 0. If additional arguments are provided, update these values accordingly.
- Check if
CPL
is a cell array. If so, iterate over each element, recursively calling BBofCPL
for each CPL in the cell array.
- If
CPL
is a polyshape
, convert it to its vertices.
- Call
BBofVL
with the vertices and optional parameters to compute the bounding box.
- If the bounding box is not empty, extract the first four elements to get [xmin xmax ymin ymax].
- If a second output is requested, calculate the center point of the bounding box using
CPLofBB
and compute the mean of the vertices.
- 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