## Editorial for UTS Open '15 #6 - Tetrahedra

**only**when stuck, and

**not to copy-paste code from it**. Please be respectful to the problem author and editorialist.

**Submitting an official solution before solving the problem yourself is a bannable offence.**

Let's solve each face separately, taking the base area of the face and subtracting the area of the portion of the face which lies inside the other tetrahedron.

Suppose our face is defined by the points , , . The base area is:

The face lies on the plane defined by the point and the normal vector :

(Editor's note: the paragraphs about getting the enclosed area might be bullshit)

To find the area of the portion enclosed by the other tetrahedron, consider every pair of points and from the other tetrahedron. If they lie on opposite sides of (that is, , project the line onto and add the projection to the set of points .

Since , , , and the members of all lie on , we can redefine each point to make the problem 2D. Define and as follows:

Then, for a point , its new x-coordinate is and its new y-coordinate is .

The intersection of the projection and the triangle is a polygon defined by every point such that:

- and is inside , or
- and is inside , or
- is at the intersection of the border of and the border of

We can find the area of this polygon with the Shoelace Theorem. Subtract it from the base area calculated above to find your answer.

Complexity:

## Comments