NLcontourVL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 1.0, Creation date: 2012-04-12, Last change: 2025-09-14

return the list of normal vector for the edges between the vertices and the vertices between the edges

Description

At a later stage, EL may be become an option. If it is missing at input, it is generated as output.
This is an important auxiliary function. It calculates for a sorted (!) contour the list of normal vector for the edges and vertices. Both normal vector lists are useful in procedures such as VLFLcorticalis


See Also: NLconformance

Example Illustration

 missing image of NLcontourVL(VL)

Syntax

[ENL,VNL]=NLcontourVL(VL)

Input Parameter

VL: Vertex list of a sorted(!) contour: Use VLGraham before or VLsortC

Output Parameter

ENL: List of normal vector of the edges
VNL: List of normal vector of the edges




Copyright 2012-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 normal vectors for the edges and vertices of a sorted contour. It is part of the SG-Library and is used in analytical geometry.

Input Parameters

Output Results

Algorithm Steps

  1. Determine the number of vertices n from the size of VL.
  2. Initialize ENL as a zero matrix with dimensions n x 3.
  3. Loop through each vertex from 1 to n-1 to calculate the edge normal vectors:
    • Calculate the difference in x (dx) and y (dy) coordinates between consecutive vertices.
    • Compute the length l as the inverse of the norm of the vector [dx, dy].
    • Calculate the normal vector for the edge and store it in ENL.
  4. Calculate the normal vector for the edge between the last and the first vertex to close the contour.
  5. Negate ENL to ensure the normals point outward.
  6. Initialize VNL as a zero matrix with dimensions n x 3.
  7. Loop through each vertex from 2 to n to calculate the vertex normal vectors:
    • Average the normal vectors of the adjacent edges and store in VNL.
  8. Calculate the normal vector for the first vertex by averaging the first and last edge normals.
  9. Normalize each vector in VNL to ensure they have a length of 1.
Algorithm explaination created using ChatGPT on 2025-08-19 01:18. (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