Hi All,
I need to clip a polydata with some points. I used SelectPolydata but sometimes it doesn’t work because of the “can not follow edge” error (see code blew).
vtkSelectPolyData can indeed get stuck (logs “Can’t follow edge” error) if control points are too far from each other or the mesh is too complex or have errors. I’ve found that by resampling the input curve and providing input points closer to each other often fixes the issue. According to the documentation of the class, the loop must not intersect itself.
If you provide approximately one control point for every few triangles in the mesh and the curve is not self-intersecting and path search still fails them you have to fix errors in the mesh. A small hole or non-manifold edge can throw the algorithm off.
For more robust geodesic path search, which also provides superior results, because it can cut across surface cells (not just connecting mesh points) you could try this method:
It has C++ implementation with MIT license, so you could turn it into a VTK filter without redeveloping anything.
Hi Paulo, Thanks for your reply.
I already use vtkCleanPolyData but it wasn’t the solution.
As for the CGAL, it is C++ and I don’t know how I can use it in python. Is there any example for python?
I didn’t notice the lack of C++'s semi-colons… Well, CGAL is heavily template-based. C++ templates are, well, templates to data types, not data types. Think C++ templates as recipes for the pre-processor to write code of real data types. Templates are great to minimize code writing. For example: instead of writing ListOfDouble, ListOfInteger, ListOfString, etc. classes, you just declare something like List<Type>. Then, when you write something like List<String>, the pre-processor writes a real ListOfString C++ class for you. Great, isn’t it? Well, that spells doom when it comes to Python bindings, which normally cannot make C++ classes on the fly. You may have guessed by now that putting up a working CGAL front-end for Python 3 will be quite an odyssey. It’s possible, but I think it won’t be worth the trouble. If you still want to delve into the world of Python-C++ bindings, here some resources I found after a bit of googling: