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

suggested improvement to dual: option to graph() function #141

Open skydog23 opened 2 years ago

skydog23 commented 2 years ago

When dual:true is passed as option to the graph() function, then the geometry is dualized before rendering. This works for points and lines: they are rendered as their Hodge duals, that is, as lines, resp., points. However line segments and polygons are currently not dualized.

See https://enki.ws/ganja.js/examples/coffeeshop.html#v_k4dXh7a for an ganja demo demonstrating the problem.

I think the problem might be solved in ganja.js at line 809 by dualizing instances of Arrays, too, before rendering, following the example of the above ganja demo and flattening them at the same time.

It's not a high priority issue. If I were more adept at javascript and git I would attempt the solution myself, and I will aim to do that in the next weeks.

kungfooman commented 2 years ago

Just mentioning that the demo link doesn't work: https://enki.ws/ganja.js/examples/coffeeshop.html#v_k4dXh7a

skydog23 commented 2 years ago

Hmm... I just noticed the comment from kungfooman. The link as given works for me: https://enki.ws/ganja.js/examples/coffeeshop.html#v_k4dXh7a