Syntax
[FE,FEi]=CPLfeatureedge(CPL,[al])
Input Parameter
CPL : | | Closed Polygon list |
al : | | alpha; default is pi/4 (45 degree) |
Output Parameter
FE : | | List of Points |
FEi : | | Index of FE within CPL |
Examples
CPLfeatureedge(CPLsample(1)) % random shape
CPLfeatureedge(PLcircle(1)) % 16 edges, limit is 16
CPLfeatureedge(PLcircle(2)) % 32 edges but limit to small
Copyright 2021-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 identifies feature edges in a closed polygon list (CPL) by selecting corners with an angle larger than a specified limit.
Input Parameters
- CPL: A closed polygon list representing the shape.
- al: The angle threshold (alpha) for selecting feature edges. Default is pi/8 (22.5 degrees).
Output Results
- FE: A list of points that are considered feature edges.
- FEi: Indices of the feature edges within the CPL.
Algorithm Steps
- Set the angle threshold
al
using getfuncparams
, defaulting to pi/8 if not provided.
- Determine the number of separate polygons in
CPL
using separateNaN
.
- Initialize an empty array
FE
to store feature edge points.
- Initialize a counter
k
to track the number of feature edges found.
- Iterate over each separate polygon in
CPL
:
- Extract the
i
-th polygon using separateNaN
.
- Convert the polygon to a polyline using
PLofCPL
.
- Calculate the angles at each vertex using
PLangle
.
- Select vertices where the absolute angle is greater than
al
.
- Count the number of selected vertices and update
FE
with these points.
- Update the counter
k
with the number of new feature edges found.
- Trim
FE
to include only the found feature edges.
- If the function is called with two output arguments, find the indices of feature edges in
CPL
using findVL
.
- If no output arguments are specified, plot the original polygon and the feature edges using
SGfigure
, CPSplot
, and PLplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 00:56. (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