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

Split quads mesh to triangular mesh. Retopology #332

Closed
megahard25 opened this issue Jan 4, 2021 · 2 comments
Closed

Split quads mesh to triangular mesh. Retopology #332

megahard25 opened this issue Jan 4, 2021 · 2 comments

Comments

@megahard25
Copy link

I have a 3D Model of human head. (It is ICT Face Model Light)
image
As shown, it has quadratic mesh and mesh.faces shape is (131372,). The number 131372 is divisible by 4, which corresponds to a quad topology.

I want to convert quad mesh to triangular mesh.
I tried to use mesh.triangulate() method and the result is shown below:
image
It seems that the conversion was successful, but if you look at the shape of mesh.faces, you will see that it is equal to (208880,), where the number 208880 is not divisible by 3, but is divisible by 4.

I need the mesh.faces shape to be divisible by 3 after triangulation.
As far as I understand, this result means that the topology of the model has not changed and we need do retopology procedure.

Please give me advice on how I can achieve the desired result.
Thank you!

@akaszynski
Copy link
Member

That's because mesh.faces will include a "header" for each face that indicates the number of points in that face. For example, the faces with points [0, 1, 2] and [10, 11, 12] will resolve within VTK as:

[3, 0, 1, 2, 3, 10, 11, 12]

The 3 indicates the number of points in the face and followed by the indices in the faces.

To be 100% sure, you can verify the mesh is composed only of triangles with the following. Note that the size of "faces" is still divisible by 4:

>>> import pyvista as pv
>>> mesh = pv.Sphere()
>>> mesh.is_all_triangles()
True

>>> mesh.faces[:12]
array([ 3,  2, 30,  0,  3, 30, 58,  0,  3, 58, 86,  0])

>>> mesh.faces.size % 4
0

>>> mesh.plot(show_edges=True)

image

@megahard25
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants