diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-02 11:28:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-02 11:28:27 +0300 |
commit | ae573836483d6acc56761918336cb8d2b0486d08 (patch) | |
tree | a9bb8a66c543824ae876c18f299fd176a952619e /source/blender/blenkernel/intern/softbody.c | |
parent | 6abb37babc6aad9d7f262b1516b7a0e2972cb8e1 (diff) |
Cleanup: comment blocks
Diffstat (limited to 'source/blender/blenkernel/intern/softbody.c')
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 3ab55b3705a..1f5cefd47d7 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -30,24 +30,22 @@ */ -/* -****** -variables on the UI for now - - float mediafrict; friction to env - float nodemass; softbody mass of *vertex* - float grav; softbody amount of gravitaion to apply - - float goalspring; softbody goal springs - float goalfrict; softbody goal springs friction - float mingoal; quick limits for goal - float maxgoal; - - float inspring; softbody inner springs - float infrict; softbody inner springs friction - -***** -*/ +/** + * variables on the UI for now + * <pre> + * float mediafrict; friction to env + * float nodemass; softbody mass of *vertex* + * float grav; softbody amount of gravitaion to apply + * + * float goalspring; softbody goal springs + * float goalfrict; softbody goal springs friction + * float mingoal; quick limits for goal + * float maxgoal; + * + * float inspring; softbody inner springs + * float infrict; softbody inner springs friction + * </pre> + */ #include <math.h> @@ -256,16 +254,16 @@ static float _final_mass(Object *ob, BodyPoint *bp) /*+++ collider caching and dicing +++*/ -/******************** -for each target object/face the axis aligned bounding box (AABB) is stored -faces parallel to global axes -so only simple "value" in [min, max] ckecks are used -float operations still -*/ +/* + * for each target object/face the axis aligned bounding box (AABB) is stored + * faces parallel to global axes + * so only simple "value" in [min, max] ckecks are used + * float operations still + */ /* just an ID here to reduce the prob for killing objects -** ob->sumohandle points to we should not kill :) -*/ + * ob->sumohandle points to we should not kill :) + */ static const int CCD_SAVETY = 190561; typedef struct ccdf_minmax { @@ -732,8 +730,8 @@ static void add_bp_springlist(BodyPoint *bp, int springID) } /* do this once when sb is build -it is O(N^2) so scanning for springs every iteration is too expensive -*/ + * it is O(N^2) so scanning for springs every iteration is too expensive + */ static void build_bps_springlist(Object *ob) { SoftBody *sb= ob->soft; /* is supposed to be there */ @@ -925,29 +923,29 @@ static void free_softbody_intern(SoftBody *sb) /* ************ dynamics ********** */ /* the most general (micro physics correct) way to do collision -** (only needs the current particle position) -** -** it actually checks if the particle intrudes a short range force field generated -** by the faces of the target object and returns a force to drive the particel out -** the strenght of the field grows exponetially if the particle is on the 'wrong' side of the face -** 'wrong' side : projection to the face normal is negative (all referred to a vertex in the face) -** -** flaw of this: 'fast' particles as well as 'fast' colliding faces -** give a 'tunnel' effect such that the particle passes through the force field -** without ever 'seeing' it -** this is fully compliant to heisenberg: h >= fuzzy(location) * fuzzy(time) -** besides our h is way larger than in QM because forces propagate way slower here -** we have to deal with fuzzy(time) in the range of 1/25 seconds (typical frame rate) -** yup collision targets are not known here any better -** and 1/25 second is looong compared to real collision events -** Q: why not use 'simple' collision here like bouncing back a particle -** --> reverting is velocity on the face normal -** A: because our particles are not alone here -** and need to tell their neighbors exactly what happens via spring forces -** unless sbObjectStep( .. ) is called on sub frame timing level -** BTW that also questions the use of a 'implicit' solvers on softbodies -** since that would only valid for 'slow' moving collision targets and dito particles -*/ + * (only needs the current particle position) + * + * it actually checks if the particle intrudes a short range force field generated + * by the faces of the target object and returns a force to drive the particel out + * the strenght of the field grows exponetially if the particle is on the 'wrong' side of the face + * 'wrong' side : projection to the face normal is negative (all referred to a vertex in the face) + * + * flaw of this: 'fast' particles as well as 'fast' colliding faces + * give a 'tunnel' effect such that the particle passes through the force field + * without ever 'seeing' it + * this is fully compliant to heisenberg: h >= fuzzy(location) * fuzzy(time) + * besides our h is way larger than in QM because forces propagate way slower here + * we have to deal with fuzzy(time) in the range of 1/25 seconds (typical frame rate) + * yup collision targets are not known here any better + * and 1/25 second is looong compared to real collision events + * Q: why not use 'simple' collision here like bouncing back a particle + * --> reverting is velocity on the face normal + * A: because our particles are not alone here + * and need to tell their neighbors exactly what happens via spring forces + * unless sbObjectStep( .. ) is called on sub frame timing level + * BTW that also questions the use of a 'implicit' solvers on softbodies + * since that would only valid for 'slow' moving collision targets and dito particles + */ /* +++ dependency information functions*/ @@ -1704,11 +1702,11 @@ static int sb_detect_vertex_collisionCached( if (mprevvert) { /* grab the average speed of the collider vertices - before we spoil nvX - humm could be done once a SB steps but then we' need to store that too - since the AABB reduced propabitlty to get here drasticallly - it might be a nice tradeof CPU <--> memory - */ + * before we spoil nvX + * humm could be done once a SB steps but then we' need to store that too + * since the AABB reduced propabitlty to get here drasticallly + * it might be a nice tradeof CPU <--> memory + */ sub_v3_v3v3(vv1, nv1, mprevvert[vt->tri[0]].co); sub_v3_v3v3(vv2, nv2, mprevvert[vt->tri[1]].co); sub_v3_v3v3(vv3, nv3, mprevvert[vt->tri[2]].co); @@ -1809,7 +1807,8 @@ static int sb_deflect_face(Object *ob, float *actpos, float *facenormal, float * return(deflected); } -/* hiding this for now .. but the jacobian may pop up on other tasks .. so i'd like to keep it +/* hiding this for now .. but the jacobian may pop up on other tasks .. so i'd like to keep it */ +#if 0 static void dfdx_spring(int ia, int ic, int op, float dir[3], float L, float len, float factor) { float m, delta_ij; @@ -1845,7 +1844,8 @@ static void dfdv_goal(int ia, int ic, float factor) int i; for (i=0;i<3;i++) EIG_linear_solver_matrix_add(ia+i, ic+i, factor); } -*/ +#endif /* if 0 */ + static void sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, float UNUSED(forcetime)) { SoftBody *sb= ob->soft; /* is supposed to be there */ @@ -2248,7 +2248,7 @@ static void softbody_calc_forces(struct Depsgraph *depsgraph, Scene *scene, Obje /* rule we never alter free variables :bp->vec bp->pos in here ! * this will ruin adaptive stepsize AKA heun! (BM) - */ + */ SoftBody *sb= ob->soft; /* is supposed to be there */ BodyPoint *bp; /* BodyPoint *bproot; */ /* UNUSED */ @@ -2417,16 +2417,16 @@ static void softbody_calc_forces(struct Depsgraph *depsgraph, Scene *scene, Obje if (sb_deflect_face(ob, bp->pos, facenormal, defforce, &cf, timenow, vel, &intrusion)) { if (intrusion < 0.0f) { if (G.debug_value & 0x01) { // 17 we did check for bit 0x10 before - /*fixing bug [17428] this forces adaptive step size to tiny steps - in some situations .. keeping G.debug_value==17 option for old files 'needing' the bug - */ - /*bjornmose: uugh.. what an evil hack - violation of the 'don't touch bp->pos in here' rule - but works nice, like this--> - we predict the solution being out of the collider - in heun step No1 and leave the heun step No2 adapt to it - so we kind of introduced a implicit solver for this case - */ + /* fixing bug [17428] this forces adaptive step size to tiny steps + * in some situations .. keeping G.debug_value==17 option for old files 'needing' the bug + */ + /* bjornmose: uugh.. what an evil hack + * violation of the 'don't touch bp->pos in here' rule + * but works nice, like this--> + * we predict the solution being out of the collider + * in heun step No1 and leave the heun step No2 adapt to it + * so we kind of introduced a implicit solver for this case + */ madd_v3_v3fl(bp->pos, facenormal, -intrusion); } else { @@ -2498,10 +2498,10 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float * /* old one with homogeneous masses */ /* claim a minimum mass for vertex */ - /* - if (sb->nodemass > 0.009999f) timeovermass = forcetime/sb->nodemass; - else timeovermass = forcetime/0.009999f; - */ +#if 0 + if (sb->nodemass > 0.009999f) timeovermass = forcetime / sb->nodemass; + else timeovermass = forcetime / 0.009999f; +#endif for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) { /* now we have individual masses */ @@ -2697,11 +2697,11 @@ static void softbody_swap_state(Object *ob, float *ppos, float *pvel) /* care for bodypoints taken out of the 'ordinary' solver step -** because they are screwed to goal by bolts -** they just need to move along with the goal in time -** we need to adjust them on sub frame timing in solver -** so now when frame is done .. put 'em to the position at the end of frame -*/ + * because they are screwed to goal by bolts + * they just need to move along with the goal in time + * we need to adjust them on sub frame timing in solver + * so now when frame is done .. put 'em to the position at the end of frame + */ static void softbody_apply_goalsnap(Object *ob) { SoftBody *sb= ob->soft; /* is supposed to be there */ @@ -2766,9 +2766,9 @@ static void interpolate_exciter(Object *ob, int timescale, int time) /* ************ convertors ********** */ -/* for each object type we need; - - xxxx_to_softbody(Object *ob) : a full (new) copy, creates SB geometry -*/ +/* for each object type we need; + * - xxxx_to_softbody(Object *ob) : a full (new) copy, creates SB geometry + */ /* Resetting a Mesh SB object's springs */ /* Spring length are caculted from'raw' mesh vertices that are NOT altered by modifier stack. */ |