Uh oh!
There was an error while loading. Please reload this page.
Add Cylinder - #1294
Conversation
mmatera
commented
Apr 19, 2021
I wonder if it would be possible to use mathics_scanner to define parsers for Graphics/Graphics3D like expressions. Then, it would be helpful to update or define new backends... |
rocky
commented
Apr 20, 2021
I don't understand what this means but would like to. Pretend this exists, what you then write? |
rocky
commented
Apr 20, 2021
By the way, I do think it would be nice to have a Three.js backend. |
fe7bd82 to
ad2ae0bComparerocky
commented
Apr 20, 2021
I am seeing a problem with Asymptote formatting of cyclinders where the bounding box starts below the base of the cylinder. However I can't figure out how to fix this. @mmatera if you can, let's fix. Otherwise let's skip. |
And start using fstrings instead of .format
rocky
commented
Apr 20, 2021
I just checked the WL specification and at least to me it is weird in that from the two-argument point form you extract the length. |
mmatera
commented
Apr 20, 2021
I do not get this. Could you expand it with an example? |
rocky
commented
Apr 20, 2021
From https://reference.wolfram.com/language/ref/Cylinder.html :
I don't know how one orients something inside the grid box - For a sphere orientation is nonexistent. We need to be concerned with not just how WL takes its Cyclinder input, but pay attention to the most common definition for asymptote, Three.js and other graphics libraries that provide a cylinder. The consensus is not to do it this way, but instead have origin, radius and length. Sometimes "radius" is diameter and called "width", but the conversion from radius to width is trivial. So I think the conversion from two points to a length would be done in the Boxing routine might add minor adjustments to this. |
mmatera
commented
Apr 21, 2021
In a 3DGraphics, you have a canonical set of coordinate orthogonal axes and a viewpoint. De default cylinder is just a cylinder of radius 1, height 2, center in the origin, and with a symmetry axis aligned with the z-axis. |
rocky
commented
Apr 21, 2021
What you say, makes sense but this is a bit more involved that I want to undertake right now. So for myself I am going to leave this be. |
mmatera
commented
Apr 21, 2021
I could take this if we have in clear how to pass a rotation to Tree.js. |
It looks like in r49 there is a graphics object called Quaternion which has methods setFrom... methods like setFromRotationMatrix, setFromEuler, etc. See https://github.com/mrdoob/three.js/blob/r49/src/core/Quaternion.js and https://github.com/mrdoob/three.js/blob/r49/docs/api/core/Quaternion.html |
mmatera
commented
Apr 25, 2021
I was looking at this, and I see that to do this properly, we need to implement the |
b007e8c to
ef16eb6Compare7f7638e to
ef46656Compare8367d69 to
83bb068Compare9570fdd to
499f1bfCompare
Apparently even the way old version of Three.js we have supports cylinders.
There will be a change on the Mathics-Django side as well.
Haven't considered asymptote or TeX yet though.
Feel free to just make commits on top of this.