check it out!! I saw that for the rotation we can use the law of cosines. The code is not at all 100% correct but it is a start!