Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

groupTransform.rotate.angle Truncates

It took me AGES to discover this.

 

I'm wanting to draw nicely (and precisely) angled ramp shapes. On the simulator, I can get:

SimSim

Note the nice sharp corners on the sloped top.

 

On my Ionic, the same code gives:

IonicIonicNote 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.

Peter McLennan
Gondwana Software
Best Answer
0 Votes
3 REPLIES 3

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)

 

 

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Thanks for reporting this one, we're now tracking it internally!

Best Answer

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. 😉

Peter McLennan
Gondwana Software
Best Answer
0 Votes