Syntax
CPSN=CPSouterboundary(CPS)
Input Parameter
Output Parameter
CPSN : | | CPS or polyshape of outer boundary |
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, CPSouterboundary
, is designed to compute the outer boundary of a given closed polygon list (CPS) or polyshape. It was introduced in SolidGeometry 4.5 and is part of the SG-Library.
Input Parameters
- CPS: This can be either a CPS (Closed Polygon List) or a polyshape object. It represents the input shape from which the outer boundary is to be determined.
Output Results
- CPSN: This is the resulting CPS or polyshape that represents the outer boundary of the input shape.
Algorithm Steps
- Check if the input
CPS
is numeric. If it is, convert it to a polyshape using polyshape(CPS,'simplify',false)
.
- Determine if
CPS
has a field named ps
. If it does, assign ps = CPS.ps
. If not, compute ps
using PSregions(CPS)
.
- Sort the boundaries of
ps
by area in descending order using sortboundaries(ps,'area','descend')
.
- Iterate over each element in
ps
:
- Extract the boundary coordinates
[x,y]
of the current polyshape using boundary(ps(i),1)
.
- Recreate the polyshape with these coordinates and set
'Simplify'
to false
.
- Check if
CPS
has a field named ps
. If it does, assign CPSN = CPS
and update CPSN.ps = ps
. If not, set CPSN = ps
.
- If no output argument is specified (
nargout == 0
), plot the result:
- Create a figure with ID 999.
- Set the title using
SGtitle
.
- Clear the current axes and hold on for further plotting.
- Set the axis to equal and tight, and enable the grid.
- Plot the polyshape
ps
.
Algorithm explaination created using ChatGPT on 2025-08-18 23:20. (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