Skip to content
Prev 24257 / 29559 Next

Drawing the maximum-area rectangle in a non-convex polygon

On Tue, Apr 12, 2016 at 10:48 PM, Tiernan Martin
<tiernanmartin at gmail.com> wrote:
Check out the V8 and js packages. That script you linked to is
actually CoffeeScript, but that's a thin shell around Javscript and
"transpiling" to JS is covered in the vignettes of the V8 and js
packages somewhere. Then all you need to do (hah!) is load the d3
javascript library into a V8 context, pass some parameters, and run...
Simple... ummm... maybe.
I've had a quick look at the CoffeeScript and while it could be
converted to R there's a lot of looping and I suspect it might be
painfully slow unless you spend lots of time to consider the algorithm
so you can write it in properly idiomatic R. It might even benefit you
to rewrite it in C or C++....

Barry