Instead of connecting to points using straight lines ( CGPathAddLineToPoint
), you should try using Bezier curves: CGPathAddCurveToPoint
or CGPathAddQuadCurveToPoint
.
This is what smoothing will do.
If you are not familiar with Bezier curves , you will probably find a Wikipedia page about Bezier curves (not just mathematical equations, but look at sketches and animated images). This will give you a general idea of how control points influence the smoothing of lines around the key points of your line.
For your case, there should be enough quadratic curves (only one control point for each sub-segment between your two key points).
(One line from P0 to P1, smoothed using breakpoint P1)
One example (out of the box, just a guess from my mind, never tested, didn't adapt the coefficients to your needs) to calculate this breakpoint C between each of your key points A and B to make AC, say, 2/3 of the length AB and (AB, AC) making an angle of 30 degrees or similar.
You can even suggest in the settings of your application to adjust the smoothing using the slider, which will affect the values that you choose to calculate each control point, and see which coefficients are best suited.
source share