Dan said:
An RST matrix has an implicit 0 0 0 1 row along the bottom. Nothing
more complicated than that.
Actually when dealing with projection matrices, this 'implicit' bottom
row gets used to define the perspective value of the camera.
That said, matrix.rb is very shoddy - it's missing several important
vector operations (like, oh, -Vector and Vector/Numeric), and it uses
Vector*Matrix instead of the correct Matrix*Vector.
Dan
I wouldn't call it "shoddy". My biggest complaint with Matrix is that a
Matrix is immutable -- if you want to set elements, you have to do so in
an Array and then create a new Matrix from the Array.
The whole rational / complex / matrix / mathn collection looks to me
like an attempt to provide "high-school algebra" constructs in Ruby that
work the way you'd expect them to work. For example, you can get the
*exact* inverse of a non-singular matrix with rational elements, and I
suppose, though I haven't tried it, the same thing for a non-singular
matrix with complex rational elements. For *small* one-off calculations
and calculations where high speed isn't required, they do just that.
However, if what you want to do is, say, lots of graphical
transformations at high speed using floating point arithmetic, like you
might in a video game, you want NArray.