How to find direction cosines of a vector