Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Project points using null() Date: Tue, 8 Nov 2011 08:34:13 +0000 (UTC) Organization: Université de Genève Lines: 39 Message-ID: <j9api5$eml$1@newscl01ah.mathworks.com> References: <i8i2vk$77u$1@fred.mathworks.com> <i8ij1r$39r$1@fred.mathworks.com> <i8mj09$i65$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-06-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1320741253 15061 172.30.248.38 (8 Nov 2011 08:34:13 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 8 Nov 2011 08:34:13 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 3167554 Xref: news.mathworks.com comp.soft-sys.matlab:748625 Stan, Which of the two works beautifully? Have you implemented Roger's method? In his formulation N2 is 1 since N was normalized. Thus, when you check the equation for P0, you see that P0 is independent of N. Therefore, the equation is wrong. Agree? "Stan " <zufallsacc@yahoo.com> wrote in message <i8mj09$i65$1@fred.mathworks.com>... > Thank you both for your help, this works beautifully! > > Kind regards, > Stan > > "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i8ij1r$39r$1@fred.mathworks.com>... > > "Stan " <zufallsacc@yahoo.com> wrote in message <i8i2vk$77u$1@fred.mathworks.com>... > > > Hello everyone, > > > > > > I'm trying to use a technique to project 3d points onto a plane of which I have the normal vector and a point. > > > > > > By reading through this newsgroup (this post in particular: http://www.mathworks.com/matlabcentral/newsreader/view_thread/169417) I understood that I get a projection by multiplying my matrix containing the point coordinates with the null function of the normal vector of the plane: > > > > > > [projection]=[Points]*null([normal vector]) > > > > > > It works beautifully, but I can't wrap my head around how reason it actually works ;)..In what kind of coordinate system/frame of reference do I have to see these resulting coordinates? I'd like to transform them back into my global Cartesian system.. > > > Thanks for any help on this.. > > > > > > Stan > > - - - - - - - - - - - > > Let P be the m x 3 array of the 3D points to be projected, let Q be the 1 x 3 vector of the given point on the plane, let N be the 1 x 3 vector of the normal direction to the plane, and let P0 be the m x 3 array of points orthogonally projected from P onto the plane. Then do this: > > > > N = N/norm(N); % <-- do this if N is not normalized > > N2 = N.'*N; > > P0 = P*(eye(3)-N2)+repmat(Q*N2,m,1); > > > > (You can also do that last line using bsxfun.) > > > > This can be derived from the single-point vector equation > > > > p0 = p - dot(p-q),n)*n > > > > where p is a vector to a point to be projected, q is a vector to the point on the plane, n is the unit normal vector to the plane, and p0 is the orthogonal projection of p onto the plane. > > > > Roger Stafford