Thickness math

added log. made thickness relative to threshold. working nicely!!!