From 520922876a1f7618319038728ca14a18276287d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Thu, 25 Sep 2014 15:42:08 +0200 Subject: Target calculation for local non-straight rest shapes. This is more involved than using simple straight bending targets constructed from the neighboring segments, but necessary for restoring groomed rest shapes. The targets are defined by parallel-transporting a coordinate frame along the hair, which smoothly rotates to avoid sudden twisting (Frenet frame problem). The rest positions of hair vertices defines the target vectors relative to the frame. In the deformed motion state the frame is then recalculated and the targets constructed in world/root space. --- source/blender/physics/intern/BPH_mass_spring.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/physics/intern/BPH_mass_spring.cpp') diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp index 56923b6603a..458a8f27ee7 100644 --- a/source/blender/physics/intern/BPH_mass_spring.cpp +++ b/source/blender/physics/intern/BPH_mass_spring.cpp @@ -426,6 +426,13 @@ BLI_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, /* XXX assuming same restlen for ij and jk segments here, this can be done correctly for hair later */ BPH_mass_spring_force_spring_bending_angular(data, s->ij, s->kl, s->mn, s->matrix_ij_kl, s->matrix_kl_mn, s->matrix_ij_mn, s->restlen, s->restlen, kb, cb); + + { + float x[3], v[3], d[3]; + BPH_mass_spring_get_motion_state(data, s->kl, x, v); + mul_v3_v3fl(d, s->target, clmd->sim_parms->avg_spring_len); + BKE_sim_debug_data_add_vector(clmd->debug_data, x, d, 0.4, 0.4, 1, "target", hash_vertex(7982, s->kl)); + } #endif } } -- cgit v1.2.3