implementing free hand drawing in ipad points missing problem

358 views Asked by At

i am making a free hand ipad drawing app like "brushes" with some kind of brushes. my problem is that touchmove event misses some points on fast moving.

so i want to get all these intermediate points between previous location and current location to plot brush pattern.

i implemented bresenham line algorthm to get all these points but it slows the performance can you please guide me what is the best way to do this.

Thanks .

1

There are 1 answers

0
Ben Zotto On

If you're using Core Graphics like the question tag implies, why not just draw a CG path from each point to the next one?

Also, Bresenham is really for pixel-level rasterization, which is almost certainly not what you're actually trying to do. Your coordinates are almost certainly floating point (they are if you're in Core Graphics) and can be non-integral. (And FWIW I'm surprised that Bresenham is slow here. It's not a computationally intensive technique, and since we're long past the 286 days, I can't imagine that's your bottleneck.)