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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.