0
$\begingroup$

I have a set of N points in 3D and need to at first fit a plane to them and then find the crossed points. So I fitted a plane based on a question here (Best Fitting Plane given a Set of Points). Now I need to know how can I find the points that crossed this fitted plane? In another word, I am looking for the intersection of my dataset and plane.

x=VarName1;
y=VarName2;
z=VarName3;
app=[y x ones(length(x),1)];
abc=inv(transpose(app)*app)*transpose(app)*z;
% abc=app\z;
errors= z-app*abc;
residual= error*app';

[xx, yy]=meshgrid(x,y);
zz=abc(1)*yy+abc(2)*xx+abc(3);

surf(xx,yy,zz)
hold on
plot3(x,y,z)
f_f=abc(3)+abc(2)*x+abc(1)*y;% plane equation

As you can see there are some crossing points. But when f_f does not have any 0 value. So I am wondering since there are some crossing points, why my equation never gets zero for different values of x and y?

$\endgroup$
  • $\begingroup$ points on the plane will satisfy the plane's equation $\endgroup$ – Vasya Nov 28 '17 at 16:51
  • $\begingroup$ Assuming your plane is written as $ax+by+cz=d$ for some real numbers $a,b,c,d$ you could simply plug each point $P=(x,y,z)$ of your data set into the equation of the plane and see if you get equality. $\endgroup$ – Rocket Man Nov 28 '17 at 16:53
  • $\begingroup$ I did the same and I did not get any equality. I am wondering how it is possible? Since when I plot the data has several inetrsection with the plane, but in each point(x,y,z) , I never get zero. $\endgroup$ – mvtn Nov 28 '17 at 16:55
  • $\begingroup$ Include specific details in your question instead of making everyone guess what might be going wrong. At the very least, provide the computed plane and some sample points that you think should lie on it. $\endgroup$ – amd Nov 28 '17 at 20:33
  • $\begingroup$ I added the code the picture. Thank you for your help $\endgroup$ – mvtn Nov 28 '17 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.