If we want to transform a line or plane using an affine transformation…
Given a transformation matrix in let’s say, two dimensions:
We notice that the origin:
always transforms to itself. That is to say that a standard transformation matrix cannot encode a translation without help. We can add a translation term to make this happen:
Which is essentially equivalent to:
Which we will write from now on as:
This is the basis of the affine transform. Adding that extra 1 to the end of our coordinates makes them homogeneous coordinates. For most intents and purposes, we can ignore it.
The general equation of a line in two dimensions is given by a set of points x and y satisfying the equation ax+by+c=0. This is usually better than it’s simpler cousin y=mx+c, because that structure has trouble representing vertical lines. This formula can be written as:
where [a b] happens to be a vector perpendicular to the line. In order to transform a line using an affine transform matrix so that nv=0 and n′v′=0 where v′=Tv, the transformed points must satisfy the following equation:
Which implies that
If we consider that n is a normal for a line in 2d space, or plane in 3d space, we can use it to transform a plane using an affine transform and back again. by converting it into a row vector and pre-multiplying it by the inverse of the transformation matrix. This is useful when trying to render scenes using raytracing and constructive solid geometry.