Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MMG3D_Set_triangles switches the second and third vertices #265

Open
jcortial-safran opened this issue May 2, 2024 · 4 comments · Fixed by #266
Open

MMG3D_Set_triangles switches the second and third vertices #265

jcortial-safran opened this issue May 2, 2024 · 4 comments · Fixed by #266
Labels
kind: bug error or fault

Comments

@jcortial-safran
Copy link
Contributor

It is obvious when looking at the source code :

ptt->v[0] = tria[j] ;

However, MMG3D_Set_triangle (actually used in the examples) does not perform the switch.

@jcortial-safran jcortial-safran added the kind: bug error or fault label May 2, 2024
@jcortial-safran
Copy link
Contributor Author

There seems to be the same inconsistency in MMGS :

ptt->v[0] = tria[j] ;

@Algiane
Copy link
Member

Algiane commented May 3, 2024

Hi,

Thank you for your contribution. Indeed, it doesn't make much sense to permute the triangles vertices but does it create an error in Mmg or is it an issue for you?

I think that in any cases, when Mmg analyzes the surface mesh provided by the user, it tries to find a consistent orientation for connected pieces of surface and may change the orientation of your input triangles:

  • for 3D volume meshes, triangles are oriented in the direction of the outward normal for an outer surface and in an arbitrary direction for an inner surface
  • for 3D surface meshes, the orientation of the first provided triangle is choosen (I think).

Thank you by advance for your feedback,
Best

@jcortial-safran
Copy link
Contributor Author

So far I did not observe any error in Mmg due to triangle orientation.

Nevertheless, I think there should be a consistent behavior between MMG3D_Set_triangles on the one hand and MMG3D_Set_triangle, MMG3D_Get_triangles and MMG3D_Set_triangle on the other hand.

Currently, a round trip using MMG3D_Set_triangles and MMG3D_Get_triangles does not preserve the user data, which is how I discovered the discrepancy.

@Algiane
Copy link
Member

Algiane commented May 13, 2024

Hi,

I agree that a consistent behaviour would be preferable: I just wanted to be sure on the consequences of the vertices swaps.

As it doesn't create errors, I prefer to integrate your improvement in the 'develop' branch that in the 'master' one (in which I try to only directly merge hot fixes): it will be integrated in the next release of Mmg.

Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug error or fault
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants