5
Skayo
277d

Dunno why but writing a Vector Math Library is super fun! Especially in Lua!

Comments
  • 2
    Need it for my 3D Soft Engine btw
  • 3
    Wouldn't it be easier to use an already existing one?
  • 4
    Fun?
    I found it tedious as fuck. Especially writing solvers and matrix inversion routines (to invert general transforms).
    If not for certain things I wanted which Eigen (C++ linear algebra library) didn't have, I would've used that instead.
  • 1
    <@ilikeglue>
    Yeah I tried a lot but I wasn't happy with any of them... Then I decided to just write my own (I translate the Babylon Math Lib to Lua) according to my needs.
    Also, some of the features used in the tutorial I'm following, are not present in every library.
  • 0
  • 0
    <@RememberMe>
    Yeah the invert function is pretty fucking complicated...
    54 lines where a 1/3 is completely different from the others.
    I think I'll save that for the end haha
  • 1
    @Skayo it also depends on what algorithm you're using. And that depends on your application. For eg: I implemented a numerically stable(ish) Gauss-Jordan method because it fit my needs. There are a ton of inversion routines to choose from, with varying quality, stability, and speed.

    Also, for 3D graphics, in most cases the transforms have trivial inverses (eg: flipping the sign on a translation matrix). You could take advantage of this by tracking how you've built up a transform, and simply build up the inverse transform by combining the individual inverses in reverse order.
  • 0
    Fuck! I'm done!

    Here it is again:

    https://gist.github.com/Skayo/...
Your Job Suck?
Get a Better Job
Add Comment