wildmeshing / fTetWild

Fast Tetrahedral Meshing in the Wild
https://yixin-hu.github.io/ftetwild.pdf
Mozilla Public License 2.0
384 stars 78 forks source link

How to make fTetWild respect the input triangles? #48

Open Mathias-Fuchs opened 1 year ago

Mathias-Fuchs commented 1 year ago

Hello, this is probably just a question, not an issue, but it bugs me. I hope it can be resolved relatively easily: fTetWild generates a nice tetrahedral mesh of the volume enclosed by the watertight input surface mesh. However, the input vertices do in general not appear among the output vertices - and therefore the input triangles do not even have a chance to appear as faces of output tetrahedra. However, this effect would be very desirable. How can one force the output tets to conform to the input points and triangles? Thanks for help.

Yixin-Hu commented 1 year ago

Hi,

Unfortunately, fTetWild does not support input faces/vertices conforming. fTetWild is originally designed for bad input meshes whose connectivity is imperfect and thus is not worth being preserved exactly.

Mathias-Fuchs commented 1 year ago

But when I comment the "optimize" section out, it does something very similar, right? At least it seems to use the boundary points. Is that guaranteed?

On Thu, Aug 25, 2022, 12:41 AM Yixin Hu @.***> wrote:

Hi,

Unfortunately, fTetWild does not support input faces/vertices conforming. fTetWild is originally designed for bad input meshes whose connectivity is imperfect and thus is not worth being preserved exactly.

— Reply to this email directly, view it on GitHub https://github.com/wildmeshing/fTetWild/issues/48#issuecomment-1226540744, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD65AK72AYGWQXWZT7PU2Y3V22QIVANCNFSM57QTGPGA . You are receiving this because you authored the thread.Message ID: @.***>

Yixin-Hu commented 1 year ago

The vertices could move even without the optimization step for fTetWild.

If you use TetWIld (https://github.com/Yixin-Hu/TetWild), then the input vertices and faces (geometry not topology) would be preserved exactly in a tetmesh with rational coordinates before the optimization step. But once the rational mesh is converted into floats, the mesh could have inverted tets. Note that the mesh without optimization is just an intermediate result which unfortunately is useless in many cases.

Mathias-Fuchs commented 1 year ago

I see. Ok, so let's assume the user:

and just needs to find a mapping from input vertices to output vertices, then what exactly should they use according to your recommendation? tetwild or ftetwild without optimization, or a function within tetwild? Best regards, Mathias

Yixin-Hu commented 1 year ago

I would recommend to use TetWild: You can use the mesh generated before this line (https://github.com/Yixin-Hu/TetWild/blob/master/src/tetwild/MeshRefinement.cpp#L237). The input N vertices are the first N vertices in the mesh (It should be, but please double-check it. We remove duplicated vertices if two vertices are too close to each other. ).

Note that this mesh is embedded in a box. The embedded surface can be tracked via this variable is_surface_fs (https://github.com/Yixin-Hu/TetWild/blob/master/src/tetwild/TetmeshElements.h#L118): for example, if is_surface_fs[i] is true then the i-th face ((i+1)%4, (i+2)%4, (i+3)%4) is on the input surface.

lNatxii commented 1 month ago

Hi! I don't understand... :)

I know that fTetWild is not able to keep the external triangle distribution, but with TetWild I have also achieved it, and I need it to be able to assign again to the .vtk model (that I generate with the .msh) the texture coordinates (UV) that the original .obj had, and I can only do that if the surface vertices are the same.