UTS Open '15 #6 - Tetrahedra

View as PDF

Submit solution


Points: 40 (partial)
Time limit: 0.6s
Memory limit: 64M

Author:
Problem type

Ms. Evans is creating a new, eye-catching design for her company headquarters. She thinks the Royal Ontario Museum is really cool, so she has modeled her design after its jumbled-together look:

Picture of the ROM

Specifically, the shape of the headquarters will be the union of two tetrahedra. Ms. Evans will cover the outside entirely with glass, and she wants to know how much glass she will need. What is the surface area of the headquarters?

Input Specification

The input will consist of 8 lines, each line specifying a point with 3 integer coordinates in the range [0,1000]. The first 4 lines describe the vertices of the first tetrahedron; the last 4 lines describe the second tetrahedron.

Output Specification

A single line containing the answer to the problem. Your answer will be considered correct if its absolute or relative error does not exceed 10^{-6}.

Note

The input will satisfy the following conditions:

  • No three of the specified points will lie on a line.
  • Both tetrahedra will have positive volume.
  • Let a_1 be a vertex of a tetrahedron and let b_1,b_2,b_3 be vertices of the other tetrahedron. It is guaranteed that a_1 does not lie on the plane formed by b_1,b_2,b_3.
  • Let a_1,a_2 be vertices of a tetrahedron and let b_1,b_2 be vertices of the other tetrahedron. It is guaranteed that the line passing through a_1 and a_2 does not intersect the line passing through b_1 and b_2.

Partial Marks

In test cases worth 10% of the points, the tetrahedra will not intersect.

Sample Input 1

1 17 12
13 9 4
102 7 7
76 32 42
500 500 500
502 500 500
500 501 500
503 501 504

Sample Output 1

5122.604324

Explanation for Sample Output 1

The tetrahedra do not intersect, so the answer is the sum of their surface areas.

Sample Input 2

0 0 0
10 0 0
0 10 0
0 0 10
1 1 1
2 1 1
1 2 1
1 1 2

Sample Output 2

236.6025404

Explanation for Sample Output 2

The second tetrahedron is completely enclosed by the first tetrahedron, so the answer is the surface area of the first tetrahedron.

Sample Input 3

0 0 0
10 0 0
5 5 0
5 5 6
15 2 1
-4 10 4
-10 4 12
-3 -11 3

Sample Output 3

700.85581333

Picture for Sample Input 3

3D model of Sample Input 3

Sample Input 4

2 0 0
0 2 0
4 1 0
2 2 3
2 0 2
0 2 2
4 1 2
2 2 5

Sample Output 4

35.50054500

Picture for Sample Input 4

3D model of Sample Input 4


Comments


  • 1
    gavin_chen  commented on March 28, 2022, 11:26 p.m.

    Michael Lee-Chin Crystal Building in Toronto, Ontario