Line, one of the graphics primitives is defined by two end points. Let be two point is affine space.
By expressing the equation of a line mathematically, it becomes easier to compute the coordinates of the points that make up the line.
Let m be the slope of the line. Then
If is the angle between the line and the positive x axis, then
where are the intervals in , respectively.
Note: The fact that the slope remains unchanged regardless of which two points are used to calculate it, implies the straightness of a line.
Let be the y intercept of the line, i.e., the point where the line intercepts the y axis. Then
is the equation of the line, where m is the slope.
be two points in affine space.
is a vector pointing from P to Q.
describes the line through P and Q.
Restricting t to defines the line segment from P to Q.
Let's determine the equation of a straight line L that passes through point P and is parallel to the direction vector as shown in the figure below.
Since is parallel to , their cross product is a zero vector.
where t is real number. This is the vector form of equation of straight line L.
Equating equations (0.9) and (0.6)
Since are components of vector parallel to the line L, it is a set of direction numbers of the line.
Equation (0.11) is the symmetric form or point-direction number form of equation of line L, where .
Let be any point on line L.
Substituting equations (0.4), (0.5), (0.12) in (0.13) and equating corresponding components, we obtain the following set of equations.
In the above set of equations, each point of the line corresponds to the value of the parameter m. Hence these equations are called the parametric equations of line.
The two-point form of equation of line is obtained by solving equations (0.14), (0.15), (0.16) for m