Optimizing a drawing (with finger touches) application for iPhone SDK

前端 未结 5 1419
梦如初夏
梦如初夏 2021-02-04 19:35

I\'m writing an application that uses your finger to draw simple diagrams. I have it working for the most part but now I\'m trying to optimize its performance. When the user swi

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 19:52

    Another approach is to interpolate the curve between the sample points. When the finger drag starts, begin collecting sample points. As the number of points increase, redraw the line. With two points, draw a straight line, with three or more draw a curve. You can re-start the process when two points are sampled that lie within a defined distance. This would allow you to draw two arcs (like a 'm') in one motion - you naturally pause in the middle as you change direction, possibly long enough for two or more samples.

提交回复
热议问题