Please use
around source code to preserve formatting.

The basic algorithm goes like this:


foreach vertex v:
totalAngle = 0
normal_v = (0,0,0)
foreach face f that contains...