PSofgca
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.4, Creation date: 2018-12-29, Last change: 2025-09-14
return the polyshapes of the polygons of current axis
Description
This function is required since currently the concept of polygon arrays and polyshape arrays seems to have less methods than the cell concept
See Also: VLFLofgca
, VLofgca
, SGofgca
Example Illustration
Syntax
[ps,CPL]=PSofgca([nocells])
Input Parameter
nocells: | | false = separated as cells; true = only on polyspahe |
Output Parameter
ps: | | polyshape of current axis |
CPL: | | closed polygon line of ps |
Examples
SGfigure; CPLplotasPS(CPLsample(34));
PSofgca
Copyright 2018-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, PSofgca, is designed to return the polyshapes of the polygons present in the current axis of a MATLAB figure. It is part of the SolidGeometry library and was introduced to address limitations in handling polygon arrays and polyshape arrays.
Input Parameters
- nocells: A boolean parameter. If set to
false, the function returns the polygons as separate cells. If true, it returns a single polyshape.
Output Results
- ps: The polyshape of the current axis.
- CPL: The closed polygon line of the polyshape
ps.
Algorithm Steps
- Retrieve the function parameters using
getfuncparams, with a default value of false for nocells.
- Find all polygon objects in the current axis using
findobj with the type 'polygon'.
- If no polygons are found, return empty arrays for
ps and CPL.
- Convert the shapes of the found polygons into a cell array
ps.
- Determine the number of polygons
n.
- If
nocells is false:
- Initialize a variable
nv to count the total number of vertices.
- Iterate over each polygon to accumulate the vertices in
CPL.
- Create a polyshape from
CPL without simplifying it.
- If
nocells is true, convert the elements to an array using elem2array.
- If no output arguments are specified, plot the polyshapes in a new figure with equal and tight axis settings.
Algorithm explaination created using ChatGPT on 2025-08-19 07:34. (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