1

I am trying to calculate the circumcenter of a tetrahedron in 4 dimensional space. Basically what I am looking for is the center of the smallest sphere which passes through all 4 vertices of the tetrahedron. I have searched online but can't seem to find any specific formula for this. My overall aim is to find the circumcenter and check if any other point within a given data set lies within the sphere constructed around the vertices of the tetrahedron. Similar to how the Delaunay triangulation works. Note that the tetrahedron can be a regular tetrahedron and also an irregular tetrahedron.

Currently I am using a custom optimization function which uses a GA to locate a point which is equidistant from all 4 vertices. However, this doesn't always find the smallest enclosing sphere. I was hoping for some concrete mathematical formula which can make this calculation more accurate.

user1234
  • 115
  • 1
  • 9
  • 3
    Think you might be better on math.stackexchange.com/ mate – Tony Hopkinson May 24 '15 at 09:00
  • Hm. You probably need to find a 4D rotation that transforms all four coordinates into the subspace `{(x,y,z,C) : x,y,z in R}` for some fixed `C`, then you can find the circumcenter using the built in `triangulation.circumcenter`, after that reapply the inverse rotation to the circumcenter. – knedlsepp May 24 '15 at 12:25
  • You said "passes through all 4 vertices of the tetrahedron" and then "smallest enclosing sphere". Which one do you want? The smallest enclosing sphere does not necessarily pass through all 4 vertices. –  May 26 '15 at 21:30
  • I want the smallest sphere which passes through all 4 vertices. – user1234 May 27 '15 at 20:50

1 Answers1

1

I don't know an explicit formula (and if one exists, it's probably not easy to digest), but it's easy to get the center as a result of solving a small linear system -- without optimization algorithms. Given points P1, P2, P3, P4, apply translation so that P1 becomes the origin. The center of any sphere containing P1,...,P4 will have the property of being equidistant: from P1 and P2; from P1 and P3; from P1 and P4. Each of these is a linear equation. There are 3 equations for 4 unknowns, so the system is underdetermined. The solution you want is the one of smallest norm (the least squares solution). This is not the solution that backslash operator gives, but one can use pinv to get it, which for small matrices isn't costly.

p1 = rand(1,4); p2 = rand(1,4); p3 = rand(1,4); p4 = rand(1,4);  % test input
v = [p2-p1; p3-p1; p4-p1];       % matrix of linear system
b = 0.5*[v(1,:)*v(1,:)' ; v(2,:)*v(2,:)' ; v(3,:)*v(3,:)'];  % RHS of the system
x = p1 + (pinv(v)*b)'    % least squares solution, translated back

You can check that norm(x-p1)...norm(x-p4) are equal.

  • The code in my answer runs in Matlab without any toolboxes; `pinv` is a standard Matlab command. –  Jun 07 '15 at 01:02
  • In 4 dimensions there can infinite number of spheres passing through a tetrahedron. Does this approach find the smallest sphere or near smallest sphere? – user1234 Jun 07 '15 at 01:12
  • Yes, because the radius of the sphere is the norm of x, and `pinv(v)*b` [gives the solution with the smallest norm](http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse#Minimum_norm_solution_to_a_linear_system). –  Jun 07 '15 at 01:16
  • Also how can I go about extending this for say finding the circumcenter of a 4-simplex(having 5 vertices) in 5 dimensions. – user1234 Jun 07 '15 at 01:18
  • Exactly the same way, just insert one more row `p5-p1` into matrix v, and one more entry `v(4,:)*v(4,:)'` into vector b. –  Jun 07 '15 at 01:20
  • One last question, if I were to find the circumcenter of say a tetrahedron in 5 dimensional or 3-dimensional space...will the formula given above remain the same? – user1234 Jun 07 '15 at 01:37