Closed Rumi381 closed 2 months ago
Hi, I'll try to answer your questions one by one
1) CinoLib does not natively implement any tetmeshing facility. For this part it only exposes a wrap to the Tetgen library. You can control the parameters with which Tetgen is called through a dedicated string (YQqa%f in your case). You may want to refer to this page to understand how to play with these parameters. Tetgen does not allow you to precisely select how many vertices/tets you will have in your output mesh. This is because there exist so called indecomposable polyhedra that cannot be tetrahedralized without adding additional (Steiner) points. A good read for this topic is the article On Indecomposable Polyhedra and the Number of Steiner Points, from the same author of the Tetgen library. Regarding the number of cells in your final polyhedral mesh: this is obtained by dualizing the primal tetrahedral mesh, so the number of vertices in the tetmesh will correspond exactly to the number of cells in the polyhedral mesh. As a consequence there is no way for you to prescribe a fixed number of output cells
2) there is no CVT. If you are interested in such a thing I suggest you take a look at Bruno Levy's geogram library. This is a great tool for Voronoi meshing, both in 2D and 3D
3) The obj file format is indeed supported by CinoLib, but this format is for surface meshes only! You cannot encode a volumetric mesh in an obj file. The ovm files are supported by the OpenVolumeMesh library, which introduced this format, and also by Geogram as far as I know. The hedra file format is something that I made up for personal use and is not supported by any other toolkit that I am aware of. There is limited interoperability for general polyhedral meshes so far. I think the only possible (though limited) choice is to rely on the ovm file format.
Thank you, @mlivesu, for the detailed response of my questions. As follow up questions, would you please guide me on the following questions?:
1) Which clipping method is happening behind the scenes? I see your code generate more smoother surface compared to Geogram.
2) If I want to create a standalone application for generating the Polygonal mesh in 2D and Polyhedral mesh in 3D, not use the full fledged cinolib library, is it possible? If so, which files do I need to achieve this?
- Which clipping method is happening behind the scenes? I see your code generate more smoother surface compared to Geogram.
you mean for the dual meshing? I wrote that code long time ago, but I don't recall me doing anything special. I guess I am doing the standard thing. Not sure what Bruno does in Geogram. Can you provide a visual example?
- If I want to create a standalone application for generating the Polygonal mesh in 2D and Polyhedral mesh in 3D, not use the full fledged cinolib library, is it possible? If so, which files do I need to achieve this?
It's hard to answer this one. There are many includes happening inside cinolib. I would start from the files that contain what you need, delete everything else, and then iteratively try to compile and restore all the files that are requested until your compiler is happy
In Geogram, the boundary cells are clipped against the surface triangles, which is why the surface of the resulting mesh has a triangulated texture (not Voronoi texture), as shown in the figure below:
Though there is a parameter to avoid the triangulated texture, the result becomes very rough, as shown in the figure below:
But for the same input mesh, I see the smooth Voronoi texture on the surface with cinolib, as shown in the figure below:
I am sure whether it is how you set up the visualization in a certain way or how your clipping is being done to generate the smooth Voronoi surface.
By the way, is there any plan to publish a Python API/Wrapper for cinolib?
it might just be a matter of shading (flat vs smooth). Also different canvases use different openGL setups, so it becomes difficult to distinguish between differences in the actual geometry from differences in the shading/lighting. If you can share the actual OBJs I can do a precise check and give you the correct answer
for the python bindings: I'd love to add that (and many other things!) to cinolib, but I have little time to spend on such improvements. So eventually yes, but I am not currently working at it and I cannot say when this will happen :)
Hi, @mlivesu. The attached zip folder contains the following files: 1) 3holes.obj -> the input mesh 2) 3holes_poly.obj -> output mesh from Geogram without any boundary surface processing 3) 3holes_poly_90.obj -> output mesh from Geogram with normal_angle_threshold=90 4,5,6) -> output meshes from cinolib for the same input mesh.
Please let me know your findings. PolyhedralMesh.zip
Hi, I gave a quick look and I feel we are comparing apples and oranges here.
Geogram is computing a CVT by sampling the input surface with a fixed number of samples (how many? it should be a parameter). Cinolib is just dualizing the input triangle mesh, creating as many cells as the number of input vertices.
Overall there seems to be many more input vertices than the number of CVT seeds used in Geogram. This is why cinolib's results look smoother.
Got it! Thank you, @mlivesu. And I am eagerly waiting for the Python wrapper for cinolib. I hope you find some time soon.
I'll keep you posted :) I am closing this issue as it seems resolved.
Hi, @mlivesu. I am new to Cinolib. I tried the following code to create a Polyhedral mesh for a given input mesh. I have some queries regarding this. Would you please help me with the following questions?:
1) When we are generating the tetrahedral mesh with 'tetgen_wrap(serialized_xyz_from_vec3d(m_in.vector_verts()), serialized_vids_from_polys(m_in.vector_polys()), edges, opt, verts, tets); DrawableTetmesh<> m_tet(verts, tets)' or Polyhedral mesh with 'DrawablePolyhedralmesh<> m_poly; dual_mesh(m_tet, m_poly, true)', can we control the number of cells generated in both resulting meshes?
2) Is any CVT (Centroidal Voronoi Tessellation) optimization automatically performing behind the scenes? If so, can we control the level of CVT optimization with any arguments or parameters?
3) According to the latest version of Cinolib, the library supports only the '.mesh', '.hedra', and '.ovm' file types to save the Polyhedral mesh. I am confused about the content of the '.mesh' file format (which contains the number of hexahedra at the bottom of the file!) and the '.hedra' or '.ovm' file format for the same Polyhedral mesh. Is it possible to save the polyhedral mesh in '.obj' format, which is generally used for such cases in libraries like 'libgl' and 'Geogram'? Can you suggest any software that can open, visualize, and save the '.hedra' or '.ovm' file types and save them as a different file format?
It would be great if you could guide me on the above queries. Here is the code I tried:
include <cinolib/meshes/meshes.h>
include <cinolib/gl/glcanvas.h>
include <cinolib/tetgen_wrap.h>
include <cinolib/vector_serialization.h>
include <cinolib/dual_mesh.h>
include <cinolib/string_utilities.h>
int main(int argc, char **argv) { using namespace cinolib;
}