enkimute / ganja.js

:triangular_ruler: Javascript Geometric Algebra Generator for Javascript, c++, c#, rust, python. (with operator overloading and algebraic literals) -
MIT License
1.52k stars 107 forks source link

Getting TypeError in Ganja.js #82

Open CSteinmetz15 opened 4 years ago

CSteinmetz15 commented 4 years ago

When I put the script

Algebra(5,3,()=>{ var p = new Element(); p[247] = 0.25; p[248] = -1.0; p[250] = 0.25; p[251] = -1.0; p[254] = 1.0; document.body.appendChild(this.graph(()=>[ 0xFF0000, p ], {conformal:true,gl:true, animate: true, thresh:0.05})); });

into the CoffeeShop and press Run, I get the following TypeError by Ganja.js:

TypeError: (new this(...)).set is not a function ganja.js:1083:102

Is this a bug of ganja.js or is it my fault?

enkimute commented 4 years ago

Hi Christian,

For 8 dimensional algebras ganja.js switches to a different generator, (which no longer stores all mv coefficients as a flat array). (instead, an mv holds an array with coefficients per grade). Is this for the conic algebra ? (you'll also need to use the implicit renderer for that, and provide it with an 'up function' that tells it what the point representation looks like).

Cheers,

Steven.