[R] computing the radius of an arc

Hans W Borchers hwborchers at googlemail.com
Fri Jul 24 11:40:52 CEST 2009


Nair, Murlidharan T <mnair <at> iusb.edu> writes:

> 
> Hi!!
> 
> I am interesting in computing the radius of an arc that best approximates 
> a curve. Is there an R function that I can use to draw an arc? 
> Nothing useful came up when I searched help.search.  Does anyone have any 
> suggestion to do this?
> Thanks ../Murli
> 

If you are looking for some formulas to calculate the center and radius
of such a circle/arc, search for 'curvature' in Wikipedia or MathWorld.
Formulas are a bit involved, and you will need to be able to compute
first and second derivatives of the curve.

In case the curve is given as a set of discrete points, you could apply
some polynomial, spline, etc., interpolation.

If you _then_ apply 'draw.arc', watch out to set the aspect ratio to 1,
otherwise your circle may appear to be incorrect.

    library(plotrix)
    curve(sin(x), 0, pi, col="blue", asp=1)
    draw.arc(pi/2, 0, 1, deg1=45, deg2=135, col="red")

Physical meaning of the curvature (and thus the approximation) is that
an observer moving on the curve will feel the same centrifugal forces
as if moving on the circle, at that moment.

Regards
Hans Werner




More information about the R-help mailing list