matlabified more code concerning smoothing normals