ezag / pyeuclid

2D and 3D maths module for Python
97 stars 41 forks source link

npeuclid - euclid in numpy #21

Open dov opened 6 years ago

dov commented 6 years ago

This is not really a bug report nor a pull request, but in the lack of a mailing list for pyeuclid, I wanted to announce that I started a rewrite of euclid that uses numpy for all linear algebra, instead of doing the calculations in pure python. The trigger was that I was once again getting the wrong answer because of the arbitrary clipping of the inverse() function (based on the size of the determinant value). I named this new project npeuclid. I'm not sure whether to keep npeuclid as a separate project, or whether it should be merged in to euclid. I'm looking forward to both comments and contributions. One of the freedoms, and changes w.r.t. euclid, that I chose was to make the transformations stateless, so that a transformation such as t.rotate() returns a newly created transformation, but does not modify t. This is more "functional" like, and more similar to e.g. how pandas works.

Meanwhile I have only done 2D geometry, but adding 3D and quaternion math, should be quite trivial.

See: https://github.com/dov/npeuclid

dov commented 4 years ago

FYI. It took a while, but I finally put npeuclid on PyPi.

etjones commented 4 years ago

Nice work, Dov. Can you comment on any changes needed for swapping out npeuclid for pyeuclid? Looks like all mutating functions, like Transform.rotate() are now pure (Props!). Anything else we should look at there? Any speed comparisons?