Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: maxima of curvature
Date: Mon, 3 Mar 2008 16:13:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 39
Message-ID: <fqh82h$qsm$1@fred.mathworks.com>
References: <fqgmnf$oin$1@fred.mathworks.com> <fqh1f7$icm$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1204560785 27542 172.30.248.37 (3 Mar 2008 16:13:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 3 Mar 2008 16:13:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:455061



"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in 
message <fqh1f7$icm$1@fred.mathworks.com>...
> "Mario " <nospam@yahoo.com> wrote in message <fqgmnf$oin
> $1@fred.mathworks.com>...
> > I have a list of points describing the outlines points of a
> > shape. I'd want to find the points of maximum curvature. .........
> > Mario
> ----------
> ......
>  a = norm(P2-P1); % Distance from P1 to P2
>  b = norm(P3-P2); % Distance from P2 to P3
>  c = norm(P3-P1); % Distance from P1 to P3
>  cv = sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c))/(a*b*c); % Curvature
> .......
---------
  As a better alternative to the formula I gave you earlier, Mario, you can do 
the following.  Let P1, P2, and P3 be x,y column vectors of three successive 
points taken in counterclockwise order around your outline shape.  Then the 
signed curvature of a circle through them is:

 cv = 2*det([P2-P1,P3-P2])/(norm(P2-P1)*norm((P3-P2)*norm(P3-P1));

(In case the points are represented by row vectors instead of column vectors, 
the argument of 'det' should become [P2-P1;P3-P2] so as to remain a 2 x 2 
square matrix.)

  This curvature has the advantage that it is positive with convex portions of 
the curve and negative with concave portions, (assuming counterclockwise 
ordering of the points,) thereby allowing these to be distinguished.

  This method also yields higher accuracy than the earlier one in portions of 
the curve where there is very little curvature.  That is because with small 
curvature the a+b-c quantity in the earlier formula is of the order of the 
square of the curvature before the square root operation is performed, and 
this fact leads to a loss of accuracy in such cases.

Roger Stafford