finish rewrite #getContour
finish rewrite #getMaxAngle - with debug