Syntax
h=textCPS(CPS,[c,s,nt,lb])
Input Parameter
CPS : | | CPS |
c : | | color |
s : | | size |
nt : | | selector |
lb : | | text |
Output Parameter
Examples
SGfigure; CPSplot(CPLsample(29)); CPS=CPSofgca; textCPS(CPS)
Copyright 2019-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, textCPS
, is designed to write text descriptors to a given CPS (Closed Polygon Shape) object. It is part of the SolidGeometry library and was introduced in version 4.5. The function takes several input parameters and returns a handle to the text object created.
Input Parameters
- CPS: The main input, which can be a numeric array or a structure with a field 'ps'. If numeric, it is converted to a polyshape object.
- c: Color of the text. Default is 'k' (black).
- s: Size of the text. Default is 16.
- nt: Selector for the text. Default is an array from 1 to the number of regions in CPS.
- lb: The text label to be used. Default is 'C'.
Algorithm Steps
- Check if
CPS
is numeric. If so, convert it to a polyshape object without simplifying it.
- If
CPS
is a structure with a field 'ps', extract CPS.ps
.
- If
CPS
contains only one element, convert it to its regions.
- Determine the number of regions,
nc
, in CPS
.
- Retrieve optional parameters
c
, s
, nt
, and lb
using getfuncparams
with default values.
- Initialize a matrix
PL
to store the first vertex of each region's outer boundary.
- Loop through each region in
CPS
:
- Get the outer boundary of the current region using
CPSouterboundary
.
- Store the first vertex of the outer boundary in
PL
.
- Call
textVL
with PL
, c
, s
, nt
, and lb
to create the text descriptors.
- Return the handle
h
to the created text object.
Algorithm explaination created using ChatGPT on 2025-08-19 00:18. (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