Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-02-06 17:03:51 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-02-06 17:11:34 +0300
commit31170ec19ed2e3ec4d0cf223e214a1d6aa5f2249 (patch)
tree97f963103b1fa6db289a807068e128eeaed23f6f /source/blender/blenlib
parentf4f468fc4830c32fc6423ff968cf1af86e8dcd16 (diff)
Fix T43578: Beauty Triangulation would hang in infinite loop, due to float rpecision issue.
Only recompute if cost is below -FLT_EPSILON, we can get cases where both cases generate very tiny negative costs (see 'Cylinder.004' mesh in .blend attached to report).
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/polyfill2d_beautify.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/polyfill2d_beautify.c b/source/blender/blenlib/intern/polyfill2d_beautify.c
index 7914b7cb39b..1f4b598be4c 100644
--- a/source/blender/blenlib/intern/polyfill2d_beautify.c
+++ b/source/blender/blenlib/intern/polyfill2d_beautify.c
@@ -237,7 +237,10 @@ static void polyedge_beauty_cost_update_single(
{
/* recalculate edge */
const float cost = polyedge_rotate_beauty_calc(coords, tris, e);
- if (cost < 0.0f) {
+ /* We can get cases where both choices generate very small negative costs, which leads to infinite loop.
+ * Anyway, costs above that are not worth recomputing, maybe we could even optimze it to a smaller limit?
+ * See T43578. */
+ if (cost < -FLT_EPSILON) {
eheap_table[i] = BLI_heap_insert(eheap, cost, e);
}
else {