// Now, in all segments, replace all occurrences of vertices in lost_vertices with remap_vertices
// Put the one segment we know are being modified into the validation list.
// Note: seg1 does not require a full validation, only a validation of the affected side. Its vertices do not move.
nv = 1;
validation_list[0] = seg2 - Segments;
for (v=0; v<4; v++)
for (s=0; s<=Highest_segment_index; s++)
if (Segments[s].segnum != -1)
for (sv=0; sv<MAX_VERTICES_PER_SEGMENT; sv++)
if (Segments[s].verts[sv] == lost_vertices[v]) {
Segments[s].verts[sv] = remap_vertices[v];
// Add segment to list of segments to be validated.
for (s1=0; s1<nv; s1++)
if (validation_list[s1] == s)
break;
if (s1 == nv)
validation_list[nv++] = s;
Assert(nv < MAX_VALIDATIONS);
}
// Form new connections.
seg1->children[side1] = seg2 - Segments;
seg2->children[side2] = seg1 - Segments;
// validate all segments
validate_segment_side(seg1,side1);
for (s=0; s<nv; s++) {
validate_segment(&Segments[validation_list[s]]);
remap_side_uvs(&Segments[validation_list[s]],remap_vertices); // remap uv coordinates on sides which were reshaped (ie, have a vertex in lost_vertices)