bevelledCube function

EditMesh bevelledCube()

A cube with every edge given a shallow, flat bevel.

mesh-44's own acceptance is the vertex and face count on exactly this shape; this is the same construction kept as a picture, since a count cannot say whether a corner cap landed at the right valence or a bridge quad came out inverted.

Implementation

EditMesh bevelledCube() {
  final mesh = EditMesh.cuboid();
  final edges = <int>[
    for (var half = 0; half < mesh.halfEdgeSlotCount; half++)
      if (mesh.edgeOf(half) == half && mesh.faceOf(half) != EditMesh.none) half,
  ];
  mesh.beginStep();
  bevelEdges(mesh, Selection.of(ElementLevel.edge, edges), width: 0.12);
  mesh
    ..endStep()
    ..clearJournal();
  return mesh;
}