From: Dan Uznanski Date: 2006-12-22T00:30:02+09:00 Subject: Re: Matrix class for ruby? On Dec 21, 2006, at 6:24 AM, Vincent Fourmond wrote: > seepee wrote: >> Does anyone know of a functional Matrix math class for ruby that could >> multiply, add and substract 3x2 or larger matrices. >> >> The matrix.rb that is in Ruby API cannot multiply anything larger >> than 2x2 >> matrices, which makes it useless for 2D or 3D graphics (for instance). > > OK, I understand now: you want graphical transformations. They are > *not* real matrices, but the combination of a real matrix and a > translation vector. So you need special rules to combine them (although > for additions and substractions, standard matrix multiplications should > work). I don't know any package doing that in Ruby -- but if you > consider writing one, that would definitely be an interesting addition. > 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