6 ms·
Maybe you want to check out a javascript implementation of GA math with Ganja.js. While not yet comprehensive to all the tasks you probably would want to see, i
by iod 7y ago
Maybe you want to check out a javascript implementation of GA math with Ganja.js. While not yet comprehensive to all the tasks you probably would want to see, it does have some good examples that you can play around with
https://enkimute.github.io/ganja.js/examples/coffeeshop.html#pga2d_inverse_kinematics https://enkimute.github.io/ganja.js/examples/coffeeshop.html...
- jiggawatts 7y agoThat library pisses me off on a visceral level. The author "Enki Mute" is no doubt a brilliant mathematician, his library looks awesome, the online demos are unreal, but he's squandered his talent. The code he writes is unreadable gibberish. Zero useful comments. One-character variable names. Stringly-typed programming. Regex soup. It's psychotic. I tried to reverse-engineer it in order to write a SIMD-optimised Rust version. But fuck me. It's like disassembling the machine code of an obfuscated anti-cheat library. Even with good tooling and industrial-strength refactoring, I couldn't make enough sense of it to make any useful headway. Just try and read this. Seriously: https://github.com/enkimute/ganja.js/blob/master/ganja.js https://github.com/enkimute/ganja.js/blob/master/ganja.js What saddens me is that every other library I looked at was ancient and no longer maintained. Half wouldn't even compile. Most started with an explicit assumption that only 2D, 3D, or non-degenerate metrics are needed. Very few have efficient code-generation, and those that do are invariably C++ only, but I'm never going back there, even at gunpoint. Just shoot me now, I'd rather eat a bullet than face another STL compilation error that I have to decode from a linker error to do with __malloc() or some garbage I don't care about. Enki Mute's Ganja.js is the only recent GA library I've seen that ticks all the checkboxes, but when I opened it up, I faced only the unspeakable horror of yet another dead end. GA is going nowhere because everyone cooks up their own special version, the terminology is unique and special to each researcher, and most libraries stop just short of being useful. What we need is standardisation around a well-documented and extensible library with polyglot code-gen. Something with expression simplification, SIMD, and both maths-centric and 3D graphics optimised capabilities. Ganja.js is not it, unfortunately.
- BorisTheBrave 7y agoAre we looking at the same file? It has masses of high quality comments. I think calling this stringly typed is unfair. Basis names appear to be strings with some densly coded information in them, and can sometimes take the values "-1", "0" or "1". But they're not integers, and it matches the mathematical notation used very closely. I see plenty of 1 character variable names, but the vast majority are either loop variables, or have a comment near the top of the file explaining their meaning, or are the only argument on a commented/named function. I see plenty of regexes, but they are all extremely short matching patterns. So it looks pretty good quality to me. Extremely densely written, typical for the "genius mathematician" programmer, but with some effort put into clarity.
- jiggawatts 7y agoAre we? The comments are all of the style "now, this is the thing that is the thing". None explain anything at all other than to give names to variables or functions. Which you know... can already be named using identifiers in the language. What are the matrices of constants? Where do they come from? What do they mean? What is their purpose? What are the random indexes into arrays? What do they do? This is one of the first "comments": // Documentation below is for implementors. I'll assume you know about Clifford Algebra's, grades, its products, etc .. // I'll also assume you are familiar with ES6. My style may feel a bith mathematical, advise is to read slow. I don't know about you, but whenever I see a comment littered with typos that says "this is a bit hard to read", it's a sure sign that whatever is to follow is of low quality. Not reusable. Not suitable for widespread use. Not extensible. Not useful at all. To reiterate: this makes me sad. I really wish it didn't, because GA is one of my favourite things, and this Enki Mute guy is clearly one of the few people that also "gets it" and wants to spread the good work. Clearly, his heart is in the right place. I know people like this guy. I went to University with a chap who would casually litter his Haskell code with 5 dimensional arrays of functions. Now I'm sure that made sense in his head, and his code actually worked, but no human being on Earth other than him could read it. He couldn't explain to me even verbally, let alone in comments. Unfortunately, while Enki Mute could have made a great contribution, his methodology has not helped GA become more approachable.
- modeless 7y agoGanja.js is exactly the opposite direction from what I want. The generality is not useful, the performance will be abysmal for graphics code, and the non-standard syntax is totally bonkers. It's a really cool experiment but not suitable for production use.