Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understanding of the formula of the relation between grams and force (iOS10) #2

Open
ghost opened this issue Jul 14, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Jul 14, 2019

According to the explanation of this article, I understand how to reason the previous version of this formula:

weight.innerHTML  = (((force - tareForce) * maxForce) / forceConversions[fcIndex]).toFixed(2) + 'g';

However, the newest version of this formula (support iOS 10) is updated as below:

function weigh(force) {
  
   var tare = force - tareForce;
   var grams = (tare * 405.257 * forceConversions[fcIndex] + 2.056 * forceConversions[fcIndex]);
   if(grams < 12)
   grams -= 2.056 * forceConversions[fcIndex];
   return grams.toFixed(2);
   };

May I know how you got this formula eventually? Re-doing the experiment as that in the first version (written in the article), recording data and then generating this new formula?

What had been updated for 3D touch in iOS 10?

Thank you.

@ashertrockman
Copy link
Owner

ashertrockman commented Jul 14, 2019

It has been a while since I updated this for iOS 10, and I don't think I made any notes on the process, so I don't have specifics.

I think iOS 10 just involved some API changes for 3D touch, and I tried to improve the formula at the same time (regardless of iOS 10 or new hardware). If I recall correctly, I gathered more data (still on an iPhone 6S), and noticed that the metric was a bit high for lighter weights (thus < 12), and hence removed the intercept (2.056 * forceConversions[fcIndex]) in that case. I believe that I validated that this worked decently well on an iPhone 6S and an iPhone 8.

@ghost
Copy link
Author

ghost commented Jul 15, 2019

@ashertrockman Thank you for your reply, I got it right now. The approach that you used is impressive and it inspired me. Thank you.

@ashertrockman
Copy link
Owner

No problem, and thanks! Good luck with your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant