PLconnectopenends

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - PL/Point Lists
Introduced first in SolidGeometry 4.5, Creation date: 2019-04-20, Last change: 2025-09-14

closes an open line by a contour

Description

Uses:
PLtangentarc4P


See Also: PLtangentarc4P

Example Illustration

 missing image of PLconnectopenends(PL,)

Syntax

[CPL,PLE]=PLconnectopenends(PL,[])

Input Parameter

PL: single open line

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

Output Results

Algorithm Steps

  1. 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.
  2. The result of PLtangentarc4P is stored in PLE.
  3. The original line PL is concatenated with PLE to form CPL.
  4. 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).
  5. CPL is updated to only include points that are not duplicates.
  6. 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