Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Vectors on ellipsoid surface
Date: Mon, 24 May 2010 17:45:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 43
Message-ID: <htedv4$l4n$1@fred.mathworks.com>
References: <ht5ldf$7tf$1@fred.mathworks.com> <hta8lc$e4f$1@fred.mathworks.com> <htai71$i38$1@fred.mathworks.com> <htaqsk$5h1$1@fred.mathworks.com> <htba3v$iq3$1@fred.mathworks.com> <htbekb$afo$1@fred.mathworks.com> <htbpdd$e9i$1@fred.mathworks.com> <htd8kj$qbn$1@fred.mathworks.com> <htdetc$c98$1@fred.mathworks.com> <htdgr5$h9p$1@fred.mathworks.com> <htds3s$r3p$1@fred.mathworks.com> <hte4oq$7se$1@fred.mathworks.com> <hte79n$sa9$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1274723108 21655 172.30.248.35 (24 May 2010 17:45:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 24 May 2010 17:45:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1140591
Xref: news.mathworks.com comp.soft-sys.matlab:638797

Dear Bruno,

This is amazing, i must agree with Mark. Such a 'simple' question evaluates to a great contribution. I do not know how to thank you. My thesis on kinematics of ligaments in the knee will improve really much with this. 

I added this code to EllGeo2Alg

radii = reshape(radii, 1, []);
W = bsxfun(@rdivide, U, radii);
A = W*W';
b = -2*A*x0;
c = x0'*A*x0-1;

B=null((P1(:)-P2(:))') ;
C=[0,0]';
A2=B'*A*B;
b2=2*B'*A*C + B'*b;
c2=C'*A*C + b'*C + C;

So that the output of the function is now A2,b2 and C2.

So by doing the next code, I thought I would get C'.
-------------------------------------------------------------------
[A2 b2 c] = EllGeo2Alg(radii, U, x0,P1,P2)
x = EllPrj(c, radii, U);

% Compute l = |x-c|
l = sqrt(sum(bsxfun(@minus, x, c).^2, 1));
% Where the distance is minimal
[lmin imin] = min(l);
----------------------------------------------------------------------

Only it allready goes wrong in b2=2*B'*A*C + B'*b;
Should I transform C(0,0) to 3D before I do this? Or is my whole order of doing things wrong? 

By transforming C(0,0) to 3D I should use eq 2 (C+ B*xi), where I do know B and xi, but what parameter should I choose for C? And how can your file in the file exchanger help me with this?

Hope these questions are specific enough.

Again, thanks for all the effort and help. It is getting much clearer now.

Best wishes,

Els