Reputation: 385
I have two points like this
I want to rotate the image, so it looks like this:
I have the code to rotate the image. I just want to find the rotation angle like 5 degrees, 2 degrees.
I have the coordinates of both the points like 50,100
and 150, 94
(X,Y). I want to rotate the image such that, both Y-axis points become 100.
Upvotes: 1
Views: 918
Reputation: 80287
You can find rotation angle using math.atan2
function with point coordinates.
angle = math.atan2(p2.y - p1.y, p2.x - p1.x)
Note that rotation about coordinate origin would shift the first point also, so you perhaps need to make rotation about the first point.
Upvotes: 1