How can I rotate an image around a point that is not the origin of the image using MATLAB?
3 answers
The 'rotate' help says:
ROTATE Rotate objects in a given direction and direction. ROTATE (H, [THETA PHI], ALPHA) rotates objects using the H grips through the ALPHA angle around the axis described by the 2-element direction vector [THETA PHI] (spherical coordinates).
All angles are in degrees. The handles in H must be children from the same axes....
ROTATE (..., ORIGIN) uses the point ORIGIN = [x0, y0, y0] as the center instead of the center of the plot window.
0
source to share
To rotate around a point other than the start point, you:
- Translate the point you want to rotate to the origin. For example, if you want to rotate around (3.5), you translate to (-3, -5).
- Perform your spin.
- Cancel the original transfer. So in my example you are now translating to (+ 3, + 5).
0
source to share