From c0340ec89393055bbb0ba0432b9edb5d70b3711c Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Mon, 10 Aug 2020 12:05:37 -0300 Subject: Fix T78113: Random explosions of cloth with self collision The problem is caused by a lack of prediction in the `isect_line_segment_tri_v3` that incorrectly confirms some intersections of coplanar segments to the triangle. The solution is to use another algorithm to detect intersections. This also resulted in a slight improvement in the performance: - 1min 17sec to 1min 6sec in my test file Differential Revision: https://developer.blender.org/D8500 --- source/blender/draw/intern/draw_cache_extract_mesh.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/draw/intern') diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.c b/source/blender/draw/intern/draw_cache_extract_mesh.c index cca8ebcf2a8..63efc82f87e 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh.c @@ -4047,8 +4047,7 @@ static bool bvh_overlap_cb(void *userdata, int index_a, int index_b, int UNUSED( return false; } - return (isect_tri_tri_epsilon_v3( - UNPACK3(tri_a_co), UNPACK3(tri_b_co), ix_pair[0], ix_pair[1], data->epsilon) && + return (isect_tri_tri_v3(UNPACK3(tri_a_co), UNPACK3(tri_b_co), ix_pair[0], ix_pair[1]) && /* if we share a vertex, check the intersection isn't a 'point' */ ((verts_shared == 0) || (len_squared_v3v3(ix_pair[0], ix_pair[1]) > data->epsilon))); } -- cgit v1.2.3