0

I have an applet that displays a spline using JFreeChart. Is there a way to get a string representation of the piecewise polynomial? I can write a method that uses getX and getY from XYSeries to calculate it myself, but I'm just wondering if there's a built in way. I could not find it in the JFreeChart api, but perhaps I missed it. I also looked around for other libraries but found nothing.

Paul Lombardi
  • 131
  • 2
  • 2
  • 9
  • I wrote two methods that write the splines to a string. Some people might find the method that gives the cubic polynomial from 4 known coordinates useful. Calculating the coefficients was particularly tricky, but I found Maple to be helpful. – Paul Lombardi Nov 19 '12 at 19:56
  • The add comment feature here says I can't post that many characters. Is there any way I can post my code? – Paul Lombardi Nov 19 '12 at 20:09

1 Answers1

1

The parent class of XYSplineRenderer is XYLineAndShapeRenderer that contains a nested State class holding the GeneralPath from which you can obtain the PathIterator. This related example examines the PathIterator of a Polygon, which contains only straight line segments. Presumably, a GeneralPath will include quadratic and cubic segments.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045