Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm using the TSR estimator for multitouch gestures that can be arbitrary number of points (something like
estimate('tsr', touchesBefore.map(clientPosition), touchesAfter.map(clientPosition))
). When doing this with some single-touch point sets, I found that the resulting transform hada === b === 0
– confusing because a single pointer pan should always be a valid translation, no?I looked into it – it looks like the specific points I was providing were causing a precision error when calculating
det
. Here's a test that fails on currentmaster
: https://github.com/davidisaaclee/nudged/blob/2594af5c79660ef805f8892b20c135151faf03e7/test/estimators/TSR.test.js#L100-L111Some other valid solutions:
T
estimator when I know I have one pointBut I'd prefer not to think about that stuff! so here's a PR that fixes this by just switching the order of
det
expression so that the terms that probably will cancel each other out are next to each other. I don't fully get why it works, but it makes the test pass.Thanks for the great library, I use it in almost every web app I make.