Added polarity to fitEdge function and dynamic scaling option to HueDistance