
Two problems fixed. One, the comparison of angles to 'almost straight' or 'almost zero' needed a bigger epsilon. Two, using the corner normal instead of the average face normal is usually the right thing to do, and what the code was doing, but in some cases the corner normal could be very wrong.