Game Development Reference
In-Depth Information
Over the centuries, many other types of units have been devised that you may come across
from time to time. In the English system, some of the “other” units can seem a little strange. For
example, a grain is a unit of mass in the English system, and there are 7024 grains to a pound.
The SI system also defines additional units of measure, but these are always defined in terms of
the fundamental units. A Newton, for example, is a kg-m/s 2 .
Tidbit The units in the English system of units were developed over many hundreds of years, and some of
the origins are interesting. The foot was taken from the measurement of a human foot (the king's according
to legend). Zero degrees in the Fahrenheit temperature scale was based on the coldest temperature Dr. Fahrenheit
could achieve in his lab.
The key thing about systems of units for game programmers is to make sure to use a
consistent system of units. If you mix and match English and SI units, you will not get the right
answer. For example, let's say you want to calculate the acceleration of an arrow according to
the equation F=ma . Let's also say that you want to shoot an arrow whose mass, m , is given as
500 grains from a bow that can deliver a force, F , of 5 N . If you want the acceleration, a , in units
of m/s 2 , you must first convert the mass of the arrow from grains to kg .
Tidbit A classic case of how mixing and matching units can cause big problems is what happened to the
NASA Mars Climate Orbiter mission in 1999. One team of engineers working on the project used English units
and another team used SI units. The resulting screwup created an error in the guidance program that caused
the spacecraft to enter into the Martian atmosphere at too steep an angle. The billion-dollar space mission failed.
Scientific Notation
In the world of physics, sometimes it is necessary to work with really large or really small numbers.
For example, the gravitational constant, a quantity that relates the force two objects exert on
each other, is a very small number. Written in standard decimal notation, it is equal to the
following:
2
Nm
k
G =
0.0000000000667
(2.1)
2
For small numbers like the gravitational constant, it's pretty inconvenient to have to write out
all the zeros. Fortunately, there is something known as scientific notation that can be used
to express large or small numbers in a more compact form. Under this system, numbers are
written as a value between 0 and 10, the letter “e,” and a number that represents how many
powers of ten are in the value. For example, the gravitational constant could be written more
compactly using scientific notation:
2
Nm
k
G
=−
6.67
11
(2.2)
2
Search WWH ::




Custom Search