Smooth a large Mesh

Hi, i have this PG Babylon.js Playground and my goal is minimize the vertices to smooth the mesh. For that i used this approach Minimise Vertices - Babylon.js Documentation (in PG i commented line 85 to not “freeze” in first time you open) but this take a long time to minimize the vertices (more than 2 minutes). In this mesh (part of jaw) i have a lot of indices ( i added a console.log line 16).
Is possible improve this ? Can you help me ?

Thank you very much !!

Here’s a version that takes 500ms intead of 3mn:



Wow thanks a lot @Evgeni_Popov !!

I convert the original script (thanks @Evgeni_Popov) in typescript (project in angular) if someone needs, i share the class to add the smooth: babylonjs_smooth_mesh/smooth.ts at master · helderalvesoliveira/babylonjs_smooth_mesh · GitHub