crertel / graphmath

An Elixir library for performing 2D and 3D mathematics.
The Unlicense
81 stars 13 forks source link

Inclusion of more linear algebra constructs #44

Open harrisi opened 4 months ago

harrisi commented 4 months ago

Hi, thanks for graphmath! It solves a lot of problems with 3D rendering and physics simulations.

There are a few things that could be added to make this more complete for realtime 3D interactive applications, as well as 2D UIs, such as Scenic.

A few things such as Vec4, Mat22, some added functions such as trace, determinant, look_at, perspective, ortho, maybe some others, would be nice for both 3D rendering and some physics-based simulations.

The main interest I have is to unify many of these common math functions into a package that something like Scenic could utilize, as well as my own projects with OpenGL rendering. I'm not sure if this is outside the scope of this project, but if it seems it would fit, I'd be happy to open a (or some) PRs.

crertel commented 4 months ago

That's exactly up the alley of this project--and as a maintainer on Scenic, I'm very aware of how it might help there. :)

If you can put together a list of things (similar to what you already have, maybe add some additional stuff), then I can get that plumbed in.

I also feel like a 3x4 matrix or 2x3 matrix for 2D stuff without shear could be useful. What do you think?

harrisi commented 4 months ago

Awesome! I realized after the fact when I was going to ask Scenic people what they'd need from graphmath. Turns out I don't need to! :)

Here's a list of things that I've had to implement to supplement graphmath so far, for various 2D and 3D projects:

I don't have a strong opinion on Mat34/Mat23. I haven't had a need for something like that yet. I don't love the non-square nature, since really you'd need Mat43 and Mat32 as well. But I suppose that's not the end of the world.

Let me know if some or all of those seem unnecessary.