removeFace static method

void removeFace(
  1. Tri f,
  2. List<Tri> faces
)

Implementation

static void removeFace(Tri f, List<Tri> faces ) {
  removeFromArray( faces, f );

  if(f.v1 != null) removeFromArray(f.v1?.faces, f);
  if(f.v2 != null) removeFromArray(f.v2?.faces, f);
  if(f.v3 != null) removeFromArray(f.v3?.faces, f);

  // TODO optimize this!
  final vs = [f.v1, f.v2, f.v3];

  for(int i = 0; i < 3; i ++){
    final v1 = vs[i];
    final v2 = vs[(i + 1) % 3];

    if(v1 == null || v2 == null) continue;
    v1.removeIfNonNeighbor(v2);
    v2.removeIfNonNeighbor(v1);
  }
}