Cornu/Clothoid
BlitzMax Forums/BlitzMax Programming/Cornu/Clothoid
| ||
Hi! I am searching for an implementation of Cornu/Clothoid curves, apparently this is the favored curve interpolation for road design. Has anyone worked on that in Blitzmax? http://en.wikipedia.org/wiki/Clothoid#Cornu_spiral And a demo... http://igor.grafitron.com/cornu/ |
| ||
I have no idea, but I'm always interested in new interpolations. This could help with what I'm doing today, quite coincidentally, so I searched all over for some idea of how it's done and found nothing. |
| ||
I've just remembered I can still use my uni's journals account! I will investigate. |
| ||
If you have a look at the file __init__.py in this zip, there's a fairly clean implementation of cornu curves that should be possible to port to bmax. |
| ||
I was having a look at this too... interesting stuff. Maybe I'm being hopelessly naive, but going by that Wiki link ("The Cornu spiral, also known as clothoid, is the curve generated by a parametric plot of S(t) against C(t)"), I get the impression that for a simple plot you'd just need the fresnel C/S functions and the associated tables, then you plot x using the fresnel C function and y using the S function. I think 't' (passed to each function) just gets increased/decreased through a range of values (being the position along the curve), ie. x = C(t) and y = S(t). (Whaddya think, Warpy, am I being hopelessly naive? It seems very likely.) Fresnel integrals: http://netlib.org/cephes/ [see misc.tgz] The link at the bottom of that demo page has a Java version too: http://igor.grafitron.com/cornu/Cornu.java And there's one here, too, though the PDF won't open with Foxit Reader, but perhaps the official Adobe reader will do it: http://www.fizyka.umk.pl/nrbook/bookcpdf.html |
| ||
the tricky part is deciding where to put your circle spirals! The x/y co-ords in the wiki link are just for the classical cornu spiral. What we want is a set of spiral transitions between control points. Can't open your first link, that java thing is exactly what's being displayed in LAB's link, third link doesn't open in the adobe reader either. |
| ||
Somebody with a good knowledge of Java or Nodebox's Python would sure be able to port one these libs to Blitzmax. There are way too much Classes I don't know to decipher the code. In the meantime I found a library in C called libspiro(libspiro.sourceforge.net), it is by Ralph Levien, seems to be the starting point of all. James' first link is implemented in the java lib at the very bottom (cephes). |
| ||
I don't manage // I don't have enough time. I'll pay somebody to port it to Blitzmax, send me a mail if you are interested... |
| ||
I'd be interested but can't stand the smell of gpl + patented technology. |
| ||
can't stand the smell of gpl Me neither... |
| ||
What is the problem? The ported library would be available under gpl too. In my opinion the patent is just another legal shield. I am not too hot about gpl myself, but I'd rather embrace it than reinventing the wheel. |