0

I am learning quartz for ios development. And I want to write a chart class to draw smooth curve, and I can only know how many points there are in runtime. Please give me some solutions to achieve this.

Now I use UIBeizerPath, but I cannot use the control point well, there's very obvious corner in it.

Thanks and best regards.

shashoukou
  • 181
  • 1
  • 6

1 Answers1

1

To work out control points in Bezier curves draw a imaginary line from the actual point which is at a tangent to the curve you wish to create.

Think about missing a bend when driving a car. Car goes straight ahead while curve does its curve thing. The distance of the control point (car) from the actual point determines the amount of curve.

This answer has the raw principles as an answer to your question

how can i trace the finger movement on touch for drawing smooth curves?

But try researching C and C++ code for bezier curve smoothing and interpolation if you dont want to bake it yourself. You can use any C or C++ in a Objective C project.

Good Luck

Community
  • 1
  • 1
Warren Burton
  • 17,451
  • 3
  • 53
  • 73
  • I got this problem solved by reading through the cubic spline interpolation algorithm. Any one who encountered this problem too can see:http://en.wikipedia.org/wiki/Spline_interpolation. I suggest you to use nature cubic spline interpolation which set the 2th derivative of point 0 and point n as 0. And to Warren Burton, thank you very much, I got good reference from the link you suggested. – shashoukou Jul 28 '11 at 15:06