11-16-2018 20:02
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
11-16-2018 20:02
It took me AGES to discover this.
I'm wanting to draw nicely (and precisely) angled ramp shapes. On the simulator, I can get:
Sim
Note the nice sharp corners on the sloped top.
On my Ionic, the same code gives:
IonicNote the inaccuracy of the corners on the sloped top.
After HOURS of wondering what I was doing wrong, I discovered that groupTransform.rotate.angle truncates the value assigned to it. This can result in an error of up to one degree, which is responsible for the artefacts I've observed.
This doesn't happen on the simulator, and would seem to be unnecessary: fractional angles are perfectly legitimate. Code would be faster and smaller if the input didn't need to be rounded (to reduce the magnitude of the error) then truncated (by the groupTransform code), and cleaner results would be obtained.
I gather that some simulator code eventually finds its way into physical devices. If so in this case, the problem will go away sometime. If not, it would be appropriate to fix this behaviour.
PS: I can't use pre-rendered images for these shapes because they're calculated at runtime based on the wearer's exercise goals, etc. I tried scaling images but that doesn't work well on physical devices.
Best Answer11-19-2018 18:11
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
11-19-2018 18:11
More evidence; here's a code snippet:
tiltEl.groupTransform.rotate.angle=317.953;
console.log("drawRamp() tiltEl.groupTransform.rotate.angle="+tiltEl.groupTransform.rotate.angle);Here's what the simulator says:
[13:04:48] App: drawRamp() tiltEl.groupTransform.rotate.angle=317.95298767089844 (app/graphics.js:189,1)
Here's what the Ionic says:
[13:06:43] App: drawRamp() tiltEl.groupTransform.rotate.angle=317 (app/graphics.js:189,1)
Best Answer11-23-2018 09:38
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
11-23-2018 09:38
Thanks for reporting this one, we're now tracking it internally!
11-23-2018 12:13
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
11-23-2018 12:13
Thanks. 🙂
There's a chance that rounding/truncating in rotation code could be responsible for other graphical artefacts that have been reported when rotating images or other elements, so there's some extra incentive for you. 😉
Best Answer