function y = sim9b_car_halfcircle_3inputs(x, r, delay)

x = x - r;

x = x - delay; % delay before the half circle starts

if (x > r)
    x = r;
end

if (x < -r)
    x = -r;
end

y = sqrt(r*r - x*x);