edgesOf static method
The unique edges of the triangles in indices, as index pairs.
Implementation
static Uint32List edgesOf(List<int> indices) {
final seen = <int>{};
final out = <int>[];
for (var t = 0; t + 2 < indices.length; t += 3) {
for (var k = 0; k < 3; k++) {
final a = indices[t + k], b = indices[t + (k + 1) % 3];
final lo = a < b ? a : b, hi = a < b ? b : a;
if (seen.add(lo * 0x100000000 + hi)) {
out
..add(lo)
..add(hi);
}
}
}
return Uint32List.fromList(out);
}