Game Development Reference
In-Depth Information
good enough results as it would introduce aliasing due to the fact that pixels on the screen
are represented as integral coordinates, while rotations are floating point operations. Er-
rors creep in when we round off the results causing pixels to land on the same destination
as neighboring source pixels, or to miss their target altogether, causing gaps or tears in the
resulting image.
pute the rotated pixel as the area weighted average of those four pixels. by Shear
There is an approach to rotation that works by performing three shear transformations on
a bitmap. A horizontal shear transformation will move a row of pixels by a distance that is
proportional to its vertical distance from some reference point. By doing three shear oper-
ations alternating between horizontal and vertical shears we can achieve a perfect rotation
by any angle (Paeth, 1986).
The shear matrix along the x axis has the form:
And along the y axis:
Asmentionedabove,rotation byshearingcanbeachievedbythreesuccessiveshearsalong
alternating axes. This implies that the product of the three shear matrices will be the same
as the rotation matrix we had previously found.
By solving this equation we can find the values α , β we need for a given angle Ɵ .
Search WWH ::

Custom Search