resolveUnassignedPoints method
Implementation
ConvexHull resolveUnassignedPoints(List<Face2> newFace2s) {
if (unassigned.isEmpty() == false) {
VertexNode? vertex = unassigned.first();
do {
// buffer 'next' reference, see .deleteFace2Vertices()
final nextVertex = vertex!.next;
num maxDistance = tolerance;
Face2? maxFace2;
for (int i = 0; i < newFace2s.length; i++) {
final face = newFace2s[i];
if (face.mark == visible) {
final distance = face.distanceToPoint(vertex.point);
if (distance > maxDistance) {
maxDistance = distance;
maxFace2 = face;
}
if (maxDistance > 1000 * tolerance) break;
}
}
// 'maxFace2' can be null e.g. if there are identical vertices
if (maxFace2 != null) {
addVertexToFace2(vertex, maxFace2);
}
vertex = nextVertex;
} while (vertex != null);
}
return this;
}