Game Development Reference
In-Depth Information
is, if we want to move the box 60 cm to the right, 30 cm up and 20 cm
towards the back wall, then we can use the vector [6, 3, 2] (recall that the
scale for each dash is 10 cm) to move the box. The sum of two vectors is
the sum of the components.
[ x , y , z ]=[ x 1, y 1, z 1] + [ x 2, y 2, z 2]
where x = x 1 + x 2, y = y 1 + y 2 and z = z 1 + z 2
For example,
[12, 3, 10] = [6, 0, 8] + [6, 3, 2]
Describing an object
The simplest shape that has some volume has just four points or vertices .
A tetrahedron is a pyramid with a triangular base. We can extend the idea
of a point in 3D space to define the four vertices needed to describe a
tetrahedron. Before we can draw an object we also need to define how to
join the vertices. This leads to two lists: a list of vertices and a list of faces
or polygons .
The vertices used are:
A: [ 0.0,
B: [-1.0,
C: [ 0.0,
D: [ 1.0,
To describe the faces we give a list of the
vertices that the face shares:
1: A,B,D
2: A,D,C
3: A,C,B
4: B,C,D
Figure 1.3 A tetrahedron.
Although the triangles ABD and ADB appear to be the same, the order of
the vertices is clearly different. This ordering is used by many computer
graphics applications to determine whether a face is pointing towards the
viewer or away from the viewer. Some schemes use points described in
a clockwise direction to indicate that this face is pointing towards the
viewer. Other schemes choose counter-clockwise to indicate forward-
facing polygons. In this topic we used counter-clockwise. There are no
advantages or disadvantages to either scheme, it is simply necessary to
Search Nedrilad ::

Custom Search