Mesh API to get non-degenerate triangles

Is there an API to get non-degenerate triangles of a mesh?

If you visit this playground, you can see that we are calculating the triangles of a mesh using mesh.getIndices() and mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind) but 268 triangles with no area.

This is an example using Babylon’s primitive sphere.

Is there a way to do get all traingles of a mesh without degenerate triangles?


Hey! long time no see :wink:

There is no such API out of the box unfortunately

Hey @Deltakosh thanks for the quick response! Hope things are well

I could just filter the result set as the playground writer is doing, but do you know why these degenerate triangles exist in the first place?

Wouldnt mind adding another contribution if it makes sense. Also this seems to only happen for spherical meshes

They are the byproduct of using math formula to create the mesh. I will be glad to merge a mesh feature which update the mesh and removed the degenerated faces for sure :slight_smile:

You could try mesh.forceSharedVertices see Forcing Shared Vertices | Babylon.js Documentation