# Math3D: fixes

**URL:** <https://www.ruby-forum.com/t/math3d-fixes/78752>\
**Category:** Ruby\
**Created:** [December 8, 2006, 10:36am UTC](https://www.ruby-forum.com/t/math3d-fixes/78752 "2006-12-08T10:36:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bartb](https://www.ruby-forum.com/u/bartb)\
**Post date:** [December 8, 2006, 10:36am UTC](https://www.ruby-forum.com/t/math3d-fixes/78752/1 "2006-12-08T10:36:12Z")

</div>

I have been trying to use Math3D (on my Linux system) and I encountered  
some  
problems. It’s only fair to post fixes here too, as I can happily use  
the  
library now. I also mailed these patches to the author, I hope he can  
use  
them. Unfortunately there’s no rubyforge project and I’m reluctant to  
set  
one up with code coming from someone else.

Here are the patches:

extconf.rb:  
The CFLAGS \<\< syntax is deprecated, I did not find any new solutions for  
it.  
On my system the atan function is not in lm (but in the standard gcc  
library  
cmath), so I had to remove that check too. Do note that all tests run  
fine  
now, so this did not harm the workings.

In test.rb:  
I had to change the syntax for adding testsuites:  
suite \<\< klass.suite if klass \< Test::Unit::TestCase

In almost every test I had to rename set\_up to setup and tear\_down to  
teardown, this seems to be old syntax?

In some tests the object.id method is used, I changed it to  
object.object\_id  
where Ruby warned me but of course this is nothing serious.

In Bound.tests.rb I had to change [0.to\_a] to [[0]] on line 30, I hope  
that’s equivalent to what was being tested?

In Matrix4.tests.rb I had to do the same on line 32, on line 137 I  
noticed  
you threw IndexErrors instead of Math3d::IndexErrors so I removed  
Math3d::,  
I had the same problem with InvertError.

In Require.tests.rb I fixed the warning that const\_defined? should put (  
)  
around its arguments.

In m3dUnitTest.rb I added a line at the top of the class to avoid  
running  
this empty test: undef\_method :default\_test (thanks Eric H. for the  
hint).

In Vector.tests.rb I had larger problems. The instantiation matrix is  
also  
filled with nil objects, but that gives stacktraces when executing. So I  
commented out these tests, which feels incorrect… Any suggestions  
there?  
On line 556 I changed .5 into 0.5 in order to make the file run, a  
trivial  
correction of course.

Any comments are welcome!  
Bart

---

<div class="post-metadata">

**Author:** ![bartb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bartb](https://www.ruby-forum.com/u/bartb)\
**Post date:** [December 8, 2006, 4:22pm UTC](https://www.ruby-forum.com/t/math3d-fixes/78752/2 "2006-12-08T16:22:58Z")

</div>

Frankly, I would recommend rewriting the library from scratch. When I  
picked  
it up, I realized that it was in pretty poor shape, and implemented in a  
very confusing manner (Vector2 Vector3 Vector4, but Vector can be any of  
these…), so I just rewrote it. As you’ve noticed, the code is also  
very  
old (Ruby 1.6 I think). So if you’re really going to use it alot, I  
highly  
recommend a rewrite.

Jason
