I would like to filter some surfaces based on their Euler characteristic. I need to compute the number the Euler number = V - E + F.
The number of vertices (number of points) and number of faces (number of triangles) are easy to find. What is the easiest way to find the number of edges, vtkEdgeFilter?
Thanks in advance
You probably want vtkFeatureEdges, it’s a filter than can extract edges according to their properties.
Try this filter with the settings
ManifoldEdgesOn(), and turn all other kinds of edges off, e.g.
ManifoldEdges are edges shared by two polygons, BoundaryEdges are edges that belong to only one polygon. If your surface is a closed surface, it will have no boundary edges.
The number of line segments generated by the filter is the number of edges.
Thanks, I am currently messing around with
vtkFeatureEdges. My surfaces have no non-manifold edges, but are not always closed. It must be possible… I get some weird artifacts from both
vtkBooleanOperationPolyDataFilter and they seem like open surfaces, so my idea is to remove them based on topology.
The issue was that the output of
vtkBool visually appear as closed, but they are not.
In case other people asks this question, my current solution is now:
cleaner = vtkStaticCleanPolyData()
poly = cleaner.GetOutput()
edges = vtkFeatureEdges()
V = poly.GetNumberOfPoints()
F = poly.GetNumberOfCells()
E = edges.GetOutput().GetNumberOfCells()
return V - E + F