Selecting edge loops
I'm trying to write a method that does a loop select in a mesh. I'm following the definition mentioned in Maya's help files as guidance.
http://download.autodesk.com/global/docs/maya2012/en_us/index.html?url=files/Polygon_selection_and_creation_Edge_ring_and_edge_loop_selection_tips.htm,topicNumber=d28e121580
In Maya, an edge loop has the following properties:
- The vertices that connect the edges must have a valency equal to four. Valency refers to the number of edges connected to a particular vertex.
- The criteria for connecting the sequence is that the next edge in the sequence is the (i + 2nd) edge of the shared vertex, determined in order from the current 开发者_C百科edge (i).
- The sequence of edges (loop) can form either an open or closed path on the polygonal mesh.
- The start and end edges need not have a valency equal to four.
My problem is that I don't now how to work out the order of the edges. I've been searching for hint without luck. Even looked at the Blender source to try work out how they do it, but that also stomped me.
I never worked out how to select Edge Loops the Maya way. Got stomped on determining the order of the edges. But further digging into the Blender source and I found the method they used which I was able to implement.
# Blender 2.58a
# editmesh_mods.c
# Line 1854
#
# selects or deselects edges that:
# - if edges has 2 faces:
# - has vertices with valence of 4
# - not shares face with previous edge
# - if edge has 1 face:
# - has vertices with valence 4
# - not shares face with previous edge
# - but also only 1 face
# - if edge no face:
# - has vertices with valence 2
精彩评论