3-d rotation in c