Fixed numerical issues, hardened it again.

This commit is contained in:
Daniel Genrich 2007-11-22 17:02:37 +00:00
parent 4cb5470f82
commit 83c1dd78a6
3 changed files with 507 additions and 764 deletions

@ -72,8 +72,8 @@ typedef struct ClothSpring {
int matrix_index; /* needed for implicit solver (fast lookup) */
int type; /* types defined in BKE_cloth.h ("springType") */
int flags; /* defined in BKE_cloth.h, e.g. deactivated due to tearing */
float dfdx[3][4];
float dfdv[3][4];
float dfdx[3][3];
float dfdv[3][3];
float f[3];
} ClothSpring;
@ -91,13 +91,13 @@ typedef struct Cloth {
unsigned int numothersprings;
unsigned int numspringssave;
unsigned int old_solver_type;
float (*x)[4]; /* The current position of all vertices.*/
float (*xold)[4]; /* The previous position of all vertices.*/
float (*current_x)[4]; /* The TEMPORARY current position of all vertices.*/
float (*current_xold)[4]; /* The TEMPORARY previous position of all vertices.*/
float (*x)[3]; /* The current position of all vertices.*/
float (*xold)[3]; /* The previous position of all vertices.*/
float (*current_x)[3]; /* The TEMPORARY current position of all vertices.*/
float (*current_xold)[3]; /* The TEMPORARY previous position of all vertices.*/
float (*v)[4]; /* the current velocity of all vertices */
float (*current_v)[4];
float (*xconst)[4];
float (*current_v)[3];
float (*xconst)[3];
} Cloth;
/* goal defines */

@ -898,14 +898,13 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
if (solvers [clmd->sim_parms->solver_type].init)
solvers [clmd->sim_parms->solver_type].init (ob, clmd);
clmd->clothObject->tree = bvh_build_from_float4(CDDM_get_faces(dm), dm->getNumFaces(dm), clmd->clothObject->x, numverts, clmd->coll_parms->epsilon);
clmd->clothObject->tree = bvh_build_from_float3(CDDM_get_faces(dm), dm->getNumFaces(dm), clmd->clothObject->x, numverts, clmd->coll_parms->epsilon);
clmd->clothObject->selftree = bvh_build_from_float4(NULL, 0, clmd->clothObject->x, numverts, clmd->coll_parms->selfepsilon);
clmd->clothObject->selftree = bvh_build_from_float3(NULL, 0, clmd->clothObject->x, numverts, clmd->coll_parms->selfepsilon);
// save initial state
cloth_write_cache(ob, clmd, framenr-1);
}
return 1;
default: return 0; // TODO - we do not support changing meshes
}

File diff suppressed because it is too large Load Diff