Game Development Reference
In-Depth Information
of the two points gives you the distance that defines one side of the triangle. Given
the measurements of the base and a side of a triangle, you can then draw upon the
Pythagorean theorem to find out more about the triangle.
According to the Pythagorean theorem, the square of the hypotenuse of a right-
angled triangle is equal to the sum of the squares of the remaining two sides. The
theorem is usually expressed along the following lines:
c
2
¼ a
2
þ b
2
where
c
represents the hypotenuse and
a
and
b
represent the remaining two sides.
If you know that one side of a triangle is equal to 2 and another is equal to 4, then
proceed to solve the equation in this manner:
3
2
þ
4
2
¼ d
2
9
þ
6
¼ d
2
25
¼ d
2
25
p
¼ d
5
¼ d
Exercise Set 7.2
Using the Pythagorean theorem, use these values for the sides of triangles and calculate the
length of the hypotenuse.
a. 12, 5
b. 32, 24
c. 3, 4
d. 24, 10
e. 12, 9
The Distance Formula
Given the grounding the previous section provides, you can set up an equation to
calculate the distance between two points in this way:
x
2
y
2
¼ d
2
D
þ D