Syntax
CPL=CPLbox([sze,txt])
Input Parameter
sze : | | [x y]; default is 10 |
txt : | | chars for labeling |
Output Parameter
Examples
CPL=CPLbox(10,'A'); SGfigure(0,90); CPSplot(CPL);
CPLbox([30 20],'test')
CPLbox([300 20],'Table');
Copyright 2023-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 algorithm is designed to create a closed polygon list (CPL) of a square with optional text labeling. It is part of the SolidGeometry library and is useful in the box world domain.
Input Parameters
- sze: A vector [x y] representing the dimensions of the square. The default value is 10 if not specified.
- txt: A string of characters used for labeling the square. It is optional and defaults to an empty string.
Output
- CPL: The closed polygon list representing the contour of the square, potentially with text subtracted from it.
Algorithm Steps
- Retrieve the size parameter
sze
using getfuncparams
, defaulting to 10 if not provided.
- Retrieve the text parameter
txt
using getfuncparams
, defaulting to an empty string if not provided.
- Create a square CPL using the
PLsquare
function with the specified size sze
.
- If the
txt
parameter is not empty:
- Generate a CPL for the text using
CPLoftext
.
- Buffer the square CPL by -1 using
CPLbuffer
to create a margin.
- Fit the text CPL within the buffered square CPL using
CPLfitsinCPL
.
- Subtract the text CPL from the square CPL using
CPLsubtract
.
- If no output argument is specified (
nargout==0
):
- Open a new figure with
SGfigure
at position (0,90).
- Plot the CPL using
CPSplot
.
Algorithm explaination created using ChatGPT on 2025-08-18 23:45. (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