Geometry Nodes: Edges to Face Groups speedup

Remove unnecessary N^2\n complexity. Disjoint set will join all
elements in list, even without fully-related joins. Usually cost is
small (10%~ for this specific function), but some certain files might
be 10000x slower. But that is very corner case.

Pull Request: https://projects.blender.org/blender/blender/pulls/115245
This commit is contained in:
Iliya Katueshenock
2023-11-21 23:36:41 +01:00
committed by Hans Goudey
parent b794bf173c
commit 33442e0992

View File

@@ -26,10 +26,8 @@ static void node_declare(NodeDeclarationBuilder &b)
/** Join all unique unordered combinations of indices. */
static void join_indices(AtomicDisjointSet &set, const Span<int> indices)
{
for (const int i : indices.index_range()) {
for (int j = i + 1; j < indices.size(); j++) {
set.join(indices[i], indices[j]);
}
for (const int i : indices.index_range().drop_back(1)) {
set.join(indices[i], indices[i + 1]);
}
}