Now we have the surface sag, the next step is to compute the direction cosines of the normal vector. The normal vector at a point (x0,y0) on a surface z = f(x,y) is given by

Normal vector


where fx = df/dx and fy = df/dy are partial derivatives. So, the direction cosines will be as follows:

direction cosines of the surface normals


In Maple, fx is given by:

Computation of Fx


The same actions are used to compute Fy.