Common edge between two vertices

By processing mesh geometry with a bmesh object, we can easily find common edges between two vertices, using the list of edges linked to current vertex.

Let’s create a “bmesh” object and transfer the geometry of the current active mesh to it.

For example we have two selected vertices, write them to the list:

Each bmesh vertex has a pointer to the list of edges linked to it – link_edges.

To find an edge that lies between these two vertices and is common to them, we need to find a common element in two lists of edges for both vertices.

This can be done by turning each list into a set and performing an intersection operation.

To get a pointer to the edge itself from the intersection, execute the next(iter) operation.

So, a common edge between two vertices can be found using just one line of code.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments