# Need help with Geometry Nodes edge selection

I have a closed line of connected vertices without faces in GN. This is the outline of a road which I'm using to create a guard rail along the sides. I need to delete the end edges so the rail won't run across the road.

The closest I can come to it is making a selection of the corner vertices by edge angles. However deleting corner points/vertices doesn't work as they will also delete the last edge along the road (see animated gif). Converted to curve I could also make the corner selection but that didn't help either.

So how could I select/delete only the edges marked in red?

• What about setting the Delete Geometry domain to Edge instead of Point ? Commented May 23, 2023 at 11:51
• That gives unexpected results, deleting some edges, I don't understand based on what... I've uploaded the .blend so whoever wishes to try it don't have to reproduce everything from scratch. Commented May 23, 2023 at 12:54

This seems to work:

We do need to delete edges, not points, but your current node setup is built out to evaluate the field for each point. Just switching it to edges doesn't work and produces those strange results you mentioned.

So using the edge vertices node, I can get the indices of both vertices of any given edge. if your node tree evaluates to true for both vertices of a given edge, then we know to delete that edge with the and boolean math operator.

Hope this helps!

• This works very well! I had the idea this would be the solution in theory but could not put together the setup, not knowing enough about how to access topology (the first part of my setup was also imported, not my own). Commented May 24, 2023 at 5:13
• Could you perhaps replace the image of the node setup with a higher resolution one? It was very difficult to discern text on it. Commented May 24, 2023 at 5:16

This solution works by first selecting vertices that form an angle greater than the given value (87 degrees in this case), then extending the selection to neighbouring vertices 2 times and then subtracting from the selection 3 times. The points selected this way define the edges to be deleted.

The advantage of this method is that it will delete end edges even if there is an extra vertex on it (if the end edge is subdivided). That's exactly what happened in my case: my geometry is generated and soon I encountered a case where an end edge had a vertex on it and because of that Grant Thorshov's solution didn't work (even though it perfectly answers my original question and I'm grateful to him :)

The technique I used to extend/subtract vertex selection comes from this answer here: Geometry Nodes - Select More/Less

I was trying to do the same thing but my geometry has some 90 degree angles other than the two at each end of the track, which meant that they also would have been selected. This led me to realize there is a simpler solution. In my case, the line was extruded from a Bezier curve, so the first and last control points also happen to be at the midpoint of the edges I want to delete. Therefore, I selected the edges whose vertices are equidistant from either control point and deleted those. The Resample Curve node is necessary for handling curves with an arbitrary number of points. If yours is a straight line, you can further simplify this by only evaluating the distance to the point at index 0. Be careful, though--this method could potentially delete an edge if it happens to be orthogonal to a line drawn from its midpoint to either of the control points. In that case, you could narrow the selection further to edges whose distance from the control point are equal to half the edge's length.