Well, so i have created a simple algorithm for creating equal side triangles and when i wanted to implement possibility of rotating the triangle i tried using Atan2 function, but it miserably failed me.