Syntax
[NL,OL]=CVLedgeNormal(CVL)
Input Parameter
Output Parameter
NL : | | Normal vector list for each vertex |
OL : | | Orthogonal inplane vector list for each vertex |
Examples
CVLedgeNormal(CVLsample(31))
CVLedgeNormal(CVLsample(32))
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 function, CVLedgeNormal
, calculates normal vectors for curved closed contours. It is part of the SolidGeometry library and was introduced in version 5.0. The function takes a closed polygon list (CVL) as input and outputs two lists: normal vectors (NL) and orthogonal in-plane vectors (OL) for each vertex.
Input Parameters
- CVL: A closed polygon list representing the contour for which normal vectors are to be calculated.
- varargin: Optional parameters. In this function, it is used to set a minimum angle threshold
Amin
with a default value of 0.001.
Output Results
- NL: A list of normal vectors for each vertex in the contour.
- OL: A list of orthogonal in-plane vectors for each vertex in the contour.
Algorithm Steps
- Set the minimum angle threshold
Amin
using the getfuncparams
function, with a default value of 0.001.
- Separate the input
CVL
into segments using the separateNaN
function, which returns the number of segments n
and their indices a
.
- Initialize
NL
and OL
as NaN arrays of the same size as CVL
.
- Loop through each segment of the contour:
- For each segment, extract the indices
ii
from a(i)+1
to a(i+1)-1
.
- Call the
VLedgeNormal
function to calculate the normal and orthogonal vectors for the segment, using the extracted indices and Amin
.
- Store the results in the corresponding positions in
NL
and OL
.
- If no output arguments are specified, plot the results:
- Set up a figure with
SGfigure
.
- Calculate the size factor
s
using the bounding box size sofBB
and the number of vertices nn
.
- Calculate the edge centers
CEL
using CVLedgecenter
.
- Plot the contour with
CVLplot
.
- Plot the orthogonal vectors in blue and the normal vectors in red using
lplots
.
- Add a plot annotation to label the vectors.
Algorithm explaination created using ChatGPT on 2025-08-19 01:27. (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