Uses base R functions and pracma, to find the matrix that maps x to y by a rotation through the normal to the plane spanned by x and y. This is the "shortest" mapping between the two vectors, which does not involve any rotation about the rotated vector itself.
vec2rot(x, y)A vector in R3
Another vector in R3
a 3x3 rotation matrix R with y = Rx
This formula is independent of the coordinate system used, as the properties of the output are defined by y = Rx and hold in any coordinate system. This function is verified to be numerically precise for norm vectors