Rotation +30" around Center
Rotation around the Origin
Rotation -45" around Center
Figure 12.4 Rotation can be a bit tricky to understand because we tend to assume that it occurs around the center of the image. Not so. If the center of rotation is not specified in the rotation equations, rotation takes place around the origin of the image coordinate system, usually in a corner of the image.
costh = COS (th) FOR yp = 0 to ymax FOR xp = 0 TO xmax x = xO + (xp-xO) y = yO + (xp-xO)
INT(y)<0 OR INT(y)+l>ymax THEN new(xp,yp) = 0 ELSE
xf = x - INT(x) yf = y - INT (y) a = old(INT(x), b = old(INT(x), c = old(INT(x)+1, INT(y)) d = old(INT(x)+1, INT(y)+1) new(xp,yp) = a * (1-xf) * (l-yf)_ + b * (1-xf) * yf_ + c * xf * (1-yf)_ + d * xf * yf
Was this article helpful?