From 2cd0b3f06470f2cb972dc626b5346f56abd67096 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 27 Jul 2012 23:16:33 +0000 Subject: defines to make it easier to manage ik stretch constants (these may need to be tweaked to fix [#32174]) --- intern/iksolver/extern/IK_solver.h | 3 +++ intern/iksolver/intern/IK_Solver.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'intern/iksolver') diff --git a/intern/iksolver/extern/IK_solver.h b/intern/iksolver/extern/IK_solver.h index 7f780a0a17f..a3f599e06c8 100644 --- a/intern/iksolver/extern/IK_solver.h +++ b/intern/iksolver/extern/IK_solver.h @@ -163,6 +163,9 @@ float IK_SolverGetPoleAngle(IK_Solver *solver); int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations); +#define IK_STRETCH_STIFF_EPS 0.001f +#define IK_STRETCH_STIFF_MIN 0.001f +#define IK_STRETCH_STIFF_MAX 1e10 #ifdef __cplusplus } diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp index 8c19c0e2a74..6c2e30932bb 100644 --- a/intern/iksolver/intern/IK_Solver.cpp +++ b/intern/iksolver/intern/IK_Solver.cpp @@ -201,8 +201,8 @@ void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness) if (stiffness < 0.0f) return; - if (stiffness > 0.999f) - stiffness = 0.999f; + if (stiffness > (1.0 - IK_STRETCH_STIFF_EPS)) + stiffness = (1.0 - IK_STRETCH_STIFF_EPS); IK_QSegment *qseg = (IK_QSegment *)seg; MT_Scalar weight = 1.0f - stiffness; -- cgit v1.2.3