Date: Feb 3, 2006 11:46 AM
Author: joa
Subject: Re: curvature of circle through three points

Because it's Friday.


function k = kfrom3points(xs,ys);

%KFROM3POINTS Calculate curvature of a circle given 3 points

%

% K = KFROM3POINTS(XS,YS)

% Where

% XS holds 3 x values

% YS holds 3 y values

% Then

% K is the curvature of the circle through the points


xs=xs(:); % columnize xs

ys=ys(:); % columnize ys


os = ones(3,1);

ss = xs.^2+ys.^2; % sum of squares


a = det([xs ys os]); % Eq. 31

d = -det([ss ys os]); % Eq. 32

e = det([ss xs os]); % Eq. 33

f = -det([ss xs ys]); % Eq. 34


r = sqrt((d^2+e^2)/(4*a^2)-(f/a)); % Eq. 30

k=1/r; % curvature