sp4cerat / Fast-Quadric-Mesh-Simplification

Mesh triangle reduction using quadrics
MIT License
1.5k stars 239 forks source link

How is the threshold formula derived? #36

Closed Mrchs closed 3 months ago

Mrchs commented 8 months ago

Hello, I would like to know what is the principle of setting the threshold formula? What does that mean in mathematical physics? How did you get it?I'm very much looking forward to hearing from you!

neurolabusc commented 8 months ago

This code provides an emulation of the Surface Simplification Using Quadric Error Metrics described by Garland and Heckbert. The Approximating Error With Quadrics section describes the cost function. With this implementation iterations continue until the number of remaining triangles reaches the target_count. The present implementation is very fast because it only re-computes the error metrics occasionally, so it is very fast though the solution may not be quite the theoretical optimal.

Mrchs commented 8 months ago

Thank you for your answer. I would also like to know the specific meaning of the threshold formula. How is it obtained?double threshold = 0.000000001 * Math.Pow(iteration + 3, simplificationOptions.Agressiveness);`

neurolabusc commented 3 months ago

I assume this threshold was chosen pragmatically, and it has stood the test of time. This parameter is just a tradeoff for speed and quality. The idea is that with a low (slow but precise) aggressiveness many iterations will be done that only create tiny changes in the original mesh, while are higher levels more dramatic errors are tolerated to allow the algorithm to quickly reach the desired level of simplification.