Removed fix_polygon_winding's ability to delete edges, since it caused problems

with polygons that have only three vertices and also that isn't really its job
to do anyway.
This commit is contained in:
2026-09-26 14:04:32 -04:00
parent b5fe9f7c8d
commit e35adc23b2
@@ -806,21 +806,10 @@ void MeshEditingLibrary::fix_polygon_winding(MeshEditPolygon2D &polygon)
const int32_t b_index = i;
const int32_t c_index = (i + 1) % polygon.vertices.size();
const float ab_dist_squared = (polygon.vertices[b_index].position - polygon.vertices[a_index].position).length_squared();
const Vector2 ab_edge = (polygon.vertices[b_index].position - polygon.vertices[a_index].position).normalized();
const float bc_dist_squared = (polygon.vertices[c_index].position - polygon.vertices[b_index].position).length_squared();
const Vector2 bc_edge = (polygon.vertices[c_index].position - polygon.vertices[b_index].position).normalized();
if (ab_dist_squared < TINY_NUMBER || bc_dist_squared < TINY_NUMBER || (ab_edge - bc_edge).length_squared() < TEENY_TINY_NUMBER)
{
polygon.vertices.erase(polygon.vertices.begin() + i);
}
else
{
total_angle += UtilityFunctions::asin(ab_edge.x * bc_edge.y - ab_edge.y * bc_edge.x);
}
}
if (total_angle < 0.0f)
{