Syntax
PSR=PSregions(PS)
Input Parameter
Output Parameter
Examples
SGfigure; CPLplotasPS(CPLsample(14)); ps=PSofgca; ps=regions(ps) % array of polyshape
ps, ps=regions(ps); % fails
ps=PSregions(ps) % works
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, PSregions
, is designed to handle polyshape objects in MATLAB, specifically extending the concept of regions for polyshape arrays and cells. Below is a detailed explanation of the algorithm and its parameters.
Input Parameters
- PS: This is the input parameter, which can be a numeric array, a polyshape object, or a cell array of polyshape objects.
Output Results
- PSR: This is the output, which is an array or cell array of polyshape regions.
Algorithm Steps
- Check if
ps
is numeric. If true, convert it to a polyshape object without simplification.
- Check if
ps
is a polyshape object:
- If
ps
is a scalar polyshape, use the regions
function to get its regions and assign to PSR
.
- If
ps
is an array of polyshapes, initialize a cell array PSR
to store regions for each polyshape.
- Iterate over each polyshape in the array, compute its regions, and store them in
PSR
.
- Flatten the cell array of regions into a single array of polyshapes
psn
.
- Assign the flattened array to
PSR
.
- Check if
ps
is a cell array:
- Initialize a cell array
PSR
to store regions for each cell element.
- Iterate over each element in the cell array and recursively call
PSregions
to compute regions.
- If no output argument is specified, plot the regions using
SGfigure
and CPSplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 07:24. (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