From 50a6c35c24c1016e37dc8b785b393f2e50b24b09 Mon Sep 17 00:00:00 2001 From: spatialfree Date: Thu, 10 Nov 2022 15:07:41 -0500 Subject: [PATCH] rollup --- app/dofs/rolls-cursor/RollsCursor.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/dofs/rolls-cursor/RollsCursor.cs b/app/dofs/rolls-cursor/RollsCursor.cs index 770a374..1e623c2 100644 --- a/app/dofs/rolls-cursor/RollsCursor.cs +++ b/app/dofs/rolls-cursor/RollsCursor.cs @@ -23,7 +23,7 @@ class RollsCursor : dof { // Biased by finger length float stretch = (fI + fI + fM + fM + fM + fR + fR + fL) / 8f; - Vec3 to = Roll(hand, JointId.Tip, fI, fM, fR, fL); + Vec3 to = Roll(hand, JointId.KnuckleMid, fI, fM, fR, fL); Vec3 from = Roll(hand, JointId.KnuckleMajor, fI, fM, fR, fL); Vec3 dir = PullRequest.Direction(to, from); @@ -39,19 +39,17 @@ class RollsCursor : dof { // design public Design reach = new Design { str = "1.0", term = "0+m", min = 0 }; - // Roll - // based on flexion - // with a "recursive" lerp - // i - m - r - l - // im - mr - rl - // imr - mrl - // imrl public Vec3 Roll(Hand hand, JointId jointId, float fI, float fM, float fR, float fL) { Vec3 i = hand.Get(FingerId.Index, jointId).position; Vec3 m = hand.Get(FingerId.Middle, jointId).position; Vec3 r = hand.Get(FingerId.Ring, jointId).position; Vec3 l = hand.Get(FingerId.Little, jointId).position; + fI = PullRequest.Clamp(fI, 0.0001f, 1f); + fM = PullRequest.Clamp(fM, 0.0001f, 1f); + fR = PullRequest.Clamp(fR, 0.0001f, 1f); + fL = PullRequest.Clamp(fL, 0.0001f, 1f); + Vec3 im = Vec3.Lerp(i , m , fM / (fM + fI)); Vec3 mr = Vec3.Lerp( m , r , fR / (fR + fM)); Vec3 rl = Vec3.Lerp( r, l, fL / (fL + fR));