diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-09-04 01:49:24 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:29:57 +0300 |
commit | c6e5f6afe0072bebc1fe262e3a671ce2777b382f (patch) | |
tree | 7c8ea3257d276e95c1cdd676fa4d4fef5c341c23 /source/blender/blenkernel/intern/collision.c | |
parent | b38663338e0f95573c0c7a0bfb44e88575794fa7 (diff) |
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).
Diffstat (limited to 'source/blender/blenkernel/intern/collision.c')
-rw-r--r-- | source/blender/blenkernel/intern/collision.c | 5 |
1 files changed, 1 insertions, 4 deletions
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]; |