Syntax
CPLN=CPLbufferCPLlines(CPL,d)
Input Parameter
CPL : | | CPL consisting of open lines without meshes |
d : | | buffer width |
Output Parameter
Examples
CPLofmeshgridrods([0 15 25 35 45 55 65],[0 10]); x=ans;
CPLbufferCPLlines(x,1);
CPLbufferCPLlines(PLcircle(10),1);
CPLbufferCPLlines(CPLofPL(PLcircle(10)),1);
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, CPLbufferCPLlines
, is designed to convert a set of lines into a closed polygon concept. It is part of the SolidGeometry library and was introduced in version 5.1. The function takes two input parameters and produces one output.
Input Parameters
- CPL: A set of open lines without meshes. This is the primary input that the function processes.
- d: The buffer width. This parameter determines how much the lines should be grown or shrunk.
Output
- CPLN: The new closed polygon list or structure that results from processing the input lines.
Algorithm Steps
- Check if the buffer width
d
is not zero and if CPL
is not empty. If either condition is not met, the function returns the original CPL
.
- Initialize an empty array
CCC
to store processed lines.
- Use
separateNaN(CPL)
to determine the number of separate line segments in CPL
.
- Iterate over each line segment:
- Select the
i
-th line segment using selectNaN(CPL, i)
.
- Grow the line segment by half the buffer width using
PLgrowline
with parameters (selectNaN(CPL, i), d/2, false, true)
.
- Append the grown line segment to
CCC
, separated by nan nan
to maintain segment separation.
- Remove the initial
nan nan
from CCC
.
- Use
CPLmeltbool
to merge overlapping or adjacent line segments in CCC
.
- Apply
CPLradialEdges
to refine the edges of the merged lines, using a quarter of the buffer width d/4
.
- Assign the processed lines to
CPLN
.
- If no output argument is specified, plot the original and processed lines using
SGfigure
, CPLplot
, and CPSplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 00:16. (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