Skip to content Skip to sidebar Skip to footer

Graphics On Android: Path With Smooth Curves?

I want to draw a chart for a function y=x^2 as follows: but the curve is not smooth as it is a set of connected lines. how can I make the curve smoother ? thanks

Solution 1:

You should use Path.quadTo with only one Path. If you are already doing this then I suggest increasing the number of points on the graph.

Move to the beginning of the Path:

Path.moveTo(x, y)

in the middle:

Path.quadTo(lastX, lastY, (x + lastX)/2, (y + lastY)/2)

and at the end:

Path.lineTo(x, y)

Post a Comment for "Graphics On Android: Path With Smooth Curves?"