resolveUnassignedPoints method
Implementation
ConvexHull resolveUnassignedPoints(List<Face2> newFace2s) {
if (unassigned.isEmpty() == false) {
VertexNode? vertex = unassigned.first();
do {
// buffer 'next' reference, see .deleteFace2Vertices()
var nextVertex = vertex!.next;
var maxDistance = tolerance;
Face2? maxFace2;
for (var i = 0; i < newFace2s.length; i++) {
var face = newFace2s[i];
if (face.mark == visible) {
var 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;
}