Show HN: Implementing a trackball with rational numbers
grondilu.github.io
grondilu.github.io
Here is the output:
a00 = 1432521999387336201000162233364364261412422778723249988532277223673502336434725335337083644796278416082366180670944929785069345/5986547728315893919428066873527575391908390247143416149511995033033437392431374342833088545303961365118098478697976518989268769 a00.valueOf() = 0.23929016595184258
A big framerate drop is to be expected after several rotations, as the numerators and denominators become very big.
Apparently this happens when .valueOf() becomes NaN. I'll modify the code to display that value. Heck, I'll show the floating point approximation for the whole matrix.
.valueOf() becoming NaN is probably related to the behavior of big-rational.js. I suppose it does:
x => x.num.valueOf()/x.denom.valueOf()
instead of doing a custom division of x.num by x.denomPS. yep, it does just that:
https://github.com/peterolson/BigRational.js/blob/master/Big...
Browser: Firefox OS: Ubuntu