plane equation wrong by a minus sometimes

crackit

New member
Joined
Sep 23, 2017
Messages
7
Hi, I am having signing issues in finding the equation of a plane. Typically i will check my
work http://www.ambrsoft.com/TrigoCalc/Plan3D/Plane3D_.htm and other sites and confirm my results which are usually right leading me to beleive i have solved it until I hit a data point that proves me otherwise. I think it may be something simple, going on with my D constant.

code to calculate, but can do longhand also:

glm::vec3 PQv(Qx1-Px1,Qy1-Py1,Qz1-Pz1);
glm::vec3 PRv(Rx1-Px1,Ry1-Py1, Rz1-Pz1);
glm::vec3 res = cross(PQv, PRv);
print_vector(PQv, "PQv ");
print_vector(PRv, "PRv ");
print_vector(res,"PQv x PRv result (dot cross product) Vn: ");
std::cout<<std::endl;
float A = res[0], B = res[1], C = res[2];
float D = 0;
std::cout<<A<<"x"<<B<<"y"<<C<<"z - D = 0"<<std::endl;
std::cout<<"multiply all terms by -1:"<<std::endl;
A = A *(-1);
B = B *(-1);
C = C *(-1);
//find d sub point P(x,y,z)
//flip D sign (pending)
std::cout<<"equation of plane is:"<<std::endl;
D = (A*Px1)+(B*Py1)+(C*Pz1);
D = D * -1; //as per above
std::cout<<A<<"x"<<B<<"y"<<C<<"z"<<D<<" = 0"<<std::endl;

I had no way to sign D until time of use.

The data set below I get different signs on the
http://www.ambrsoft.com/TrigoCalc/Plan3D/Plane3D_.htm site versus my own.

The data set:

pt. x (2,1,3)
pt. y (1,3,2)
pt. z (-1,2,4)

-3x-4y-5z + 25 = 0

versus

3x + 4y + 5z -25 = 0

I got the workup here, including the instruction to multiply the terms by -1:
Find the equation of a plane that passes through the points (1,0, 2), (-3, 5, 0) and (6, - 4, 2).
we choose the point (1, 0, 2) as the origin of the axes and will solve by vector method.
There are two vectors extending from the origin to the other two points:
V1 = (-3 - 1)i + (5 - 0)j + (0 - 2)k = -4i +5j -2k
V2 = (6 - 1)i + (-4 - 0)j + (2 - 2)k = 5i - 4j
The cross product of this two vectors gives the general direction of the perpendicular vector to the plane, this is also the direction coefficients of the plane.
eq15.png
here
Therefore the plane equation is: 8x + 10y + 9z + D = 0 (after multiplying all terms by -1)
Now D should be found, the origin point fulfills the plane equation so: 8*1 + 10*0 + 9*2 + D = 0
And the plane equation is: 8x + 10y + 9z − 26 = 0
 
Last edited:
My thread somehow got erased while I was looking at it. Sigh.Receap:

I am having sign issues with my workup for determination of the equation of a plane, using 3 points (ax + by + cz + D = 0). I know this is happening because I check my work on other sites, this in particular:

http://www.ambrsoft.com/TrigoCalc/Plan3D/Plane3D_.htm

Just when I think I've got it, I get a different result from my own (by a minus):

p(2,1,3)
p(1,3,2)
p(-1,2,4)

The website algorithm produced: 3x+4y+5z - 25 = 0
My algorithm: -3x+4y+5z+25 = 0:

glm::vec3 PQv(Qx1-Px1,Qy1-Py1,Qz1-Pz1);
glm::vec3 PRv(Rx1-Px1,Ry1-Py1, Rz1-Pz1);
glm::vec3 res = cross(PQv, PRv);
print_vector(PQv, "PQv ");
print_vector(PRv, "PRv ");
print_vector(res,"PQv x PRv result (dot cross product) Vn: ");
std::cout<<std::endl;
float A = res[0], B = res[1], C = res[2];
float D = 0;
std::cout<<A<<"x"<<B<<"y"<<C<<"z - D = 0"<<std::endl;
std::cout<<"multiply all terms by -1:"<<std::endl;
A = A *(-1);
B = B *(-1);
C = C *(-1);
//find d sub point P(x,y,z)
//flip D sign (pending)
std::cout<<"equation of plane is:"<<std::endl;
D = (A*Px1)+(B*Py1)+(C*Pz1);
D = D * -1; //as per above
std::cout<<A<<"x"<<B<<"y"<<C<<"z"<<D<<" = 0"<<std::endl;

This excerpt says to sign the cross result Why? FYI getting the same normal vector as below.:

eq15.png
Therefore the plane equation is: 8x + 10y + 9z + D = 0 (after multiplying all terms by -1)
 
and my reply started a new thread. who would ave thunk.

Not quite sure of what you are doing but looks maybe like you have two vectors in a plane so you do the cross product to find the normal vector and then want to compute the D of
A x + B y + C z + D = 0

If so, you have a sign wrong on D. Look at
https://en.wikipedia.org/wiki/Plane_...ion_of_a_plane
 
key question

HI, (err yes, its all here. Hopeful the more recent ones are more helpful. Great site)

This is a key question:

eq15.png


Therefore the plane equation is: 8x + 10y + 9z + D = 0 (after multiplying all terms by -1)

Why multiply all terms by -1 (see above)?

Sorry for my thread issues.
 
Last edited:
Can kill it.
Done. There was a temporary issue with your third thread, but I found a way to force the forum software to behave. I hope everything is good, going forward. (The vBulletin software has bugs; apologies -- we deal with these regularly.)
 
It appears that if I run my point input backwards I lose the signing issue for the problems that have them. The equations are the same result when I sub. the same values for the 2 equations. Technically it shouldn't matter the order in which you supply the points and I proved that by empirical testing.
 
Top