I've used this code to implement a freehand drawing tool in Java and Graphics2D. So I have a Path2D made up of a lot points. Is there an algorithm to smooth this line? I don't mean anti-aliasing, I mean something like converting the path to a path of bezier curves. Something like this, but with a Path2D as input. I would think this a recurring problem but I couldn't really find something useful.
Asked
Active
Viewed 3,358 times
4
-
I was thinking after I posted my question I could maybe use the PathIterator for the algorithm I linked to. Will try later when I'm home. – Nicolas Mommaerts Apr 30 '12 at 06:22
1 Answers
9
I've found what I needed at: http://javagraphics.blogspot.com/2010/06/shapes-implementing-freehand-pencil.html
Edit: and since I now know the exact term for this problem (curve fitting) I can google it better and also found this post: Java curve fitting library
Edit: also look at http://johnsogg.blogspot.com/2010/01/cardinal-splines-and-catmull-rom.html

Community
- 1
- 1

Nicolas Mommaerts
- 3,207
- 4
- 35
- 55
-
I accepted my own answer, couldn't do it immediately though, SO forces you to wait 4 hours. – Nicolas Mommaerts May 02 '12 at 08:17