[R] Radius of Curvature Fit
Tom D. Harray
tomdharray at gmail.com
Wed Sep 18 17:42:20 CEST 2013
Hi there,
I want to know the radius of curvature for a set of points, but cannot
figure out how to perform the fit in R.
I have a set of points P_i for which I want to calculate the radius of
curvature. The coordinates (x_i|y_i) of the points in a data.frame:
p <- data.frame(
x = c(113, 143, 184, 229, 290, 342, 393, 456, 540, 618),
y = c(392, 389, 386, 383, 379, 380, 380, 380, 383, 388)
)
For the radius of curvature I now have to find the circle the which
describes best my points. This circle has an origin at r_x and r_y,
and the radius r. The equation I started with is:
r^2 = (r_x - x_i)^2 + (r_y + y_i)^2
r^2, r_x, and r_y are constant. Expanding the quadratic terms and
subtracting r^2 leads to
0 = x_i^2 + (-2*r_x)*x_i + y_i^2 + (-2*r_y)*y_i + r_x^2 + r_y^2 - r^2
The last three terms add up to zero due to r^2 = r_x^2 + r_y^2:
0 = x_i^2 + (-2*r_x)*x_i + y_i^2 + (-2*r_y)*y_i
Here I got stuck. I -- as a non-mathematician -- would describe it as
quadratic equation in two dimensions, but I didn't succeed searching
for these terms in the help, mailing list, and web.
My question is: How to estimate the r_x, and r_y from the set of
points p using R?
Thanks and regards,
Dirk
More information about the R-help
mailing list