# the intersection of the tetrahedra

Why not formulate a convex optimization problem, or precisely a feasibility problem using the plane inequalities that you have? Let’s say, the two tetrahedra can be represented as `A1.X + d1 <= 0` and `A2.X + d2 <= 0` where the 4 rows of `A1` and `A2` store the `a, b, c` of four planes corresponding to the two tetrahedra in `ax + by + cz + d <= 0`, and column vectors `d1` and `d2` store the constants ie `d`. And also note that `A1.X` is matrix multiplication.

Represent `(x, y, z)` as the vector `X`.

Now basically you want to solve a feasibility problem for `X` like this:

``````minimize 0
subject to A1.X + d1 <= 0
A2.X + d2 <= 0
``````

Note that if the solver returns `inf`, that means there is no `X` which satisfies the above constraints. If the solver returns `0` (which is the value of the constant objective function), that means there is atleast one `X` which satisfies the constraints.

You can use `cvxpy` library for this. Here is a nice tutorial. Also `cvxpy` library goes well with `numpy`.

And I don’t think solving equations would work in this case as a tetrahedron is basically composed of four linear inequalities. So you have to solve inequalities in order to find a solution in their intersection region.