Eric Peden wrote: > First post. Hi. :) > > I'm writing a ray-tracer in Ruby (I know, I know...) Perhaps some other > time I'll wax ecstatic over the advantages Ruby brings to such a > project, but at the moment I have less pleasant issues I'm hoping to get > some help with. > > A pure-Ruby ray tracer is just a tad slow. Clearly, some core > functionality needs to be implemented in C for speed. The system is > broken into classes similar to the following: > > Camera > Engine > Vector > Point > Ray > Shape > Sphere > Polygon > > Of those classes, only a handful are performance critical, and of each > of those, only one or two methods are true bottlenecks. I'm trying to > keep as much of the code as possible in Ruby, while breaking out only > the real work horses into C. Vector, for example, is almost pure C, > whereas only the intersection-testing method in the Shape subclasses is > in C. Unfortunately, I keep running into dependency problems when trying > to build the C functions. My C code is organized like this: > > ext/ > extconf.rb > ext.c > vector.c > sphere.c You might take a look at RubyInline: http://rubyforge.org/projects/rubyinline/ It will allow you to put the C code right into your Ruby classes. Regards, Michael