Game Development Reference
In-Depth Information
0.0, cosine, -sine, 0.0,
0.0, sine, cosine, 0.0,
0.0, 0.0, 0.0, 1.0);
}
matrix CreateRotationY(float radians)
{
const float cosine = cosf(radians);
const float sine = sinf(radians);
return matrix(
cosine, 0.0, -sine, 0.0,
0.0, 1.0, 0.0, 0.0,
sine, 0.0, cosine, 0.0,
0.0, 0.0, 0.0, 1.0);
}
matrix CreateRotationZ(float radians)
{
const float cosine = cosf(radians);
const float sine = sinf(radians);
return matrix(
cosine, sine, 0.0, 0.0,
-sine, cosine, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
}
Before we delve into the details on how we will achieve this, let's talk about the next im-
portant transformation, translation. We will then come back and close our discussion about
rotations.
1.3.4 Translation
Whenever we have points or objects in a given space and we wish to move them to a new
position, we translate them. One way to think about translation is that given an arbitrary
point, we add a constant vector to it.
The resulting vector will be offset, or moved as a result of the vector addition, see Vector
Addition .
Search WWH ::




Custom Search