by

## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
James Saunders
@jamesleesaunders
I have put together some example tests on Observable https://observablehq.com/@jamesleesaunders/calculating-vector-rotations
can anyone help work out how to use math.gl to calculate these rotations?
This is not that I am dropping the ball on x3dom of course! This is just that I want to use something more re-usable.
Andreas Plesch
@andreasplesch
glMatrix may be another option. I think you need to convert from quat. to axisangle. math.gl does not appear to implement .getAxisAngle although it is documented. glMatrix does.
James Saunders
@jamesleesaunders
Thanks Andreas, I have had a play with gl-matrix also and I am afraid I am still lost :-( I have added to my notebook https://observablehq.com/@jamesleesaunders/calculating-vector-rotations
I am obviously missing something here as I just cant seem to get the same results as x3dom?
Maybe I am looking at this the wrong way.
Given 2 vectors 1: pointing up (0,1,0) and the other pointing else where (-0.125, 0.125, 0) what translation rotation values do I need?
Andreas Plesch
@andreasplesch
https://observablehq.com/d/66f48ed0e04a5fb6 is I think how you would use gl-Matrix
for .rotationTo the inputs need to be unit vectors, and you want to convert to axisangle from quaternion.
Andreas Plesch
@andreasplesch
I have update the observable slightly to avoid unnecessary object creation.
James Saunders
@jamesleesaunders
Thanks @andreasplesch ! That works a treat!
Andreas Plesch
@andreasplesch
cool
James Saunders
@jamesleesaunders
I’ve been watching the number of people who have forked or starred x3dom, the number has been increasing over the last couple of months 😀 more people are interested in x3dom!
Solveig Løvhaug
@solveig
I have a maya file .mb. I don not have Maya. Do you know if I can convert it to X3D. I remeber that I managed to do that for many years ago with Blender, but I do not see I can do that now.
Dave Cooper
@genworks
Hi Everyone, and thanks for being here. I have a quick API question, and please let me know if this would better be posted to the mailing list:
Question is: how can I query the x3d object for the current user camera coordinates (viewpoint and view direction), then re-apply the same viewpoint and view direction after reloading the scene?
Dave Cooper
@genworks
I'm currently reloading with the reload(); function. But this resets the camera coords to the defaults as defined in the x3d data. I'd like to override this and specify the camera coords which have just been queried previous to the reload.
James Saunders
@jamesleesaunders
Hi Dave, this may not be exactly what you are after but as a starter for 10 you could look at the syncViewpoints() code at the bottom of https://github.com/jamesleesaunders/d3-x3d/blob/master/examples/X3DOM/component/Showcase.html
This is an example of grabbing the viewpoint values, and then re-using them again on a different chart.
(BTW You don’t necessarily need to send to mailing list as this Gitter forum is automatically replicated on the mailing list also.)
Dave Cooper
@genworks
Thanks James, I see the behavior is that changing viewpoint on one chart will apply the same viewpoint to all the charts. The syncViewpoints(e) function takes that "e" argument - where does the "e" come from, exactly? Is that an event or a viewpoint object? Is it getting bound automatically by the viewpoint which is listening for the viewpointChanged event?
Dave Cooper
@genworks
Update: Yep, that event object contains the data I'm looking for, accessible with the e.orientation[0], e.orientation[1], and e.position, as you have illustrated. Thank you! When I get my example working and building online, I'll post a link here..
So, the orientations in x3dom are given as axis ([0]) and rotation angle ([1]). Of course that makes sense, it's the same representation as in X3D..
Andreas Plesch
@andreasplesch
Dave Cooper
@genworks
@andreasplesch Thank you for that link. A lot of info indeed. The ability to add viewpointChanged-Listeners also to the Scene-Node looks useful, and looks like it should be in the 1.8.0 stable release. Downloading that now..
Andreas Plesch
@andreasplesch
I could load gendl on jupyter notebook with a common lisp kernel: https://github.com/yitzchak/common-lisp-jupyter
Andreas Plesch
@andreasplesch
I guess the next step would be to generate a box object and x3dom graphics as html in jupyter. Could be interesting.
x3dom now also supports a good part of the X3D Nurbs component which may be interesting to gendl.
Pablo
@PabloZheng
Hey guys,my supervisor asked me to learn X3Dom, I wonder what is x3dom for ?
Andreas Plesch
@andreasplesch
Dave Cooper
@genworks
@andreasplesch Happy to hear that Gendl loaded and started without issues in Jupyter. Which CL implementation is it? From the little I've heard of Jupyter, using Gendl inside Jupyter sounds interesting for sure. I haven't really looked at Jupyter at all yet. So far we just deploy Gendl as a traditional web application server, with its built-in CL-based webserver, and old-school Emacs/Slime as IDE. Rendering a simple box indeed sounds like the next logical step, if your goal is to embed dynamic Gendl models inside a Jupyter notebook. Gendl's online demos and documentation are somewhat lacking and out of date at present; we are working to correct that as soon and as nicely as possible. In the meantime, please reach out to me directly with any issues or if you'd like to discuss ideas for next steps (and let me know here if you need contact info).
Andreas Plesch
@andreasplesch
Just exploring at this point. https://github.com/yitzchak/common-lisp-jupyter/blob/master/Dockerfile installs most CLs and then uses SBCL. I am not versed enough to tell from the REPL/Jupyter notebook if that CL is actually then used.
Dave Cooper
@genworks
Communicating here about Gendl is fine by me, but I’m thinking it might look like noise to so
e who are here only for x3dom..
To check which CL is running, you can try
(lisp-implementation-type) ;;and
(lisp-implementation-version)
Andreas Plesch
@andreasplesch
you are right; I sent a private message
David Everitt
@DaveEveritt
I've just converted some VRML files to X3D to display with X3DOM. They aren't showing up correctly, so I'm looking for some troubleshooting. Instead of typing up all the links and details, I've put up a tagged question here https://stackoverflow.com/questions/59920017/where-are-the-issues-in-this-conversion-from-vrml-to-x3d
Andreas Plesch
@andreasplesch
Hi Dave, the main issue is that the scenes use Protos which are not completely supported in x3dom. The good news is that the ProtoDeclarations here are effectively simple macros and probably work as x3dom inline in json format.
Andreas Plesch
@andreasplesch
https://gist.github.com/andreasplesch/4fb27cb9f3db9ee423066ae74d4aaae1 has the scene as vrml, x3d and json. The vrml was converted with view3dscene to x3d. view3dscene works better than the online instantreality converter. The x3d was then converted to json with http://xsltransform.net/ and the official stylesheet at https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/X3dToJson.xslt
Andreas Plesch
@andreasplesch
Sorry, this is complicated but the json encoding is new and currently the only encoding which works with (simple) Protos in x3dom.
Andreas Plesch
@andreasplesch
There is an issue with the l, r, n, i protos . The x3dom expander does not deal with nested protos, it appears. You could define those protos without nesting, easiest in VRML and reconvert.