views:

1539

answers:

3
+1  A: 

curvefitting.sourceforge.net looks like it may be suitable. It offers a variety of methods (cubic spline, polynomial etc).

Brian Agnew
I found that one too, but the documentation is all in german, and the source code isn't provided.
Russell Leggett
I'd hope the source code *is* provided, since it's on Sourceforge. Have you looked at the source code repository ?
Brian Agnew
one would think, but I browsed cvs and there are no files there
Russell Leggett
It's in the .jar file. Doesn't appear to be in the CVS repository though :-(
Brian Agnew
Sorry. Just saw your additional comment re. CVS. Can't help you on the German, but I'd hope (!) the Java is relatively clear
Brian Agnew
ah, so it is. wasn't expecting that!
Russell Leggett
A: 

I've never done it, but a quick Google search revealed that Bezier curves are implemented in http://java.sun.com/j2se/1.5.0/docs/api/java/awt/geom/QuadCurve2D.Double.html

Then, you can getPathIterator() from this curve and with that, according to what documentation says, you get the "coordinates of shape boundaries", which, i suppose, is what you are looking for.

zilupe
No, he does not want to do this. He needs to compute control points of the curve using spline interpolation or some heuristics method.
Matej
I suggest you better read http://en.wikipedia.org/wiki/Spline_(mathematics) and http://en.wikipedia.org/wiki/B%C3%A9zier_curveBezier curves is one of the ways to model these curves. By having the coordinates of points on this curve, he effectively gets what he wants.
zilupe
A: 

After more searching into splines, I found this little bit of Java code for doing them in an applet. The source is provided and looks pretty straightforward. I should be able to adapt it to my needs. It is especially nice because the cubics it generates are objects I can easily use for my own needs and separate it from the paint function.

Thanks "lambert"!

Russell Leggett