CVLedgecenter

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CVL/Closed Vertex Lists
Introduced first in SolidGeometry 5.0, Creation date: 2020-09-14, Last change: 2025-09-14

Calculates the center/middle point between two edge points



See Also: CVLedgeNormal

Example Illustration

 missing image of CVLedgecenter(CVL)

Syntax

MVL=CVLedgecenter(CVL)

Input Parameter

CVL: contour vertex list

Output Parameter

MVL: Middle-point-of-edge vertex list

Examples


CVLedgecenter(VLofCVL(CVLsample(31))) % Open CVL creates the right middle points
CVLedgecenter(CVLsample(31)) % Creates an additional point at the end




Copyright 2020-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 calculates the center or middle point between two edge points in a contour vertex list (CVL). It is part of the SolidGeometry library and is used to process closed polygon lists.

Input Parameters

Output Results

Algorithm Steps

  1. Use the function separateNaN(CVL) to separate the input CVL into segments, handling any NaN values that may indicate breaks in the contour.
  2. Initialize MVL as an array of NaN values with the same size as CVL.
  3. Iterate over each segment of the contour:
    • For each segment, calculate the indices ii that define the current segment of the contour.
    • Compute the edge centers ECi by averaging each point with its subsequent point, using circshift to handle wrapping around the segment.
    • Store the calculated edge centers in the corresponding positions in MVL.
  4. If no output is requested (i.e., nargout==0), plot the original contour and the calculated midpoints using SGfigure and CVLplot.
Algorithm explaination created using ChatGPT on 2025-08-18 23:22. (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