splitMeshesIfConcatenated method
Splits a concatenated list of mesh points into individual face meshes.
If the list length is a multiple of 468, splits into sublists of 468 points. Otherwise returns the list unchanged (wrapped in a list).
Example:
// 936 points from 2 faces → [[face1 468 pts], [face2 468 pts]]
final meshes = detector.splitMeshesIfConcatenated(allPoints);
Implementation
List<List<Point>> splitMeshesIfConcatenated(List<Point> meshPts) {
if (meshPts.isEmpty) return const <List<Point>>[];
if (meshPts.length % kMeshPoints != 0) return [meshPts];
final int faces = meshPts.length ~/ kMeshPoints;
return [
for (int i = 0; i < faces; i++)
meshPts.sublist(i * kMeshPoints, (i + 1) * kMeshPoints),
];
}