How can I remove overlapping parts of edges?

Hi. I have a mesh consisting of various lines (actually hundreds of them; the image is a very simplified example). I need to remove all overlapping parts of the edges.
Any idea?

Don’t think there is a way to do this in GN right now. Best you can try is to do a Merge by Distance followed by a Split Edges.

This type of issue has the “smell” of a problem where the generation is maybe problematic and needs to be rethought. Is there a way you can generate the edges to not overlap in the first place?

Good luck.

4 Likes

Actually there might be a way, but I’m not sure how universal it is. I found this when I wanted to optimize shortest edge path:

Also with dense geometry this method can take a while to compute.

1 Like

Thank you, but this only works when points are also overlapping, which is (mostly) not the case in my example.

Is there a way to first of all merge all lines into 1 line? Then it would be possible to eliminate points which have a 180° angle. I think this would be a solution.

I would try merge by distance.

Unfortunately, merge by distance seems not to be helpful in this case, because it can only merge points / vertices, whereas in this case it is about edges / edge parts.

Try subdividing before

1 Like

This is the solution- unpleasant though it may be to hear- what you’re trying to do is complicated, ham-fisted, and messy. It isn’t possible fully procedurally, you’re going to have to spend hours doing manual fixes. What circumstances led to having this kind of data in the first place, and what can you do to mitigate or prevent those circumstances?

2 Likes

Yeah , as @Hadriscus said you can

  • convert that to a curve, ( mesh to curve)
  • resample the curve to a crazy amount like 0.1 0.01 depending on the scale of the object and your computer resources,
  • then curve to mesh,
  • merge by distance , in that case by something around 0.2, 0.02
  • mesh to curve
  • resample curve set to count , count = 2

That obviously will give you a new set of edges, like the shape will mostly stay the same, but the edge count and size will be fairly different …

There are probably other ways to cheat but none of them are perfect and this one is the simplest by far…

Good luck !

4 Likes

Great, thank you Sozap, that’s it! :smile:

1 Like