Syntax
NVL=NLconformance(NVL,ez);
Input Parameter
NVL : | | Normal vector list |
ez : | | reference direction vector. |
Output Parameter
NVL : | | Correct normal vector list |
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 algorithm is designed to adjust the orientation of a list of normal vectors (NVL) based on a reference direction vector (ez). The function ensures that each vector in NVL is aligned within 90 degrees of the reference vector ez.
Input Parameters
- NVL: A list of normal vectors that need to be adjusted.
- ez: A reference direction vector used to determine the correct orientation of the vectors in NVL.
Output
- NVL: The adjusted list of normal vectors, where each vector is oriented within 90 degrees of the reference vector ez.
Algorithm Steps
- Normalize the reference vector
ez
to ensure it has a unit length. This is done by dividing ez
by its norm.
- If the number of vectors in
NVL
is greater than the number of vectors in ez
, replicate ez
to match the size of NVL
.
- If no output is expected (i.e.,
nargout==0
), store the original NVL
in OVL
for later visualization.
- Iterate over each vector in
NVL
:
- Calculate the angle
w
between the current vector in NVL
and the corresponding vector in ez
using the dot product and acos
function.
- If the angle
w
is greater than 90 degrees (or pi/2
radians), reverse the direction of the vector in NVL
by multiplying it by -1.
- If no output is expected, visualize the vectors:
- Use
SGfigure
to create a new figure and set the view angle.
- Plot the reference vector
ez
in black, the adjusted NVL
in green, and the original OVL
in red using VLplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 00:11. (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