Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2006

Tip: Looking for answers? Try searching our database.

Cardinal spline in Java?

Thread view: 
jmlouthi@yahoo.com - 31 May 2006 07:59 GMT
In .NET, the Graphics class has a DrawCurve method that takes an array
of points and renders a cardinal spline that interpolates all the
points.

I can't find anything comparable built into Java's graphics subsystem.
Neither QuadCurve2D nor CubicCurve2D are interpolating curves, which is
what I need.

Does anyone know if there's something I'm missing? If it's not built in
to the JDK, does anyone know where I could get an implementation?

Thanks!
Thomas Weidenfeller - 31 May 2006 09:04 GMT
> I can't find anything comparable built into Java's graphics subsystem.
> Neither QuadCurve2D nor CubicCurve2D are interpolating curves, which is
> what I need.

It should be possible to use cubic curve segments to construct what you
want. You have to calculate the control points for each curve segment in
a way that the first (or was it the second? I forgot the details)
derivative of a curve and its adjacent curve are equal.

But I would not use CubicCurve2D. Instead, in the same way (matching
derivatives), it should be possible to assemble the curve into a
GeneralPath by using GeneralPath.cureveTo(). You then just stroke() that
path on a Graphics2D.

Don't ask me about the details of the calculations. It is ages ago that
I had to do it, but it wasn't too difficult.

The comp.lang.java.gui FAQ has some pointer to a computer graphics FAQ
and newsgroup. Maybe you can find the details there.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

jmlouthi@yahoo.com - 31 May 2006 22:58 GMT
Thanks for the help! I have done lots of server-side Java, as well as
server-side and client-side .NET. However, I'm pretty new to
rich-client Java. The FAQ you provided looks like a fantastic resource!

> > I can't find anything comparable built into Java's graphics subsystem.
> > Neither QuadCurve2D nor CubicCurve2D are interpolating curves, which is
[quoted text clipped - 21 lines]
> ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
> http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Stephan Collet - 31 May 2006 12:05 GMT
> In .NET, the Graphics class has a DrawCurve method that takes
> an array of points and renders a cardinal spline that
[quoted text clipped - 7 lines]
> built in to the JDK, does anyone know where I could get an
> implementation?

May be this helps:
http://www.cse.unsw.edu.au/~lambert/splines/

Signature

Viele Grüße,
Stephan Collet

jmlouthi@yahoo.com - 31 May 2006 22:59 GMT
Thanks very much. This looks almost exactly like what I was looking
for, and I appreciate your help!

> > In .NET, the Graphics class has a DrawCurve method that takes
> > an array of points and renders a cardinal spline that
[quoted text clipped - 10 lines]
> May be this helps:
> http://www.cse.unsw.edu.au/~lambert/splines/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.