use diameter instead of radius, as in Java implementation