Path: news.mathworks.com!not-for-mail From: "Stan " <zufallsacc@yahoo.com> Newsgroups: comp.soft-sys.matlab Subject: Re: Project points using null() Date: Fri, 8 Oct 2010 07:59:05 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 35 Message-ID: <i8mj09$i65$1@fred.mathworks.com> References: <i8i2vk$77u$1@fred.mathworks.com> <i8ij1r$39r$1@fred.mathworks.com> Reply-To: "Stan " <zufallsacc@yahoo.com> 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 1286524745 18629 172.30.248.35 (8 Oct 2010 07:59:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Fri, 8 Oct 2010 07:59:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 2530632 Xref: news.mathworks.com comp.soft-sys.matlab:676782 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