### 19.3.1 Drawing a line

The line command draws and finds lines in ℝ2 and ℝ3.

- For a line in ℝ2, line takes eqn, a linear equation in the variables x and y.
- line(eqn) draws and returns the line given by the equation.
- For a line in ℝ3, line takes two arguments: eqn1 and eqn2, two linear equations in the variables x, y and z.
- line(eqn1,eqn2) draws and returns the line which is the intersection of the planes given by the equations.

#### Examples

line(2*y+x-1=0)

line(y=1)

line(x=1)

line(x+2*y+z-1=0,z=2)

line(y=1,x=1)

##### Remark.

line defines an oriented line:

- When a 2D line is given by an equation, it is rewritten as lhs−rhs=ax+by+c=0, this determines its normal vector [a,b] and the orientation is given by the vector [b,−a].
- When a 3D line is given by two plane equations, its direction is defined by the cross product of the normals to the planes.

  When the plane equation is rewritten as lhs−rhs=ax+by+cz+d=0, then the normal is [a,b,c]. For example, line(x=y,y=z) draws the line x−y=0,y−z=0 and its direction is:

  [1,−1,0]× [0,1,−1]=[1,1,1]