Game Development Reference
In-Depth Information
Given the points in the graph featured in Figure 6.12, you can determine the
slope if you substitute coordinate values into the point-slope equation:
m ¼ D
y
11 5
4 1 ¼
6
3 ¼ 2
x ¼
D
Note
It is important to retain a specific ordering of the coordinate values when you determine the slope.
Figure 6.13 illustrates a situation in which the order of the x coordinates is the reverse of the
order of the y coordinates:
Figure 6.13
Preserve the order of the pairs.
When you know the slope of the line that connects the two points, you can
proceed to find the equation of the line. To accomplish this, you make use of the
point-slope equation. This equation reads as follows:
ðy 2 y 1 Þ¼mðx 2 x 1 Þ
You now substitute the slope and values from one of the coordinate pairs. Using
the values from Figure 6.12, this leaves you with this form of the equation:
y ð 5 Þ¼ 2 ðx 1 Þ
If you solve for y , you arrive at the standard form of a linear equation:
y 5 ¼ 2 ðx 1 Þ
y ¼ 2 x 2 þ 5
y ¼ 2 x þ 3
This, then, is the equation for the line shown in Figure 6.12.
 
Search WWH ::




Custom Search