fixed the rotation issue

need to refine the trigonometric functions