docs: int flipTriangle(int i, long[] flipped) {
      final Triangle cur = tris.get(i);
      // Test edge AB:
      if(cur.ab >= 0) {
        final int ot = cur.ab;
        Triangle oth = tris.get(ot);
        Orientation orient = cur.findOrientation(oth);
        final int opp, lef, rig;
        switch(orient){
        case ORIENT_AB_BA:
          opp = oth.c;
          lef = oth.bc;
          rig = oth.ca;
          break;
        case ORIENT_AB_CB:
          opp = oth.a;
          lef = oth.ca;
          rig = oth.ab;
          break;
        case ORIENT_AB_AC:
          opp = oth.b;
          lef = oth.ab;
          rig = oth.bc;
          break;
        default:
          throw new RuntimeException("Neighbor triangles not aligned?");
        }
        if(cur.inCircle(points.get(opp))) {
          // Replace edge AB, connect c with "opp" instead.
          final int a = cur.c, b = cur.a, c = opp, d = cur.b;
          final int ab = cur.ca, bc = lef, cd = rig, da = cur.bc;
          final int ca = ot, ac = i;
          // Update current:
          cur.set(a, ab, b, bc, c, ca);
          cur.updateCircumcircle(points);
          // Update other:
          oth.set(c, cd, d, da, a, ac);
          oth.updateCircumcircle(points);
          // Update tri touching on BC and DA:
          if(bc >= 0) {
            tris.get(bc).replaceEdge(c, b, ot, i);
          }
          if(da >= 0) {
            tris.get(da).replaceEdge(a, d, i, ot);
          }
          BitsUtil.setI(flipped, i);
          BitsUtil.setI(flipped, ot);
          return ot;
        }
      }
      // Test edge BC:
      if(cur.bc >= 0) {
        final int ot = cur.bc;
        Triangle oth = tris.get(ot);
        Orientation orient = cur.findOrientation(oth);
        final int opp, lef, rig;
        switch(orient){
        case ORIENT_BC_BA:
          opp = oth.c;
          lef = oth.bc;
          rig = oth.ca;
          break;
        case ORIENT_BC_CB:
          opp = oth.a;
          lef = oth.ca;
          rig = oth.ab;
          break;
        case ORIENT_BC_AC:
          opp = oth.b;
          lef = oth.ab;
          rig = oth.bc;
          break;
        default:
          throw new RuntimeException("Neighbor triangles not aligned? " + orient);
        }
        if(cur.inCircle(points.get(opp))) {
          // Replace edge BC, connect A with "opp" instead.
          final int a = cur.a, b = cur.b, c = opp, d = cur.c;
          final int ab = cur.ab, bc = lef, cd = rig, da = cur.ca;
          final int ca = ot, ac = i;
          // Update current:
          cur.set(a, ab, b, bc, c, ca);
          cur.updateCircumcircle(points);
          // Update other:
          oth.set(c, cd, d, da, a, ac);
          oth.updateCircumcircle(points);
          // Update tri touching on BC and DA:
          if(bc >= 0) {
            tris.get(bc).replaceEdge(c, b, ot, i);
          }
          if(da >= 0) {
            tris.get(da).replaceEdge(a, d, i, ot);
          }
          BitsUtil.setI(flipped, i);
          BitsUtil.setI(flipped, ot);
          return ot;
        }
      }
      // Test edge CA:
      if(cur.ca >= 0) {
        final int ot = cur.ca;
        Triangle oth = tris.get(ot);
        Orientation orient = cur.findOrientation(oth);
        final int opp, lef, rig;
        switch(orient){
        case ORIENT_CA_BA:
          opp = oth.c;
          lef = oth.bc;
          rig = oth.ca;
          break;
        case ORIENT_CA_CB:
          opp = oth.a;
          lef = oth.ca;
          rig = oth.ab;
          break;
        case ORIENT_CA_AC:
          opp = oth.b;
          lef = oth.ab;
          rig = oth.bc;
          break;
        default:
          throw new RuntimeException("Neighbor triangles not aligned?");
        }
        if(cur.inCircle(points.get(opp))) {
          // Replace edge CA, connect B with "opp" instead.
          final int a = cur.b, b = cur.c, c = opp, d = cur.a;
          final int ab = cur.bc, bc = lef, cd = rig, da = cur.ab;
          final int ca = ot, ac = i;
          // Update current:
          cur.set(a, ab, b, bc, c, ca);
          cur.updateCircumcircle(points);
          // Update other:
          oth.set(c, cd, d, da, a, ac);
          oth.updateCircumcircle(points);
          // Update tri touching on BC and DA:
          if(bc >= 0) {
            tris.get(bc).replaceEdge(c, b, ot, i);
          }
          if(da >= 0) {
            tris.get(da).replaceEdge(a, d, i, ot);
          }
          BitsUtil.setI(flipped, i);
          BitsUtil.setI(flipped, ot);
          return ot;
        }
      }
      return -1;
    }