# how to find the points that crossed the plane?

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?

• points on the plane will satisfy the plane's equation – Vasya Nov 28 '17 at 16:51
• 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. – Rocket Man Nov 28 '17 at 16:53
• 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. – mvtn Nov 28 '17 at 16:55
• 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. – amd Nov 28 '17 at 20:33
• I added the code the picture. Thank you for your help – mvtn Nov 28 '17 at 21:51