views:

186

answers:

2

Hi, all.I want to find a 3D plane equation given 3 points.I have got the normal calculated after applying the cross product. But the equation of a plane is known to be the normal multiply by another vector which what i am taught to be as P.OP. I substitute my main reference point as OP and i want P to be in (x, y, z) form. So that i can get something like e.g, OP = (1, 2, 3) I want to get something like that: (x-1) (y-2) (z-3) May i know how? Below is my reference code.(Note: plane_point_1_x(), plane_point_1_y(), plane_point_1_z() are all functions asking for the user input of the respective points)

"""
I used Point P as my reference point so i will make use of it in this section
"""

vector_pop_x = int('x') - int(plane_point_1_x())
vector_pop_y = int('y') - int(plane_point_1_y())
vector_pop_z = int('z') - int(plane_point_1_z())

print vector_pop_x, vector_pop_y, vector_pop_z

All the above is what i did, but for some reason it did not work. I think the problem lies in the x, y , z part. Hope you guys can help. Thanks!

+2  A: 

Plane implicit Eqn:

All points P = (x, y, z) satisfying

<n, QP> = 0

where

  • n is the plane normal vector,
  • Q is some point on the plane (any will do)
  • QP is the vector from Q to P
  • <a, b> is the scalar (dot) product operator.

(Remember that QP can be computed as P - Q)

Alex
+2  A: 

One good way is:

| x1 y1 z2 1 |
| x2 y2 z2 1 |
| x3 y3 z3 1 | = 0
| x  y  z  1 |

Where the vertical pipes mean the determinant of the matrix, and (x1 y1 z1), (x2 y2 z2), and (x3 y3 z3) are your given points.

pavpanchekha
how do i define a variable to it? And may i know how does it work in python? Sorry for the newbie question because i do not really understand it and it does not seem to be working, maybe i did it wrongly or something
blur959
The plane is the set of all points `(x y z)` that satisfy this equation. So, if you have your three reference points, plug them in, and you can test any other point for being on the plane with the above equation. Or, if you have, say, the point's `x` and `y` coordinates, you can solve for the other.
pavpanchekha