stoefln
stoefln

Reputation: 14585

How to smooth paths (android)

I have an array with polygon coordinates, which I'm drawing currently with the Path object (android API). The points of the polygon are added when the users draws with his/her finger on the screen. I get a lot of points, even if the user tries to draw a straight line.

The thing is: On straight path segments, I would like to dump some of the coordinates in order to do some interpolation between the major points of the path. If you ever tried the skitch app, you know that it draws very smooth paths- thats exactly the thing I would like to have.

Is there any algorithm around, to achieve this?

Upvotes: 4

Views: 12354

Answers (1)

stoefln
stoefln

Reputation: 14585

This looks very promising: https://stackoverflow.com/a/8289516/457059

I only tried the first version (quadTo) of it by now, but it already works pretty good. One thing which is still missing though, is the dropping of points. If you got too much points, interpolation between them doesn't do the right job.

Upvotes: 2

Related Questions