I'm making a line graph on the iphone using core graphics and instead of having a jagged chart, I want to smooth it out like in good old math class. What's the formula to pick where to put the control points for CGContextAddCurveToPoint?
CGFloat cp2x = (x + x + prevX);
CGFloat cp1y = (prevY + prevY + y);
CGFloat cp1x = (prevX + prevX + x);
CGFloat cp2y = (y + y + prevY);
CGContextAddCurveToPoint(context, cp1x, cp1y, cp2x, cp2y, x, y);
This code almost works but doesn't take into account 3 points.