Saturday, November 3, 2012

Volume of Tetrahedron From Length of Edges

Calculating volume of tetrahedron from its coordinates is easy. But, finding its volume from its edge-lengths made me to scratch my head. 
After googling out a lot, I found this Piero della Francesca’s Tetrahedron Formula. The painter Piero della Francesca (who died in 1492) also studied mathematics, gave the formula for volume of a general tetrahedron with edges a,b,c,d,e,f, taken in opposite pairs (a,f), (b,e), (c,d).

     _________a_________      _________f_________
     \                 /      \                 /
     \ \             / /      \ \             / /
      \  \e       d/  /        \  \e       d/  /
       \   \     /   /          \   \     /   /
        \    \ /    /            \    \ /    /
        c\    |    /b            c\    |    /b
          \   |   /                \   |   /
           \  |f /                  \  |a /
            \ | /                    \ | /
             \|/                      \|/
 
Letting A,B,..,F denote the squares of these respective edge lengths, his formula was
144 V^2  = - ABC - ADE - BDF - CEF + ACD + BCD + ABE + BCE
           + BDE + CDE + ABF + ACF + ADF + CDF + AEF + BEF
           - CCD - CDD - BBE - BEE - AAF - AFF
for first tetrahedron
and,
144 V^2  = - ABD - ACE - BCF - DEF + ACD + BCD + ABE + BCE
           + BDE + CDE + ABF + ACF + ADF + CDF + AEF + BEF
           - CCD - CDD - BBE - BEE - AAF - AFF 
for the second possible tetrahedron.

Notice edges a and f are swapped to form second tetrahedron from first. Hence we have to take care of the length of sides to use correct formula. For solving the problem mentioned on CodeChef second formula can be used taking the input in the order of  a,b,c,d,e,f.
The surface area can be easily calculated by summing area of all three triangle which can be calculated using Heron’s formula.