Geometry Nodes: Uniform mode in Shortest Edge Paths node #114733

Closed
Iliya Katushenock wants to merge 9 commits from mod_moder:tmp_speedup_uniform_shortest_edge_paths into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 21 additions and 19 deletions

View File

@ -56,29 +56,31 @@ static void shortest_paths(const Mesh &mesh,
}
});
while (!queue.empty()) {
const float cost_i = queue.top().first;
const int vert_i = queue.top().second;
queue.pop();
if (visited[vert_i]) {
continue;
}
visited[vert_i] = true;
for (const int index : vert_to_edge.offsets[vert_i]) {
const int edge_i = vert_to_edge.data[index];
const int neighbor_vert_i = other_vertex[index];
if (visited[neighbor_vert_i]) {
devirtualize_varray(input_cost, [&](auto input_cost) {
while (!queue.empty()) {
const float cost_i = queue.top().first;
const int vert_i = queue.top().second;
queue.pop();
if (visited[vert_i]) {
continue;
}
const float edge_cost = std::max(0.0f, input_cost[edge_i]);
const float new_neighbor_cost = cost_i + edge_cost;
if (new_neighbor_cost < r_cost[neighbor_vert_i]) {
r_cost[neighbor_vert_i] = new_neighbor_cost;
r_next_index[neighbor_vert_i] = vert_i;
queue.emplace(new_neighbor_cost, neighbor_vert_i);
visited[vert_i] = true;
for (const int index : vert_to_edge.offsets[vert_i]) {
const int edge_i = vert_to_edge.data[index];
const int neighbor_vert_i = other_vertex[index];
if (visited[neighbor_vert_i]) {
continue;
}
const float edge_cost = std::max(0.0f, input_cost[edge_i]);
const float new_neighbor_cost = cost_i + edge_cost;
if (new_neighbor_cost < r_cost[neighbor_vert_i]) {
r_cost[neighbor_vert_i] = new_neighbor_cost;
r_next_index[neighbor_vert_i] = vert_i;
queue.emplace(new_neighbor_cost, neighbor_vert_i);
}
}
}
}
});
}
class ShortestEdgePathsNextVertFieldInput final : public bke::MeshFieldInput {