I have an image with two points, aligned something like this:
|----------------| | | | . | | | | . | | | |----------------|
I have both X, Y coordinates for both points and I need to rotate the image X degrees so it looks like this instead:
|----------------| | | | | | . . | | | | | |----------------|
Basically so they align next to eachother, what’s the math for this? (A code example in C# would be even better but not required)
It depends on which point you want to use as a ‘center’ for your rotation. Let’s call the point to the up and left pointA and the one to the right and below pointB. If you want to rotate around the point A so that point B aligns with it, calculating the rotation angle in radians would go like this:
I don’t how you’re handling your image, so the following applies only if you’re using System.Drawing.Graphics:
Hope it helps.