CGAL / cgal-swig-bindings

CGAL bindings using SWIG
Other
346 stars 93 forks source link

Info needs to be added to triangulation vertices #166

Open jeffwu78 opened 4 years ago

jeffwu78 commented 4 years ago

Similar to issue #97, info needs to be added to triangulation vertices, 2D and 3D for Python, at the bare minimum an integer. This is essential for almost any practical application; vertices mean something in the real world, like a person or a node in a network. I don't see it anywhere in the interface. I know perhaps the SWIG interface needs to be modified, but it would be nice if it had official support.

I have gotten simple_triangulation_3.py to run successfully with all assertions passing, and the output file generating successfully. But of course, there is no info capability used in the test.

CGAL version 5.0.2 Boost version 1.7.2 Swig 4.0.1 cgal-swig-bindings cloned on 3/11/2020

jeffwu78 commented 4 years ago

Would like to add that the vertex info capability is present inside the old CGAL Python Bindings project using Boost-Python (http://cgal-python.gforge.inria.fr/), but not in cgal-swig-bindings

krober10nd commented 4 years ago

Coincidentally, this is the same issue as me #167.

I spent several hours trying to find some way to get the indices of the triangulation as you can only currently get the point coordinates. A poor hack would be to do a nearest neighbor interpolation of the facet points to get the point indices to form the facet table.

sloriot commented 4 years ago

In theory it is not complicated, you simply need to change the simplex types in the typedef.h of the two packages (there is already a special case in 2D with Java). Then the handle wrappers require some extra functions to set and get the values. There is also a macro in 2D in java adding the extra functions. I'm missing time these days but I'll try to add it.

jeffwu78 commented 4 years ago

That would be great, Sebastien. Doing it exactly like it was done in the old CGAL-Python project would be perfect, with set_info(...) being able to take in any Python object.

krober10nd commented 4 years ago

Hey guys. I got around to doing it here but outside of this project I’ll do 3d later today or tomorrow. https://github.com/krober10nd/simple_cgal