Intersection of a hyperplane with a polytope (intersection in 9D)
Hi,
I have a hyperplane given by equation:
2/3x1 + 2/3x2 + 2/3x3 - 1/3x4 - 1/3x5 - 1/3x6 - 1/3x7 -1/3x8 - 1/3*x9 = 1
and a polytope with nine vertices:
P = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [-8/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9], [-7/9, -7/9, 2/9, 2/9, 2/9, 2/9, 2/9, 2/9, 2/9], [-2/3, -2/3, -2/3, 1/3, 1/3, 1/3, 1/3, 1/3, 1/3], [-5/9, -5/9, -5/9, -5/9, 4/9, 4/9, 4/9, 4/9, 4/9], [-4/9, -4/9, -4/9, -4/9, -4/9, 5/9, 5/9, 5/9, 5/9], [-1/3, -1/3, -1/3, -1/3, -1/3, -1/3, 2/3, 2/3, 2/3], [-2/9, -2/9, -2/9, -2/9, -2/9, -2/9, -2/9, 7/9, 7/9], [-1/9, -1/9, -1/9, -1/9, -1/9, -1/9, -1/9, -1/9, 8/9]]
Each vertex in this polytope is connected to other eight vertices with a line.
I have tried with the following approach but I am unable to get the correct result.
First I created a polyhedron from the equation of the hyperplane as follows:
Hplane1 = Polyhedron(eqns=[(-3,2,2,2,-1,-1,-1,-1,-1,-1)])
Next I used this code to find the intersection between hyperplane and the line connected by every two vertices of the Polytope 'P'
for j in range(len(P)):
for i in range(len(P)):
if i != j:
a = Polyhedron( vertices = [P[i], P[j]])
b = a.intersection(Hplane1)
print(b)
I know the this hyperplane and the polytope have some intersection points but I am unable to calculate them. Any help/suggestion will be highly appreciated.
Thanks