# Count joined edges in a mesh (R5 and R6)

I am trying to work out how to analyze a mesh to determine what percentage of the mesh contains faces at more than XX angle to the adjacent mesh face?

Example Mesh A = 1000 poly’s, 200polys are at more than 80 degree angle to adjacent polys

Assuming it counted both faces the actual percentage of polys at more than 80 degrees in this case is 10%

Completely lost on how to do this in rhinocommon (c#)

Dupmeshedge in rhino for example must calculate this to be able to determine an “edge” as being defined as more than XX angle?

As you already say, it is a feature of a mesh edge, not of a mesh face. You should be able to iterate through all edges, then if an edge has two adjacent faces calculate the angle between the face normals. You want to do this using the `TopologyEdges`, because a mesh can contain edge and vertex duplicates to enable multiple normals on the same vertex, which looks good in shaded/rendered mode.

@menno

eurghhh,. ok gave that a go, that gives me EVERY edge in a mesh… slow as mollasses to iterate through them

the output from

var aa = mesh.TopologyEdges;
for (int i = 0; i < aa.Count; i++)
{

``````                    var bb = aa.
}
``````

=

rethink…

I guess what I am trying to do is the same as the show edges command as pictures below, in a few milliseconds I get pinks lines, representing edges defines as "corner or over 90;) I guess, how do I in Rhinocommon access those, (join the ones that are connected) to be able to say instead this mesh has XX edges over 90’.

This might be a better way around to solve my problem.

Any pointers on the method the find egdge works so quickly? And how i access that? Many thanks

The magic behind the `ShowEdges` command is a C++ function named ON_Mesh::GetMeshEdgeList. This isn’t exposed in RhinoCommon.

Other than visual display, is there any other reason why you’d need this functionality?

– Dale

Hi @dale

Yes. I need it as part of a function that determines how “complex” a piece of geometry is. In regular breps supplied to the mechanism it’s easy, count the breps but with a supplied mesh I need to count edges, but only the edges as supplied by the mechanism the the c++ above supplies. Can that call be wrapped to run in C#?

@ChristopherBotha, try Mesh.CollapseFacesByEdgeLength(false, 0.5). It’s an ugly, fast was to reduce the mesh down to a manageable size and should maintain the ratio.