2.1.6.0

 
 
 
Posted by:EPHERE
Data created:18 March 2013

Hey, I m trying to find the edges that are connected to a vertex, and then the other vertex on that edge. Like this:

GetEdgeFromVertex

https://dl.dropbox.com/u/8801520/GetEdge.gif

So I already got v1 (selected vertex) but now I d like to find the blue edges to find the other vertices (v2,v3,v4). Right now I m doing it like this:

 

IPolyObject polyObj = (IPolyObject)m_Node.EvalWorldState(0, true).Obj.ConvertToType(0, m_Global.PolyObjectClassID);
IMNMesh mm = polyObj.Mm;

mm.FillInVertEdgesFaces();

for (int j = 0; j < mesh.NumVerts; j++)
{
         int edgeIndex = mm.FindEdgeFromVertToVert(m_SelectedVertexIndex, j);
         if (edgeIndex != -1)
         {
                edgeList.Add(edgeIndex);
                vertexIndexList.Add(j);
         }
}

For my test scene (a cube) this works fine, but if I try this on bigger objects with more verts it ll always get slower and slower. I just can t seem to find the right methods to do this quickly. Any tips?

In maxscript I'd call this method: polyOp.getEdgesUsingVert. I would however like to keep my plugin independent of the type of my baseObject, IF this is possible.

Thanks,
Vin

Marsel Khadiyev (Software Developer, EPHERE Inc.)