diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2008-02-26 12:55:07 +0300 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2008-02-26 12:55:07 +0300 |
commit | e9ce2a9f3f7e93692a6dc1c25ed050391f510436 (patch) | |
tree | 3138d0db99e3066e98515d8da30f461d645b65bc /source/blender/blenkernel/intern/cloth.c | |
parent | e368af29f0cea305ede424f00f000c2e34eaf587 (diff) |
Cloth: Little (bug)fix to let springs appear as an upper tridiagonal matrix
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 24def8211f1..38b4cf6bcbb 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -23,9 +23,7 @@ * The Original Code is Copyright (C) Blender Foundation * All rights reserved. * -* The Original Code is: all of this file. -* -* Contributor(s): none yet. +* Contributor(s): Daniel Genrich * * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ @@ -501,8 +499,6 @@ void cloth_write_cache(Object *ob, ClothModifierData *clmd, float framenr) fclose(fp); } - - /************************************************ * clothModifier_do - main simulation function ************************************************/ @@ -1232,8 +1228,8 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) if ( spring ) { - spring->ij = medge[i].v1; - spring->kl = medge[i].v2; + spring->ij = MIN2(medge[i].v1, medge[i].v2); + spring->kl = MAX2(medge[i].v2, medge[i].v1); VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x ); spring->restlen = sqrt ( INPR ( temp, temp ) ); clmd->sim_parms->avg_spring_len += spring->restlen; @@ -1262,8 +1258,8 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) { spring = ( ClothSpring *) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" ); - spring->ij = mface[i].v1; - spring->kl = mface[i].v3; + spring->ij = MIN2(mface[i].v1, mface[i].v3); + spring->kl = MAX2(mface[i].v3, mface[i].v1); VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x ); spring->restlen = sqrt ( INPR ( temp, temp ) ); spring->type = CLOTH_SPRING_TYPE_SHEAR; @@ -1279,8 +1275,8 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) { spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" ); - spring->ij = mface[i].v2; - spring->kl = mface[i].v4; + spring->ij = MIN2(mface[i].v2, mface[i].v4); + spring->kl = MAX2(mface[i].v4, mface[i].v2); VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x ); spring->restlen = sqrt ( INPR ( temp, temp ) ); spring->type = CLOTH_SPRING_TYPE_SHEAR; @@ -1316,8 +1312,8 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) { spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" ); - spring->ij = tspring2->ij; - spring->kl = index2; + spring->ij = MIN2(tspring2->ij, index2); + spring->kl = MAX2(tspring2->ij, index2); VECSUB ( temp, cloth->verts[index2].x, cloth->verts[tspring2->ij].x ); spring->restlen = sqrt ( INPR ( temp, temp ) ); spring->type = CLOTH_SPRING_TYPE_BENDING; |