lunes, 4 de junio de 2018

Three points for a plane

Plane determined by...

three points


The following is a Python 3.7 program. It must be previously installed.

#Equation of a plane, (Ax + By + Cz + D = 0) known three of its points
#(a, b, c), (d, e, f,), (g, h, t)

print('type, one at a time, a, b, c, d, e, f, g, h, t')

a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())
f = float(input())
g = float(input())
h = float(input())
t = float(input())

A=b*f+c*h+e*t-f*h-c*e-b*t
B=-a*f-c*g-d*t+f*g+c*d+a*t
C=a*e+b*g+d*h-b*d-e*g-a*h
D=a*e*t+b*f*g+c*d*h-c*e*g-b*d*t-a*f*h
    
print('lthe equation of the plane is')
print(A,'x+',B,'y+',C,'z+',D,'=0')


Example (1). For (-3, 1, -2), (5, -4, -1), (4, 5, 2)

-3
1
-2
5
-4
-1
4
5
2
the equation of the plane is
-24.0 x+ -25.0 y+ 67.0 z+ -87.0 =0

This equation could be rewritten as 24x + 25y - 67z -87 = 0.

Example(2): For (2, 3, 1), (4, -2, 5), (6, 1, 6)

2
3
1
4
-2
5
6
1
6
the equation of the plane is
-17.0 x+ 6.0 y+ 16.0 z+ 0.0 =0
This equation could be rewritten as 17x - 6y -16z = 0  (The point (0, 0, 0) is in the plane)

Example (3):For (1, -2, 5), (13, 7, 11), 37, 25, 23)

1
-2
5
13
7
11
37
25
23
1
-2
5
13
7
11
37
25
23
the equation of the plane is
0.0 x+ 0.0 y+ 0.0 z+ 0.0 =0

That is, 0x + 0y + 0z + 0 = 0

In this case, the three given points are collinear 

No hay comentarios:

Publicar un comentario