Game Development Reference
In-Depth Information
Given this set of coordinates, you can then determine the slope of the line if you
establish the ratio of the rise ( y ) to the run ( x ). Here is the equation and work that
accomplishes this task:
m ¼ D
y
y 2 y 1
x 2 x 1 ¼
2 0
2 0 ¼
2
2 ¼ 1
x ¼
D
The slope, then, is 1.
For the upper line, you start with this set of coordinates:
ð 0, 0 Þð 4, 8 Þ
As with the middle line, you determine the slope of the upper line if you establish
the ratio of the rise ( y ) to the run ( x ):
m ¼ D
y
y 2 y 1
8 0
4 0 ¼
8
4 ¼ 2
x ¼
x 2 x 1 ¼
D
The slope is 2.
For the bottom line, you follow the same approach as before. Your starting
coordinates are these:
ð 0, 0 Þð 8, 2 Þ
As with the middle and lower lines, you can determine the slope of the line if you
establish the ratio of the rise to the run:
m ¼ D
y
y 2 y 1
2 0
8 0 ¼
2
8 ¼
1
4
x ¼
x 2 x 1 ¼
D
For each unit the line rises, it runs 4 units. The slope is 4 .
Using the slope-intercept equation, you can shift the line you generate for a linear
equation above or below the x axis by using a constant to designate the
y-intercept:
y ¼ mx þ b
The letter b designates the y-intercept. A line by definition connects two points.
To establish one of these two points, as Figure 6.9 reveals, you can use the
coordinate values of the origin. On the other hand, if the line does not pass
through the origin, you can work with the coordinates that define the y-intercept.
Search WWH ::




Custom Search