Any way to circumvent this problem with polyhedra faces?

Hello again! So I implemented a new algorithm to cut polyhedrons on the top, it works flawless except on shapes with concave vertices, I can’t share the entire project but I made two Playgrounds to show my problem.

Those are made with the exact vertices and faces that my project gives in debug just for reference.

So to explain what I do inside the project is to simply get the height of the cutting point and then find the x and z to get the exact points where to cut, and then replace the old points with the new ones to get the faces corresponding to the figure, the top face is just made with the top points in order but it fails when finds a concavity creating a weird shape in it.

is there any way to fix this weird shape on the top face with babylon?

I would need to summon our great Maths Artist @JohnK on this one cause I am pretty sure he will have some clues :slight_smile:

Oh shoot I forgot that I made the question, in the end I solved it by just triangulation, it was kind of difficult to do a more mathematical way so I just made chunks of triangles and in that way worked out!

I made a PG of the end result https://playground.babylonjs.com/#PBLS4Y#417 if someone wants to check it out! the only thing I changed was the faces indexes.

2 Likes