Syntax
CPL=CPLofBB(BB,[d])
Input Parameter
BB : | | Bounding Box or CPL |
d : | | distance around the bounding box; default is 1 |
Output Parameter
CPL : | | Closed Polygon Liste |
Examples
CPLofBB(CPLslicer(SGsample(7),9))
Copyright 2015-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, CPLofBB
, generates a Closed Polygon List (CPL) around a 2D Bounding Box (BB). It is part of the SolidGeometry library and was developed by Tim Lueth.
Input Parameters
- BB: This is the Bounding Box or a Closed Polygon List (CPL) that the function will process.
- d: This is the distance around the bounding box. If not specified, it defaults to 1.
Output
- CPL: The function returns a Closed Polygon List that represents a bounding contour around the input BB.
Algorithm Steps
- Initialize the distance
d
to 1. If a second argument is provided and is not empty, set d
to this value.
- Check if
BB
is a cell array:
- If true, create a cell array
CPL
of the same size as BB
.
- Iterate over each element in
BB
, recursively calling CPLofBB
for each element and storing the result in CPL
.
- If
BB
is not a cell array:
- Check if
BB
has two columns:
- If true, treat
BB
as a polygon list PL
and compute its bounding box using BBofVL
.
- Set a flag
cpl
to true.
- Construct the CPL by expanding the bounding box by
d
in all directions.
- Close the polygon by appending the first point to the end of the list.
- If no output is requested:
- Open a new figure with grid and axis enabled.
- Plot the CPL in red with a line width of 4.
- If
cpl
is true, plot the original polygon list PL
in blue with markers.
Algorithm explaination created using ChatGPT on 2025-08-19 01:24. (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