MmgTools / mmg

open source software for bidimensional and tridimensional remeshing
http://www.mmgtools.org
Other
369 stars 118 forks source link

Define boundaries without angle? #7

Open updega2 opened 8 years ago

updega2 commented 8 years ago

I've been testing out mmgs on some triangle surfaces, and I really like what it can do!

Is it possible to give mmgs feature boundaries to use instead of a feature angle?

Ideally, this would be giving each triangle an integer marker and when two adjacent triangles have a different integer marker, this would be the feature boundary.

Thanks!

Algiane commented 8 years ago

Hello,

It is hard to give a response, To have a reliable surface reconstruction model is a tricky problem.

updega2 commented 8 years ago

I'm not sure what you mean by surface reconstruction. Can you explain more?

I was thinking it wouldn't be very different than using a feature angle. Just a different way to mark the features. Is is possible to mark edges in some way?

Algiane commented 8 years ago

Sorry, I send by error the previous message without ended it :-). (I will edit it in few minutes)

It is possible to mark the triangle/edges, with the references for now, but we can add a way to mark it differently if needed.

To add points, not in the middle of edges, but on an "ideal" smooth surface, we reconstruct this one from the piecwise linear mesh: this is the surface reconstruction. For now we use the element normals to recover the ideal surface, thus it is hard to change this. We just can modified the sharp angle detection.

Which kind of features are you thinking instead of angles?

updega2 commented 8 years ago

No worries! Okay, so I can use the ref to assign markers to points and triangles? Is this information carried through and output as well?

Are you constructing a bezier patch from the piecewise linear mesh? I thought I saw a bezier function somewhere. Are you doing this for a single triangle or forming a bezier (or something else) patch for each connected region?

I was just thinking in the case that you know the features you want to preserve. Then you can give triangles different markers. The boundaries between triangles with different markers are the features you want to preserve. In my application, I already know the features, and a hard angle separation doesn't always pick them out correctly.

Algiane commented 8 years ago

Hello, Yes, you can use the triangle references to assign markers, and this information is preserved during the remesh process. We use it for exemple to assign local minimal/maximal edge size and local hausdorff distance. The point entities have a reference field too but it is not used for now and the inserted points are created with the 0 ref (thus you can not use this ref to associate a feature to the mesh).

Indeed, we use Bezier patches to approach the surface geometry. We compute one triangular patch per triangle but we ensure the C1 continuity between patches at regular points (not over ridges or corners of course).

If you want, you can give "by hand" the ridges and specify to the remesher to not detect sharp angles ( MMGS_Set_ridge and MMGS_Set_iparameter(mesh,sol,MMGS_IPARAM_angle,0) functions ) .

If you know the normals at the initial vertices of the mesh, you can specify it (for now, only in command line and with the very last version of the master branch but I can add the API function in the develop branch if you need it).

I hope this will help you...

updega2 commented 8 years ago

Thanks for the reply!

Sounds great. I will try to give that a shot and see if it works out. Thats okay, I shouldn't need API functions to do it. I'll figure out how to specify that.

Sorry for all the questions! But I have another one. When specifying local minimal/maximal edge sizes, as you mentioned is possible, how much can you do this? Is it possible to specify a local min/max for almost every triangle in the mesh?

Thanks again for the help!

Algiane commented 8 years ago

Good morning,

Feel free to ask as much as you want!

It is possible to associate local min/max (and local maximal Hausdorff distance too) to triangle references. The local parameters are then applied on each edge of the triangles (for edges at interfaces of 2 refs, the more restrictive parameters are applied). Thus:

Regards

updega2 commented 8 years ago

Thanks for the answers!

For mmgs, I actually tested this out and it didn't seem to work. I used: MMGS_Set_iparameter(mesh,met,MMGS_IPARAM_numberOfLocalParam,npar) where npar is the number of triangles in my mesh.

And then I used: MMGS_Set_localParameter(mesh,met,MMG5_Triangle,ref,fp1,fp2,hausd) and I increased ref by one every time, and I used the same fp1, fp2, and hausd.

This should essentially be the same as giving a global min/max and hausd right? When I tried this, it didn't crash, but it just hung up and didn't seem to compute the remesh.

Thanks!

Algiane commented 8 years ago

I cannot reproduce this behaviour. Your function call seems to be ok. However, having one reference per triangle may lead to a very poor mesh because we create a singular point at each intersection of 3 or more interface edges.

Please, can you send me, either a minimal reproducer or the backtrace when the livelock occurs in mmgs?

updega2 commented 8 years ago

Okay, thanks for the info.

In some cases, I start with a pretty poor mesh quality, so it sounds like it isn't a good idea to do this. I will figure out a way to do what I want without setting a ref for every triangle.

I can see if I can make a simple test case and send it your way.

Thanks again for your help!

updega2 commented 8 years ago

Hi Algiane, you are right. I was probably just trying on too complicated of an example, and it was still computing.

I tried on a very simple case (a cylinder), and it worked. It just took really long, and as you mentioned the output triangulation was really poor.

Algiane commented 8 years ago

Hi,

I am relieved to see that we don't have a livelock in mmgs!

For your computationnal time problem, you can check the time that take mmgs with the same triangle references and global parameters instead of the local ones.

You must obtain the same output meshes in both cases but I think that it is really faster with only global parameters: in fact, I see no means to be efficient with a lot of local parameters (this option was added to allow to have different degrees of approximations for multiple objects, thus for a low number of local param).

So, in fact, I think that I need to add you a field in the triangle entity to define your feature (if you are ok, a char rather than an int).

Say me if you think that it is the best solution.

Regards,

Algiane commented 2 years ago

Hi @updega2 ,

I am trying to clean up old pending issues of the repository. We a fresh reading of your initial question: can I close this issue?

Thank you by advance, Algiane