We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi
I'd like to have (what is usually known as) a Triangulate library work in JS in order to get a Delaunay triangulation. This request looks quite simple, but after days of wandering on the web, I still couldn't have any sketch run in JS mode.
The funny thing is that some people seem to have overcome that challenge (see http://www.openprocessing.org/sketch/117808 for example). But this is where it gets funny: this online sketch works perfectly fine on my computer. But after downloading it, I can't run it in local JS mode (in Java mode it works fine mind you). For the sake of it, I even tried to upload this sketch (on openprocessing.org) but this wouldn't work either.
Same thing happens with this sketch http://www.openprocessing.org/sketch/10728, except that it is not a class that is used, but a triangulate.jar file.
So my question is twofold: - how come that I can't run downloaded sketches locally in JS, even though they run online just fine? - what should I do to be able to run a sketch using a Triangulate (class or library) in JS, if possible?
Answers
Those 2 online examples are Java Applets! They're not running as JS scripts! [-(
Your best chances are re-writing your sketch in CoffeeScript Mode or P5.JS! :-B
Hello !
This code looks easy to translate
https://github.com/ironwallaby/delaunay/blob/master/delaunay.js
So this is my solution to the problem: http://www.openprocessing.org/sketch/172907 I modified the Triangulate class a bit, to get rid of anything not working in JS (especially the Collection.sort() method) :D
Thanks GoToLoop for telling me to stop banging my head against a wall that couldn't break :-B