[Math] How to define a plane based on 4 points

computer sciencegeometrylinear algebraperiodic functionsplane-geometry

I have a set of points $A,B,C,D$ in 3-D space:
$$A = (x_a, y_a, z_a)$$
$$B = (x_b, y_b, z_b)$$
$$C = (x_c, y_c, z_c)$$
$$D = (x_d, y_d, z_d)$$

They belong to a 3-D figure, e.g.:

enter image description here

I'm trying to define the entire plane $ABCD$ by a set of functions, based on the points I have:

$ x(y,z)$ defines the x-coordinates on the plane, depending on y and z

$ y(x,z)$ …

$ z(x,y)$ …

I'm finding it a difficult problem. This, I think, is the best way to solve the problem, but maybe there is a better way based on basis vectors (which I also have).

The reason: I'm trying to develop a molecular dynamics software that can handle any periodic system, so I'm trying to find the way to universalize periodic boundary conditions. For example, in a simple cubic system, I would just do (this pseudocode):

move_the_particle();    
if (particle[x] < -x_length/2)
        particle[x] = particle[x] + x_length

…to check if my particle escaped the box on the left side, and move it over to the right side.

If this is unclear please let me know. I can try to clarify further.

Best Answer

A plane is defined from three points ABC using the following algorithm. How you handle the 4th point is up to you.

  1. Plane normal direction $$\mathbf{n} = (B-A) \times (C-B)$$
  2. Scalar Component $$d=-\mathbf{n} \cdot A$$
  3. Equation of plane $$ \mathbf{n}_x x+\mathbf{n}_y y+\mathbf{n}_z z = d $$

See answer to related question for how to interpret the plane equation, in terms of the properties of the plane.

Related Question