https://kotlinlang.org logo
#compose
Title
# compose
l

Lucien Guimaraes

03/02/2023, 2:15 PM
Following the

youtube video

Introduction to drawing in Compose
I implemented in my app a graph of elevation gain / loss for trails. It's working really great except when I have a lot of points (in my screenshots example it's 1998 points). Angle between points are rectangular instead of being smooth like it should with a Bezier. Any idea what could be the issue? 🤔
If I reduce the amount of points (for example if
previousPoint.altitude == currentPoint.altitude
, I don't add the current point to the list) it's way better. I though that with quadratic curves it's impossible to have rectangular angles
image.png
s

shikasd

03/02/2023, 2:41 PM
It is likely that you have more points that pixels on screen at this point, so start and end point are the same (or 1px away), making it impossible to smooth out. Consider sampling min/max or average over number of points instead to reduce the amount 🙂
l

Lucien Guimaraes

03/02/2023, 2:44 PM
Ok thanks, that makes sense!
Just out of curiosity, what is causing this limitation? On iOS they are able to smooth the graph with this number of points. Is it the rendering engine of Android? 🤔
s

shikasd

03/02/2023, 4:20 PM
It's likely just a stroke cap parameter or something similar
Not quite sure, tbh
2 Views