
Function v2 = ang2vec(v1,alpha,n) returns the vector v2 which is obtained by turning vector v1 by an angle of alpha, measured anticlockwise around the given axis n (which is the normal of the plane of rotation too). The vectors are three-dimensional. The angle is given in degrees. Input/output arguments v1 and v2 are M-by-3 matrices, and argument n may be either a 1-by-3 or M-by-3 matrix. The input argument alpha may be an column vector of length M. The function operates on each row of the input arguments. So, for each row k, the function calculates the vector v2(k,:) by turning vector v1(k,1) by an angle alpha(k,1) around given normal n(k,:). The function internally calls the following non-standard m-files: -- cross3d.m -- dot3d.m -- vectorlength.m The function is an implementation of Rodrigues' rotation formula (or: Euler's finite rotation formula; one of many variations of the Euler–Rodrigues formula): https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula (visited 2025-04-01) (c) 2026 fabien van mook 2026.08.20 release of this file within package "fvm-geometry" under GNU GPLv3+