CPSofpolygon

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.5, Creation date: 2019-02-15, Last change: 2025-09-14

returns a struct called Colored PolyShape (CPS) similar to a polygon array object

Description

Matlab introduced new classes polygon as graphics object and polyshape as geometric object.
Nevertheless, SG-Lib usees either CPL, polyshapes or colored polyshapes that consist
ps polyshape array
fc facecolor array
fa facealpha array
ec edgecolor array
similar to poygon

See Also: CPLplotasPS , CPSofgca

Example Illustration

 missing image of CPSofpolygon(h)

Syntax

CPS=CPSofpolygon(h)

Input Parameter

h: handle to polygon

Output Parameter

CPS: struct with ps, fc, fa, ec

Examples


SGfigure; CPLplotasPS(PLcircle(10),'','FaceColor','g','FaceAlpha',1);
shg; CPSofgca




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, CPSofpolygon, is designed to return a structured data type called Colored PolyShape (CPS) from a given polygon handle. The function is part of the SG-Library and was introduced in SolidGeometry 4.5 by Tim Lueth.

Input Parameters

Output

Function Workflow

The function CPSofpolygon calls another function CPSofgca with the polygon handle h as its argument. The CPSofgca function is responsible for extracting the necessary properties from the polygon and organizing them into the CPS struct. The specific details of how CPSofgca operates are not provided in the given code, but it is assumed to handle the extraction and structuring of the polygon's graphical properties.

Example Usage

An example of how to use this function is provided in the comments:

SGfigure; CPLplotasPS(PLcircle(10),'','FaceColor','g','FaceAlpha',1);
shg; CPSofgca

This example demonstrates creating a figure with a circle polygon, setting its face color to green and its face alpha to 1 (fully opaque), and then calling CPSofgca to obtain the CPS struct.

Algorithm explaination created using ChatGPT on 2025-08-18 23:31. (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