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

 missing image of PSofgca(nocells)

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

Output Results

Algorithm Steps

  1. Retrieve the function parameters using getfuncparams, with a default value of false for nocells.
  2. Find all polygon objects in the current axis using findobj with the type 'polygon'.
  3. If no polygons are found, return empty arrays for ps and CPL.
  4. Convert the shapes of the found polygons into a cell array ps.
  5. Determine the number of polygons n.
  6. 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.
  7. If nocells is true, convert the elements to an array using elem2array.
  8. 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