Syntax
PLconnectopenradial(PL,[R]);
Input Parameter
Examples
PLconnectopenradial(rand(10,2)*100);
PLconnectopenradial(rand(10,2)*100); CPL=ans; SGfigure; CPLplot(CPL,'m-');
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, PLconnectopenradial
, is designed to close an open line by creating a contour. It is part of the SolidGeometry library and was introduced in version 4.5. The function takes an open line, represented by a set of points, and optionally a parameter R
, which defaults to 100 if not provided.
Input Parameters
- PL: A matrix representing a single open line, where each row is a point in 2D space.
- R: An optional parameter, defaulting to 100, used in the function
VLradialEdges
.
Algorithm Steps
- Extract the first two points and the last two points of the line
PL
to form PLA
and PLB
respectively.
- Calculate the unit direction vectors
ea
and eb
for PLA
and PLB
.
- Compute orthogonal vectors
oa
and ob
to ea
and eb
.
- Determine the distances
d1
and d2
using the function cross2edges2
, which finds intersections of lines.
- Calculate the minimum distance
d
from d1
and d2
.
- Compute the angle
w1
between ea
and eb
using acos2
.
- Create a new set of points
PLX
that extends PL
by adding points based on the calculated distances and directions.
- Call
VLradialEdges
with PLX
and R
to generate a closed polygon PLN
.
- Trim
PLN
to remove the first two and last two points, then append it to PL
to form PLA
.
- If no output is requested, plot the original line
PL
and the new closed line PLN
.
Algorithm explaination created using ChatGPT on 2025-08-19 07: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