Program: 70649
Project: 70649
Buggy source:
private static HalfEdge edgeSplit3(HalfEdge edge){
  Face f=edge.face;
  f.he0=edge;
  Vertex3d head=edge.head;
  Vertex3d tail=edge.tail;
  Vertex3d vtp=edge.next.head;
  HalfEdge edgeOpp=edge.opposite;
  boolean hard=edge.isHard();
  Point3d tpos=tail.getPosition();
  Vector3d dir=new Vector3d(head.getPosition());
  dir.sub(tpos);
  dir.scale(1.0 / 3);
  Vertex3d vt0=new Vertex3d(tpos.x + dir.x,tpos.y + dir.y,tpos.z + dir.z);
  Vertex3d vt1=new Vertex3d(tpos.x + 2 * dir.x,tpos.y + 2 * dir.y,tpos.z + 2 * dir.z);
  PolygonalMesh mesh=f.getMesh();
  mesh.addVertex(vt0);
  mesh.addVertex(vt1);
  if (edgeOpp != null) {
    edge.opposite=null;
    edgeOpp.opposite=null;
    edge.setPrimary(true);
    edgeOpp.setPrimary(true);
    Face of=edgeOpp.getFace();
    Vertex3d ovtp=edgeOpp.next.head;
    if (of.isTriangle()) {
      HalfEdge hprev=edgeOpp.next.next;
      if (hprev.opposite != null) {
        hprev.opposite.setPrimary(true);
        hprev.opposite.opposite=null;
        hprev.opposite=null;
        hprev.setPrimary(true);
      }
      hprev.setHard(false);
      head.removeIncidentHalfEdge(hprev);
      hprev.head=vt0;
      edgeOpp.tail=vt0;
      vt0.addIncidentHalfEdge(hprev);
    }
 else {
      mesh.removeFaceFast(of);
      Face f0=mesh.addFace(tail,ovtp,vt0);
      edgeOpp=f0.he0;
      edgeOpp.setHard(hard);
    }
    Face f1=mesh.addFace(vt1,ovtp,head);
    f1.he0.setHard(hard);
    Face f2=mesh.addFace(vt0,ovtp,vt1);
    f2.he0.setHard(hard);
  }
  if (f.isTriangle()) {
    HalfEdge hnext=edge.next;
    if (hnext.opposite != null) {
      hnext.opposite.setPrimary(true);
      hnext.opposite.opposite=null;
      hnext.opposite=null;
      hnext.setPrimary(true);
    }
    hnext.setHard(false);
    head.removeIncidentHalfEdge(edge);
    edge.head=vt0;
    hnext.tail=vt0;
    vt0.addIncidentHalfEdge(edge);
  }
 else {
    mesh.removeFaceFast(f);
    Face f0=mesh.addFace(vt0,vtp,tail);
    edge=f0.he0;
    edge.setHard(hard);
  }
  Face f1=mesh.addFace(vt1,vtp,vt0);
  f1.he0.setHard(hard);
  Face f2=mesh.addFace(head,vtp,vt1);
  f2.he0.setHard(hard);
  edge.opposite=edgeOpp;
  if (edgeOpp != null) {
    edgeOpp.opposite=edge;
    edgeOpp.setPrimary(false);
  }
  return edge;
}

Fixed version (ground truth):
private static HalfEdge edgeSplit3(HalfEdge edge){
  Face f=edge.face;
  f.he0=edge;
  Vertex3d head=edge.head;
  Vertex3d tail=edge.tail;
  Vertex3d vtp=edge.next.head;
  HalfEdge edgeOpp=edge.opposite;
  boolean hard=edge.isHard();
  Point3d tpos=tail.getPosition();
  Vector3d dir=new Vector3d(head.getPosition());
  dir.sub(tpos);
  dir.scale(1.0 / 3);
  Vertex3d vt0=new Vertex3d(tpos.x + dir.x,tpos.y + dir.y,tpos.z + dir.z);
  Vertex3d vt1=new Vertex3d(tpos.x + 2 * dir.x,tpos.y + 2 * dir.y,tpos.z + 2 * dir.z);
  PolygonalMesh mesh=f.getMesh();
  mesh.addVertex(vt0);
  mesh.addVertex(vt1);
  if (edgeOpp != null) {
    edge.opposite=null;
    edgeOpp.opposite=null;
    edge.setPrimary(true);
    edgeOpp.setPrimary(true);
    Face of=edgeOpp.getFace();
    Vertex3d ovtp=edgeOpp.next.head;
    if (of.isTriangle()) {
      HalfEdge hprev=edgeOpp.next.next;
      if (hprev.opposite != null) {
        hprev.opposite.setPrimary(true);
        hprev.opposite.opposite=null;
        hprev.opposite=null;
        hprev.setPrimary(true);
      }
      hprev.setHard(false);
      head.removeIncidentHalfEdge(hprev);
      hprev.head=vt0;
      edgeOpp.tail=vt0;
      vt0.addIncidentHalfEdge(hprev);
    }
 else {
      mesh.removeFaceFast(of);
      Face f0=mesh.addFace(tail,ovtp,vt0);
      edgeOpp=f0.he0;
      edgeOpp.setHard(hard);
    }
    Face f1=mesh.addFace(vt1,ovtp,head);
    f1.he0.setHard(hard);
    Face f2=mesh.addFace(vt0,ovtp,vt1);
    f2.he0.setHard(hard);
  }
  if (f.isTriangle()) {
    HalfEdge hnext=edge.next;
    if (hnext.opposite != null) {
      hnext.opposite.setPrimary(true);
      hnext.opposite.opposite=null;
      hnext.opposite=null;
      hnext.setPrimary(true);
    }
    hnext.setHard(false);
    head.removeIncidentHalfEdge(edge);
    edge.head=vt0;
    hnext.tail=vt0;
    vt0.addIncidentHalfEdge(edge);
  }
 else {
    mesh.removeFaceFast(f);
    Face f0=mesh.addFace(vt0,vtp,tail);
    edge=f0.he0;
    edge.setHard(hard);
  }
  Face f1=mesh.addFace(vt1,vtp,vt0);
  f1.he0.setHard(hard);
  Face f2=mesh.addFace(head,vtp,vt1);
  f2.he0.setHard(hard);
  edge.opposite=edgeOpp;
  edge.setPrimary(true);
  if (edgeOpp != null) {
    edgeOpp.opposite=edge;
    edgeOpp.setPrimary(false);
  }
  return edge;
}