Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!nx01.iad01.newshosting.com!newshosting.com!207.69.154.102.MISMATCH!elnk-atl-nf2!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!stamper.news.pas.earthlink.net!newsread3.news.pas.earthlink.net.POSTED!5f968bd6!not-for-mail
From: ellieandrogerxyzzy@mindspring.com.invalid (Roger Stafford)
Newsgroups: comp.soft-sys.matlab
Subject: Re: curvature and radius of curvature of a plane curve
Message-ID: <ellieandrogerxyzzy-1607070133420001@dialup-4.232.60.142.dial1.losangeles1.level3.net>
References: <ef5d840.-1@webcrossing.raydaftYaTP> <ellieandrogerxyzzy-1507070827520001@dialup-4.232.57.106.dial1.losangeles1.level3.net>
Organization: -
Lines: 29
Date: Mon, 16 Jul 2007 08:33:42 GMT
NNTP-Posting-Host: 4.232.60.142
X-Complaints-To: abuse@earthlink.net
X-Trace: newsread3.news.pas.earthlink.net 1184574822 4.232.60.142 (Mon, 16 Jul 2007 01:33:42 PDT)
NNTP-Posting-Date: Mon, 16 Jul 2007 01:33:42 PDT
Xref: news.mathworks.com comp.soft-sys.matlab:419270


In article
<ellieandrogerxyzzy-1507070827520001@dialup-4.232.57.106.dial1.losangeles1.level3.net>,
ellieandrogerxyzzy@mindspring.com.invalid (Roger Stafford) wrote:

> In article <ef5d840.-1@webcrossing.raydaftYaTP>, bird
> <djbirdnerd@hotmail.com> wrote:
> > I want to calculate the local curvature (or radius of curvature) for
> > a few point on outline on a picture, but how the hell am i suppose to
> > do that ?
------------------
  You may find the following method more satisfactory than the previous
one I sent.  Its results are independent of any displacement of the axes'
origin.  Again x and y are your coordinate column vectors.

 mx = mean(x); my = mean(y)
 X = x - mx; Y = y - my; % Get differences from means
 dx2 = mean(X.^2); dy2 = mean(Y.^2); % Get variances
 t = [X,Y]\(X.^2-dx2+Y.^2-dy2)/2; % Solve least mean squares problem
 a0 = t(1); b0 = t(2); % t is the 2 x 1 solution array [a0;b0]
 r = sqrt(dx2+dy2+a0^2+b0^2); % Calculate the radius
 a = a0 + mx; b = b0 + my; % Locate the circle's center
 curv = 1/r; % Get the curvature

  The circle defined by center (a,b) and radius r will yield the least
mean square value for the expression (x-a)^2 + (y-b)^2 - r^2 among all
possible parameters, a, b, and r, over the points in vectors x and y.  The
circle's curvature will be 1/r.

Roger Stafford