Well, maybe the solution is that instead of concentrating on the points, you take a closer look at the edges.
The problem with merging points is that their indices and positions change.
Unfortunately, without a high error rate, you cannot simply compare the new mesh with the old one and find the differences.
However, what reliably does not change when merging are the indices of the edges.
Edges are either removed/replaced - for example, if both points of an edge are merged - or their length is simply changed.
And this is exactly where the following solution comes in:
- first I capture the indices of the edges.
- then I merge the vertices.
- then I compare the length of the resulting edges with those of the original mesh.
As a result, you get those edges as selections that are no longer present in the old mesh with the new length and interpolate these as float values into the point domain.
...However, there are pitfalls with this approach and, depending on the nature of the geometry, it can happen that the length of an edge after merging the vertices matches the length of another edge that then has the same index. This is particularly problematic with objects such as a cylinder, for example, where there are many edges that have the same length.
I have therefore refined this approach in a further step and included the index of the edge as a criterion for the comparison.
The rule is:
- If points are merged, their edges remain with the original indices.
- If adjacent points of a merged point are also merged, the edge between them is completely removed.
- Depending on the nature of the geometry, new edges with new indices are also added if several adjacent points are merged.
The trick now is to set the original index of the edge in relation to the original length.
And here, funnily enough, the Random Value
node helps. The random value generated by this node can be stabilized by adding an integer value to the input ID. And what would be more suitable here than the original index of the edge itself?
Because if this index or the length changes, one of the vertices connected to the edge must have been merged, as the generated value has changed.
However, if neither of these two values changes, Random Value
always generates the same "random" value.
And it is precisely this value that I am comparing here before and after merging:
If I am not completely wrong about this idea, this should be the final solution.
...Without any Repeat Zone
, complicated nesting or additional geometry.