Syntax
[CPL,PLE]=PLconnectopenends(PL,[])
Input Parameter
Output Parameter
CPL : | | Closed contour without doubled entries |
PLE : | | Externsion may contain start or end point |
Examples
PLX=PLradialEdges(PLrand(10,4)*10,30); SGfigure; PLplot(PLX,'b-'); % Arbitrary Line
PLconnectopenends(PLX)
CPLfft(PLconnectopenends(PLsample(3)),4)
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 algorithm is designed to close an open line by forming a contour. It is part of the SolidGeometry library and was introduced in version 4.5. The function is named PLconnectopenends
and it takes an open line as input to produce a closed contour.
Input Parameters
- PL: A single open line represented as a list of points.
Output Results
- CPL: A closed contour without duplicated entries.
- PLE: An extension that may contain the start or end point of the line.
Algorithm Steps
- The function
PLtangentarc4P
is called with the last two points of the line and the first two points of the line. This function is assumed to calculate a tangent arc that connects these points.
- The result of
PLtangentarc4P
is stored in PLE
.
- The original line
PL
is concatenated with PLE
to form CPL
.
- A logical index
rpi
is created to remove duplicate points by checking if the norm of the difference between consecutive points is greater than a small threshold (1e-6).
CPL
is updated to only include points that are not duplicates.
- If no output arguments are specified, a figure is created using
SGfigure
and the following plots are made:
- The original line
PL
is plotted in blue.
- The extension
PLE
is plotted in red.
- The start and end of
PLE
are marked with magenta stars.
- The start of
PL
is marked with a black star.
Algorithm explaination created using ChatGPT on 2025-08-19 00:10. (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