Fix T65568: sewing and self collision issue

As explained in T65568 by @LucaRood, the self collision system should exclude triangles that are connected by sewing springs.

Differential Revision: https://developer.blender.org/D6911
This commit is contained in:
Ish Bosamiya
2020-03-02 10:52:58 -03:00
committed by Germano Cavalcante
parent 1648a79036
commit 5afa4b1dc8
6 changed files with 213 additions and 15 deletions

View File

@@ -464,6 +464,113 @@ TEST(ghash, Int4Murmur2a20000000)
}
#endif
/* GHash inthash_v2 tests */
TEST(ghash, Int2NoHash12000)
{
GHash *ghash = BLI_ghash_new(ghashutil_tests_nohash_p, ghashutil_tests_cmp_p, __func__);
randint_ghash_tests(ghash, "RandIntGHash - No Hash - 12000", 12000);
}
#ifdef GHASH_RUN_BIG
TEST(ghash, Int2NoHash50000000)
{
GHash *ghash = BLI_ghash_new(ghashutil_tests_nohash_p, ghashutil_tests_cmp_p, __func__);
randint_ghash_tests(ghash, "RandIntGHash - No Hash - 50000000", 50000000);
}
#endif
/* Int_v2: 20M of randomly-generated integer vectors. */
static void int2_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr)
{
printf("\n========== STARTING %s ==========\n", id);
void *data_v = MEM_mallocN(sizeof(unsigned int[2]) * (size_t)nbr, __func__);
unsigned int(*data)[2] = (unsigned int(*)[2])data_v;
unsigned int(*dt)[2];
unsigned int i, j;
{
RNG *rng = BLI_rng_new(0);
for (i = nbr, dt = data; i--; dt++) {
for (j = 2; j--;) {
(*dt)[j] = BLI_rng_get_uint(rng);
}
}
BLI_rng_free(rng);
}
{
TIMEIT_START(int_v2_insert);
#ifdef GHASH_RESERVE
BLI_ghash_reserve(ghash, nbr);
#endif
for (i = nbr, dt = data; i--; dt++) {
BLI_ghash_insert(ghash, *dt, POINTER_FROM_UINT(i));
}
TIMEIT_END(int_v2_insert);
}
PRINTF_GHASH_STATS(ghash);
{
TIMEIT_START(int_v2_lookup);
for (i = nbr, dt = data; i--; dt++) {
void *v = BLI_ghash_lookup(ghash, (void *)(*dt));
EXPECT_EQ(POINTER_AS_UINT(v), i);
}
TIMEIT_END(int_v2_lookup);
}
BLI_ghash_free(ghash, NULL, NULL);
MEM_freeN(data);
printf("========== ENDED %s ==========\n\n", id);
}
TEST(ghash, Int2GHash2000)
{
GHash *ghash = BLI_ghash_new(
BLI_ghashutil_uinthash_v2_p, BLI_ghashutil_uinthash_v2_cmp, __func__);
int2_ghash_tests(ghash, "Int2GHash - GHash - 2000", 2000);
}
#ifdef GHASH_RUN_BIG
TEST(ghash, Int2GHash20000000)
{
GHash *ghash = BLI_ghash_new(
BLI_ghashutil_uinthash_v2_p, BLI_ghashutil_uinthash_v2_cmp, __func__);
int2_ghash_tests(ghash, "Int2GHash - GHash - 20000000", 20000000);
}
#endif
TEST(ghash, Int2Murmur2a2000)
{
GHash *ghash = BLI_ghash_new(
BLI_ghashutil_uinthash_v2_p_murmur, BLI_ghashutil_uinthash_v2_cmp, __func__);
int2_ghash_tests(ghash, "Int2GHash - Murmur - 2000", 2000);
}
#ifdef GHASH_RUN_BIG
TEST(ghash, Int2Murmur2a20000000)
{
GHash *ghash = BLI_ghash_new(
BLI_ghashutil_uinthash_v2_p_murmur, BLI_ghashutil_uinthash_v2_cmp, __func__);
int2_ghash_tests(ghash, "Int2GHash - Murmur - 20000000", 20000000);
}
#endif
/* MultiSmall: create and manipulate a lot of very small ghashes
* (90% < 10 items, 9% < 100 items, 1% < 1000 items). */