MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Thread Subject: Project points using null()

 Subject: Project points using null() From: Stan Date: 6 Oct, 2010 15:01:08 Message: 1 of 10 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
 Subject: Project points using null() From: Matt J Date: 6 Oct, 2010 16:13:07 Message: 2 of 10 "Stan " wrote in message ... > 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.. ========= The above is correct only for planes passing through the origin. More generally, you would do the following, which would also produce output in your original coordinate system. basisPlane=null(normalVector); %basis for the plane basisCoefficients= bsxfun(@minus,Points,pointInplane)*basisPlane ; theResult=bsxfun(@plus,basisCoefficients*basisPlane.', pointInplane),
 Subject: Project points using null() From: Roger Stafford Date: 6 Oct, 2010 19:35:23 Message: 3 of 10 "Stan " wrote in message ... > 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
 Subject: Project points using null() From: Stan Date: 8 Oct, 2010 07:59:05 Message: 4 of 10 Thank you both for your help, this works beautifully! Kind regards, Stan "Roger Stafford" wrote in message ... > "Stan " wrote in message ... > > 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
 Subject: Project points using null() From: Kadir Date: 8 Nov, 2011 08:34:13 Message: 5 of 10 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 " wrote in message ... > Thank you both for your help, this works beautifully! > > Kind regards, > Stan > > "Roger Stafford" wrote in message ... > > "Stan " wrote in message ... > > > 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
 Subject: Project points using null() From: Roger Stafford Date: 8 Nov, 2011 17:09:25 Message: 6 of 10 "Kadir" wrote in message ... > 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 " wrote in message ... > > Thank you both for your help, this works beautifully! - - - - - - - -   Kadir, what makes you think N2 equals 1? It is the matrix product of the 3-by-1 column vector, N.', by the 1-by-3 row vector, N, producing a 3-by-3 matrix which is neither the scalar 1 nor eye(3). P0, in fact, very much depends on N (unless P is coincident with Q.) Roger Stafford
 Subject: Project points using null() From: Kadir Date: 8 Nov, 2011 17:31:50 Message: 7 of 10 You're right. Sorry, because I generally think about points as column vectors. "Roger Stafford" wrote in message ... > "Kadir" wrote in message ... > > 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 " wrote in message ... > > > Thank you both for your help, this works beautifully! > - - - - - - - - > Kadir, what makes you think N2 equals 1? It is the matrix product of the 3-by-1 column vector, N.', by the 1-by-3 row vector, N, producing a 3-by-3 matrix which is neither the scalar 1 nor eye(3). P0, in fact, very much depends on N (unless P is coincident with Q.) > > Roger Stafford
 Subject: Project points using null() From: Steven Date: 30 Jun, 2012 10:10:11 Message: 8 of 10 Roger, Given a plane defined in constants XCoeff, YCoeff, CCoeff (see http://www.mathworks.co.uk/support/solutions/en/data/1-1AVW5/index.html?solution=1-1AVW5)         z = XCoeff * x + YCoeff * y + CCoeff how would you calculate Q and N for your method? I tried Q = [1, 1, (XCoeff+YCoeff+CCoeff)]; N = [XCoeff, YCoeff, -1]; and while the projected points do all lie on the plane they are not orthogonally projected onto the plane? Best wishes Steven > 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
 Subject: Project points using null() From: Yash Date: 30 Jun, 2012 12:55:14 Message: 9 of 10 Thanks to this post was also trying to do this and now problem resolved after long makeyourassignment.com
 Subject: Project points using null() From: Bruno Luong Date: 1 Jul, 2012 09:04:07 Message: 10 of 10 "Steven " wrote in message ... > Roger, > Given a plane defined in constants XCoeff, YCoeff, CCoeff (see http://www.mathworks.co.uk/support/solutions/en/data/1-1AVW5/index.html?solution=1-1AVW5) > z = XCoeff * x + YCoeff * y + CCoeff > how would you calculate Q and N for your method?  z = XCoeff * x + YCoeff * y + CCoeff is equivalent to < (x,y,z) . (XCoeff, YCoeff , -1) > = -CCoeff <.,.> is dot product. Thus the normal vector is N = (XCoeff, YCoeff , -1) . % Bruno