A normal vector to a curve at a particular point is a vector perpendicular to the tangent vector of the curve at that point (also called a gradient). For an implicit 2D function in the form f(x,y)=0, the 2D gradient is:

f(x,y)=(fx,fy)

For an implicit 3D function, the normal is the vector perpendicular to the surface. The surface normal at a point p is given by the gradient of the implicit function:

n=f(p)=(f(p)x,f(p)y,f(p)z)

For a plane, we know that the dot product of the normal n and any vector that lies in the plane is zero. Therefore, we can model a plane as the following implicit equation:

(pa)n=0

Where p and a are any two points lying on the plane. Sometimes we want the equation of a plane through points a,b,c. The normal can be found by taking the cross product of any two vectors on the plane:

n=(ba)×(ca)

Transforming Normal Vectors

Normal vectors do not transform the way we would like when they’re multiplied by a transformation matrix. If the points on a surface are transformed by the transformation matrix M, a vector t tangent to the surface will still be tangent to the transformed surface. However, a surface normal vector n may not be normal to the transformed surface.

For example, when a transformation matrix M=Hx(s) that skews points toward the x-axis multiplies the normal vector n, the resulting vector Mn is not normal to the surface. We would like to find a transformation matrix N so that Nn is indeed the surface normal.

Transforming Normal

Transforming Normal

To find the value of N, we start from the fact that the normal n and the tangent t are perpendicular:

nt=0

Expressed as a matrix multiplication:

(1)nTt=0

After the transformation, they’re still perpendicular, so:

(Nn)TMt=0

Applying the transpose:

(2)nTNTMt=0

Relating (2) with (1), we see that the only way that both equations hold true is that:

NTM=I

The value of N is then:

NTM=INTMM1=IM1NT=M1N=(M1)T