Have suggestions? Submit your contributions, bug reports, and feature requests to the Google Code project. Also see the site for documentation.
Go here to see the latest changes.
dmMath includes finding averages, a ceiling function, conversions between radians and degrees, some trig functions (including atan2), linear interpolation, fractions, matrices, and more.
ID:109090
Feb 3 2011, 9:00 pm


The matrix will definitely see some improvements.
Toadfish wrote:  Storing values in the vars list seems to me like poor form. I think it's more useful if you had it in a list, especially if someone was interested in the "raw" matrix for some reason, but also because it just seems less awkward.I agree that using the vars list is weird, however this was done so that you can access the Matrix's values using Matrix.M23 syntax instead of having to call a proc or access a list (though GetValue and SetValue procs do exist).  About computing inverse matrices, remember that if the determinant is 0 (i.e. the matrix is singular), the inverse does not exist.Hmm... I thought I added a check for that. At any rate you'd still just get a division by zero error.  Since you already have support for 2x2 & 3x3 determinant and inverse, why not add support for a general square matrix? I'm assuming you know how to calculate these, but if not you can look it up, it's very simple.Yeah it should have been this way from the start. I'll get rid of the dimensionspecific types. Also note that code contributions are welcome at https://code.google.com/p/dmmath/! 
Thanks for responding. I'll see if there's something I can contribute to the code project later. I see you have Determinant/Inverse calculation now :). Also, another thing about matrices  if you allow matrices of unequal m,n dimensions, you also pretty much get builtin vector support for free. With builtin vector support  you also have complex number support for free, which might allow for a more hierarchical program structure.

Your matrix datum stores it's values as a DM 2D list. This is extremely wasteful. You should use a single dimension list and perform a simple calculation to determine where a 2D location would be in a 1D list (((y  1) * width) + x). That way you don't have row x column number of lists (which only have 1 element in them anyway)

 Storing values in the vars list seems to me like poor form. I think it's more useful if you had it in a list, especially if someone was interested in the "raw" matrix for some reason, but also because it just seems less awkward.
 Support for a matrix which isn't square would be nice, although I'm not sure how often they're used in game programming.
 About computing inverse matrices, remember that if the determinant is 0 (i.e. the matrix is singular), the inverse does not exist.
 Since you already have support for 2x2 & 3x3 determinant and inverse, why not add support for a general square matrix? I'm assuming you know how to calculate these, but if not you can look it up, it's very simple.