Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Maths for Ruby
- - By Basic Date 2010-09-23 09:31
Okay, I've really lapsed with ruby in so many ways :(

What are people using for math in ruby? I have a cpp file full of math stuff that I use for anything cpp related are people doing this in ruby itself or is there a tasty gem out there that can help?

I would have thought lots of vectors/calculas and even things like square roots would take its toll on ruby? (not used 1.9) square roots are expensive in cpp as it is. An A* thing I did in ruby couldn't handle all the square roots so I faked it.

I know Gosu has rotations and translate. but I need MORE!!!

Parent - - By banister Date 2010-09-23 10:26
Parent - - By Basic Date 2010-09-25 06:30
oh that is cool :D
Parent - - By jlnr (dev) Date 2010-09-25 07:24
Until you want to deploy it I guess. Wow, that sounds like hell. :D
Parent - - By Spooner Date 2010-09-25 16:55 Edited 2010-09-26 08:14
I have put RubyInline code into an Ocra executable and it would work fine for other people who don't have the devkit! You just have to ensure that the inline dll cache is saved locally, rather than in the default and include that with Ocra. Remember, you only need the dev-kit or to recompile if the source files change!

(Use "ENV['INLINEDIR']" to tell RubyInline where to save/load the compiled code somewhere inside your project)

Hmm, so it is perfectly usable for Windows/Linux then, but not in OS X until the gem gets compiled into the Gosu .app. Has potential, anyway!
Parent - By jlnr (dev) Date 2010-09-25 23:45
Even then it would only work on Mac systems with Xcode installed. But maybe you could enable the DLL cache and run it both in 32-bit and 64-bit mode on a Mac, just like with the Windows version.
Parent - - By jlnr (dev) Date 2010-09-25 07:28
I don't think square roots are a big problem nowadays, except on platforms without a real FPU such as the iOS devices. The allocation of Float objects, which live on the heap and garbage-collected, plus the general overhead of calling a function in Ruby are probably much worse.
Parent - By Basic Date 2010-09-25 17:44
no FPU on iPhone etc. hmmm. oh well.

It isn't just sqrt but alot of maths in general. I have to do a lot of lighting and physics this year, and Ruby/Gosu would be good for prototyping some of this stuff (so no need to worry about other people), felt the maths would be slowing some of this down.
Parent - By ? Date 2010-10-04 15:55
i haven't actually used it, but what about ruby-gsl?
Up Topic Gosu / Gosu Exchange / Maths for Ruby

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill