I want to find the circumcenter of a triangle. Wolfram only shows how to find the circumcircle of a triangle in R2. How can I find the circumcenter of a triangle in R3?

  • \$\begingroup\$ You can define a plane using the 3 points of a triangle and then the problem is back into R^2 for which you already know the method. \$\endgroup\$ – Ani Aug 12 '13 at 9:14
  • \$\begingroup\$ @Ani The formulae for circumcircle involve only x and y, but a 3D triangle, in 3-space plane, uses x, y and z variables. \$\endgroup\$ – bobobobo Aug 12 '13 at 15:14
  • \$\begingroup\$ what I meant was a unique plane can be defined using the 3 vertex of the triangle and in that reference plane, the triangle is 2D. This will however require appropriate transforms (which I did not elaborate) and hence just put this as a guiding comment rather than answer \$\endgroup\$ – Ani Aug 13 '13 at 9:56
  • \$\begingroup\$ Yes, in fact I thought I was going to have to rotate the triangle to the xy/xz/yz plane, then apply the 2d formula. Hence why I shared the Triangle in R^3 formula I found at Geometry Junkyard below \$\endgroup\$ – bobobobo Aug 13 '13 at 14:36

The circumcenter of a triangle can be found by the following formula, which I mined from an old posting by Jonathan Shewchuk from the Geometry Junkyard

    Triangle in R^3:

        |c-a|^2 [(b-a)x(c-a)]x(b-a) + |b-a|^2 (c-a)x[(b-a)x(c-a)]
m = a + ---------------------------------------------------------.
                           2 | (b-a)x(c-a) |^2

Where m is the circumcenter of the triangle.

Some C++ code, given Vector3f's with overloaded +, -,

Vector3f a,b,c // are the 3 pts of the tri

Vector3f ac = c - a ;
Vector3f ab = b - a ;
Vector3f abXac = ab.cross( ac ) ;

// this is the vector from a TO the circumsphere center
Vector3f toCircumsphereCenter = (abXac.cross( ab )*ac.len2() + ac.cross( abXac )*ab.len2()) / (2.f*abXac.len2()) ;
float circumsphereRadius = toCircumsphereCenter.len() ;

// The 3 space coords of the circumsphere center then:
Vector3f ccs = a  +  toCircumsphereCenter ; // now this is the actual 3space location

Here is a picture of a triangle and its circumsphere

enter image description here

  • \$\begingroup\$ Dude, you just saved me after whole day of guessing good algorithm. Bless you. \$\endgroup\$ – Cheshire Cat Aug 1 '16 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.