signed distance direction bug fix