The equation of a line.

First, we forget about pixels, and review basic Cartesian geometry. The equation of a line may be written: y = mx + b. The slide shows that the slope m of the line is given by dy /dx, where dy is the "rise" in y and dx is the "run" in x for a particular segment of the line.

When drawing lines on a display, we're working in device coordinates, which means that the endpoints of a line segment are specified by integers. The quantities dx and dy are also integers.

Back

Quit