digitalmars.D - Re: Low dimensional matrices, vectors, quaternions and a cubic equation
- #ponce <spam spam.spam> Apr 19 2010
- "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> Apr 19 2010
- Eric Poggel <dnewsgroup yage3d.net> Apr 19 2010
I don't know if this help, but here is a subset of my "math" package I've used in real-time applications. http://ponce.paradisia.net/temp/math_package.zip Such code is absolutely not what one would expect to find in a standard library (lots of assembly, almost no std.math, no safety-checks, no clever templates) but it works for me. You may find some useful parts in it. Maybe merging the good ideas of OMG, Yage, your code, etc... (and sorting out licences "problems")... would lead to a better low-dimensionnal math package class. Thingsq important to me: - expressivity
Apr 19 2010
#ponce wrote:I don't know if this help, but here is a subset of my "math" package I've used in real-time applications. http://ponce.paradisia.net/temp/math_package.zip Such code is absolutely not what one would expect to find in a standard library (lots of assembly, almost no std.math, no safety-checks, no clever templates) but it works for me. You may find some useful parts in it. Maybe merging the good ideas of OMG, Yage, your code, etc... (and sorting out licences "problems")... would lead to a better low-dimensionnal math package class. Thingsq important to me: - expressivity
I like this (from your math.vec3 module): struct vec3(T) { union { struct { T x, y, z; } T[3] v; } ... } That's a pretty neat trick. :) I didn't even know anonymous unions were possible. -Lars
Apr 19 2010
On 4/19/2010 7:36 AM, #ponce wrote:Maybe merging the good ideas of OMG, Yage, your code, etc... (and sorting out licences "problems")... would lead to a better low-dimensionnal math package class.
I'm willing to re-license any of Yage's math library under whatever terms are necessary for inclusion in D's standard library, even if only bits and pieces are borrowed. http://dsource.org/projects/yage/browser/trunk/src/yage/core/math The Matrix and Quaternion classes would be better if they were templated, but there's a Vector class that's templated on both type and number of parameters. In its design I tried to lean toward immutability, so you have methods like .toRotationMatrix() instead of matrix.setFromRotationAxis(Vector axis). If nothing from Yage is used I hope to at least encourage this type of design.
Apr 19 2010