
4.6. Image and texture mapping 137
the Floor function is given in figure 4.11
α
m
= (float)F loor(α)
β
m
= (float)F loor(β)
b
x
= ((truncate α
m
)(bitwise AND) 1)
b
y
= ((truncate β
m
)(bitwise AND) 1)
α
m
= α − α
m
β
m
= β − β
m
i f b
x
6= 0 {
i f b
y
6
= 0 {
α
m
= 1 − α
m
β
m
= 1 − β
m
}
e ls e {
α
m
= 1 − α
m
}
}
e ls e i f b
y
6
= 0 {
β
m
= 1 − β
m
}
Listing 4.13: Generating a mosaic repeat pattern for seamless image mapping.
The second issue is the rather d is continu ou s way of rounding the floating
point texture coordinates (X, Y ) to the integer address (i, j) (i = truncate(x)
and j = truncate(y)) u s ed to pick the color from the image. A better appr oach
is to use a bilinear (or high er order)