From c6e5f6afe0072bebc1fe262e3a671ce2777b382f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Wed, 3 Sep 2014 23:49:24 +0200 Subject: Fixed implementation of the Conjugate Gradient method for the cloth solver that properly supports constraints with some degrees-of-freedom. The previous solver implementation only used the S matrix (constraint filter matrix) for pinning vertices, in which case all elements are zero and the error doesn't show up. With partial constraints (useful for collision contacts) the matrix has non-zero off-diagonal elements and the algorithm easily diverges. There are also initial steps for implementing collision prevention as described in the Baraff/Witkin paper "Large Steps in Cloth Simulation" (http://www.cs.cmu.edu/~baraff/papers/sig98.pdf). --- source/blender/blenkernel/intern/collision.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/collision.c') diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 427b76ab778..0bc81d2e9da 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -1133,9 +1133,6 @@ static CollPair *cloth_point_collpair(float p1[3], float p2[3], MVert *mverts, i float facenor[3], v1p1[3], v1p2[3]; float w[3]; -// if (!isect_line_tri_v3(p1, p2, co1, co2, co3, &lambda, uv)) -// return collpair; - if (!cloth_point_face_collision_params(p1, p2, co1, co2, co3, facenor, &lambda, uv)) return collpair; @@ -1159,7 +1156,7 @@ static CollPair *cloth_point_collpair(float p1[3], float p2[3], MVert *mverts, i */ copy_v3_v3(collpair->pa, p2); collpair->distance = distance2; - mul_v3_v3fl(collpair->vector, facenor, distance2); + mul_v3_v3fl(collpair->vector, facenor, -distance2); w[0] = 1.0f - uv[0] - uv[1]; w[1] = uv[0]; -- cgit v1.2.3