[NL,DL]=PLnorm(PL)
PL : | Vector list |
NL : | Normalize vector list | |
DL : | Length list |
PL=PLsquare(10,30)+40, [a,b]=PLnorm(PL), NL=normr(PL), DL=vecnormr(PL-circshift(PL,-1))
The function PLnorm
is designed to normalize a vector list and optionally return the lengths of these vectors. It is part of the SolidGeometry library and was introduced by Tim Lueth. The function is considered obsolete as of July 20, 2025, and users are encouraged to use normr
and vecnormr
instead.
PL
. This is only calculated if the function is called with two output arguments.The function begins by normalizing the input vector list PL
using the normr
function, which scales each vector to have a unit length. This result is stored in NL
.
If the function is called with two output arguments, it calculates the lengths of the vectors in PL
using the vecnormr
function. This is done by first computing the difference between each vector and its subsequent vector using circshift(PL,-1)
, which shifts the rows of PL
circularly. The lengths are then stored in DL
.
The original code snippet included a commented-out loop that manually calculated the lengths and normalized vectors, but this has been replaced by the more efficient normr
and vecnormr
functions.
The function is straightforward and does not include any switch conditions or additional cases.
Algorithm explaination created using ChatGPT on 2025-08-19 01:24. (Please note: No guarantee for the correctness of this explanation)