Thanks for the help guys, but I think these explanations were too technical for me. However, you made it clear to me that there is no special case for a triangle (which, looking back, I should have known), so I tried my hand at searching and after several methods, I found one that worked for me.
Without going into general solutions and mathematics (as mentioned above in these posters and in numerous articles), I could give you an example of how to solve the problem of “turning point A around point B by C degrees”.
Now. First of all, as I described in a previous article, a point located on the X axis, the distance L from the beginning, rotates degrees C around the origo
x = L * cos (C)
y = L * sin (C)
Similarly, the formula for the perpendicular vector is x = -y | y = x, which means that the point located on the Y axis (again, L from origo) will be rotated to C using the formula
x = - L * sin (C)
y = L * cos (C)
As shown in the above image, the final solution is the sum of the rotations of the projected vectors, so we can get the formula
x '= x * cos (C) - y * sin (C)
y '= y * cos (C) + x * sin (C)
... but you already knew that, right? the problem is that this formula only revolves around ori. So, we need to move the coordinate system, which we rotate around to Oriu, rotate, and then go back. This can be done quickly with complex numbers or in general solutions with matrices, but we will stick with vector math on this to make it simple.
first step; move the starting point.
x '= Ax - Bx
y '= Ay - By
second step, turn
(C) = (Ax-Bx) * cos (C) - (Ay-By) * sin (C) (C) = (Ay-By) * cos (C) + (Ax-Bx) * sin (C)third and final step, return the coordinate frame
x '' '= x' '+ Bx = (Ax-Bx) * cos (C) - (Ay-By) * sin (C) + Bx
y '' '= y' '+ By = (Ay-By) * cos (C) + (Ax-Bx) * sin (C) + By
And presto! we have our own rotation formula. I will give this to you without all these calculations:
Rotation of point A around point B by angle C
Ax '= (Ax-Bx) * cos (C) - (Ay-By) * sin (C) + Bx
Ay '= (Ay-By) * cos (C) + (Ax-Bx) * sin (C) + By
If you follow me here (and I'm a pretty lousy teacher, sorry if you didn’t), you can say that the order in which you perform these operations is very important. Try mixing steps 3 and 1 and see the difference in the formulas that you get.
Good luck and all!