PerlinNoiseGenerator - how?

Hi,

I’m currently trying to get my program running well on jruby rather than
MRI, to see if it can solve some issues I’m having with MRI (primarily
to do with garbage collection, but having real threads may turn out to
be very useful too). Part of the program involves perlin noise, and I
have been using a ruby c gem that runs very fast. The perlin_noise gem
based on pure ruby is very slow. Someone recommended I try this:
http://code.j3d.org/javadoc/org/j3d/texture/procedural/PerlinNoiseGenerator.html

However, being unfamiliar with both java and jruby, I don’t know how to
get this working. I’ve tried:

require ‘java’

module Java3D
include_package “org.j3d.texture.procedural”
end

class Generator
include Java3D
def initialize
@test = Java3D::PerlinNoiseGenerator.noise2(4,4)
@test = Java3D::PerlinNoiseGenerator(4,4,4)
end
end

Neither of these @test assignments work (I did not try both at once, of
course). Is there something I might be missing?

I’m running this on mac osx, and installed jruby via rvm (jruby-1.7.1).

Thanks!

This is the section of the wiki you need to read:

The bit it looks like you are missing is requiring the jar file.

require ‘path/to/mycode.jar’

I personally prefer java_import over include_package, but that is
probably
just my preference.

Although some errors messages / stack traces of what is going wrong
would
be useful, as I can only assume this is your issue.

Mark

On Thu, Jan 17, 2013 at 3:54 PM, Na Na [email protected] wrote:

class Generator
I’m running this on mac osx, and installed jruby via rvm (jruby-1.7.1).


E: [email protected]
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

2 Devs from Down Under Podcast
http://www.2ddu.com/