From a unit vector, we can get an orthonormal basis vectors in 3D space easily. Given we have a unit vector R, and we’re to build three vectors R, S, T which will construct a new orthonormal basis.
- Set the smallest (in absolute value) component of R to zero.
- Exchange the other two components of R, and then negate the first one.
- S = ( 0, –Rz, Ry ), in case Rx is smallest.
- Normalize vector S.
- S = S / |S|
- Last vector T is a cross product of R and S then.
- T = R x S