Circumcircle of Triangle

My ultimate goal in the use of this is to implement my own code to use for the Delaunay Triangulation algorithm. I hear all this talk about needing to find the circumcircle of a triangle and I am unsure about how to do this. I know I need to get the perpendicular bisector of each side and find where they intersect. I thought maybe I could get away with averaging each point but upon visual inspection it was not that easy. Any help in this regard would be greatly appreciated. I like math and am halfway decent at math but never could get the hang of understanding long math formulas. Thank you all.

not sure some p5.js code helps, just take a look circum_circle

today ( and in processing JAVA ) i would try use PVector for the points.

Thank you very much for your response. I will try to port it to processing JAVA tomorrow when I get a moment.

You might also be interested in looking at the implementation of Delaunay Triangulation in the Mesh library.

this code worked for me:

    // * calculate circumcenter
    PVector a = points.get(vxs[0]).vx;  //these are the three vertices of the triangle
    PVector b = points.get(vxs[1]).vx;
    PVector c = points.get(vxs[2]).vx;
    PVector ab = PVector.sub(b, a);
    PVector ac = PVector.sub(c, a);
    PVector c1 = ab.cross(ac);
    PVector c2 = ac.cross(ab);
    float d1 = PVector.dist(a, c1); // I don't actually remember why I needed to calculate both distances
    float d2 = PVector.dist(a, c2);
    if (d1<d2) {
      cc = c1;  // cc is the circumcircle
    } else {
      cc = c2;
    }
    cc.normalize();

In my case all the vertices were normalized 3D vectors, so they all (including the calculated circumcircle were lying on a sphere of 1.0 radius with the center in the (0, 0, 0).

1 Like