That formula is great when $y$ can be written as a function of $x$, but that doesn't work in cases where the assumption fails...for things like, say, an oval racetrack, where there are two $y$-values for every $x$-value, or for any more generic curve that might contain a vertical line segment (e.g., a Bezier!).
Instead, you want to use the parametric curvature formula:
$$
k(t) = \frac{x''(t) y'(t) - y''(t)x'(t)} {(x'(t)^2 + y'(t)^2)^\frac{3}{2}}
$$
(This formula assumes that the curve goes counterclockwise; if your curve goes clockwise, then you need to negate it.)
The radius of curvature is then $1/k(t)$.
The only problem arises when the denominator in $k$ is zero, which happens only when both the $x$ and $y$ derivatives are zero, i.e., when the curve is not "regular"; in this case, you get a $0/0$ form, and the formula's no good to you. In your project, it seems to me that this is unlikely to happen.
Of course, you're inverting $k$, so you'll have a problem if
$$
x''(t) y'(t) - y''(t)x'(t) = 0
$$
at some time $t$; again, I expect this not to be a problem unless your racetrack has some long "straightaway," where the radius of curvature is infinite.
Here's a bit of sample code to show you what's going on.
function sillycurve()
% Here's an example of the code for you. It actually has the "denominator = 0"
% problem, which I've addressed (crudely) here by adding .001 to the
% denominator, just so you can see the problem nicely.
clear;
clf;
N = 300; % use 300 points
t = linspace(0, 2*pi, N);
dt = 2*pi/N;
% Substitute any formula you like for x and y below.
x = sin(t);
y = cos(2*t) - cos(t);
figure(1);
% Show the curve, growing...
for i=[1:10:N]
plot(x(1:i), y(1:i));
set(gca, 'XLim', [min(x), max(x)], 'YLim', [min(y), max(y)])
figure(gcf);
pause(0.1);
end
figure(gcf);
%
% Compute $x'(t)$ and $x''(t)$, etc.
xp = (circshift(x, 1) - x )/dt;
xpp = (circshift(xp, 1) - xp)/dt;
yp = (circshift(y, 1) - y )/dt;
ypp = (circshift(yp, 1) - yp)/dt;
% Numerator and denominator for curvature formula
kn = xpp .* yp - ypp .* xp;
kd = (xp.^2 + yp.^2).^1.5 + .001; % the .001 is added to avoid divide-by-zero problems
% A plot of the denominator, so that you can see where it goes to zero:
figure(2);
plot(t, kd);
figure(gcf);
% And finally, a plot of the curvature
k = kn ./ kd;
R = 1 ./ k;
figure(3);
plot(t, k);
figure(gcf);