Mathematics for Computer Graphics Applications, Second Edition

A straight line is the next simplest geometric object after a point. All physical examples of a straight line are finite line segments with well-defined endpoints and length. However, the mathematical or geometric line may be unbounded or infinite, or it may be a semi-infinite half-line or ray. This chapter reviews the mathematical description of lines in two and three dimensions, including linear parametric equations. It describes how to compute points on a line, geometric relationships between points and lines, line intersections, and translating and rotating lines.
The slope-intercept form is algebraically the simplest way to describe a straight line that lies in the x, y plane (Figure 9.1). If we know the slope m of a line and where it intersects the y axis, at y = b, then we write the equation of the line as
The slope m is the ratio of the change in y to the change in x between any two points on the line. If the coordinates of these two points are x 1, y 1 and x 2, y 2, then the slope of the line that passes through them is
The point-slope form is a variation of the slope intercept form (Figure 9.2). If we know the slope m and a point x 1, y 1 through which the line passes, then