开发者

How to draw a smooth curve in iphone while I can only get all the points in runtime?

I am learning quartz for ios development. And I want to write a chart class to draw s开发者_JS百科mooth 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜