improved function so it can also work with negativ radius