Syntax
CVL=CVLofVL(CVL)
Input Parameter
CVL : | | CVL with potential open contours |
Output Parameter
CVL : | | CVL with ensured closed contours |
Examples
CVLofVL(VLsample(14))
Copyright 2017-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, CVLofVL
, is designed to ensure that all contours within a Closed Vertex List (CVL) are closed. It is part of the SolidGeometry library and was introduced in version 4.0.
Input Parameters
- CVL: A Closed Vertex List that may contain open contours.
Output Results
- CVL: A Closed Vertex List with all contours closed.
Algorithm Steps
- Store the original CVL in
CVLo
for later comparison.
- Determine the number of separate contours in the CVL using the
separateNaN
function, which identifies segments separated by NaN values.
- Iterate over each contour (from 1 to
n
):
- Extract the
i
-th contour using separateNaN(CVL, i)
.
- Check if the first and last points of the contour are the same using
isequal
.
- If they are not the same, append the first point to the end of the contour to close it.
- Replace the original contour in the CVL with the closed version using
replaceNaN
.
- If no output argument is specified (
nargout==0
), visualize the results:
- Create a new figure using
SGfigure
and set the view angle to (-30, 30).
- Plot the modified CVL in red with a line width of 2 using
CVLplot
.
- Plot the original CVL in green with a line width of 2 for comparison.
Algorithm explaination created using ChatGPT on 2025-08-18 22:45. (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