Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript LiveGraph Replacement #587

Merged
merged 16 commits into from
Jun 2, 2015
Merged

Conversation

goehle
Copy link
Member

@goehle goehle commented May 26, 2015

This provides a javascript based replacement for the java based LiveGraphics system. It uses the webgl wrapper x3dom. You can read more about the general idea and motivation at: http://webworkgoehle.blogspot.com/2015/05/livegraphics-and-javascript.html

To test all you need to do is pull this pull request, and the associated PG pull request (number 211). Then visit any livegraphics based problem. I've provded a .def file below which has all of the livegraphics that I could find using a grep in the open problem library. You should run through the set and make sure that the graphs all render correctly.

Other small things to test.

  • Check that setting $pg{specialPGEnvironmentVars}{use_javascript_for_live3d} = 0;
    in localOverrides makes the system go back to the applet verison.
  • Check that the system is reasonably functional on webgl enabled phones/tablets. (Most newer devices.)
  • Check that the flash based fall back works on non webgl, but still flash supporting, devices. (A very small intersection.)

Caveats.

  • The javascript applet is intended to make the existing LiveGraphics questions function again without changing the problems themselves. (So that local versions of the problem will also still work.) However, future problems with 3d graphing should probably be made with a dedicated javascript 3d grapher that leaves out the Mathematica middle man. It would be faster and more feature complete.
  • The webgl speeds things up considerably over using an svg based solution, but both are slower than the original java applet.

@goehle
Copy link
Member Author

goehle commented May 26, 2015

This is the set of all problems in the OPL (that I could find) which use LiveGraphics.

setNumber=Demo
openDate = 1/7/00 at 6:00am
dueDate = 1/20/09 at 6:00am
answerDate = 1/21/09 at 6:00am
paperHeaderFile = set0/paperHeaderFile0.pg
screenHeaderFile = set0/screenHeaderFile0.pg
problemList =
Library/Union/setMVderivatives/gradient-3/gradient-3a.pg,1
Library/Union/setMVlevelsets/levels-10c/levels-10c.pg,1
Library/Union/setMVlevelsets/levels-5/levels-5c.pg,1
Library/Union/setMVlevelsets/levels-5/levels-5b.pg,1
Library/Union/setMVlevelsets/levels-5/levels-5a.pg,1
Library/Union/setMVlevelsets/levels-4/levels-4.pg,1
Library/Union/setMVlevelsets/levels-3/levels-3.pg,1
Library/Union/setMVlevelsets/levels-8a/levels-8a.pg,1
Library/Union/setMVlevelsets/levels-8b/levels-8b.pg,1
Library/Union/setMVlevelsets/levels-10b/levels-10b.pg,1
Library/Union/setMVlevelsets/levels-10a/levels-10a.pg,1
Library/Union/setMVtraces/trace-5a.pg,1
Library/Union/setMVtraces/trace-5b.pg,1
Library/FortLewis/Authoring/Templates/Parametric/SpacecurveGraph1/SpacecurveGraph1.pg,1
Library/FortLewis/Authoring/Templates/Parametric/SurfaceGraph1/SurfaceGraph1.pg,1
Library/FortLewis/Authoring/Templates/DiffCalcMV/Graph3DCylindrical1/Graph3DCylindrical1.pg,1
Library/FortLewis/Authoring/Templates/DiffCalcMV/Graph3DRectangular1/Graph3DRectangular1.pg,1
Library/FortLewis/Authoring/Templates/VectorCalc/VectorFieldGraph3D1/VectorFieldGraph3D1.pg,1
Library/FortLewis/Calc3/20-2-Divergence-theorem/HGM4-20-2-05-Divergence-theorem/HGM4-20-2-05-Divergence-theorem.pg,1
Library/FortLewis/Calc3/14-1-Partial-derivatives/HGM4-14-1-18-The-partial-derivative/HGM4-14-1-18-The-partial-derivative.pg,1
Library/FortLewis/Calc3/14-1-Partial-derivatives/HGM4-14-1-17a-The-partial-derivative/HGM4-14-1-17a-The-partial-derivative.pg,1
Library/FortLewis/Calc3/14-1-Partial-derivatives/HGM4-14-1-17b-The-partial-derivative/HGM4-14-1-17b-The-partial-derivative.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-06b-Idea-of-flux/HGM4-19-1-06b-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-05b-Idea-of-flux/HGM4-19-1-05b-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-01b-Idea-of-flux/HGM4-19-1-01b-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-06a-Idea-of-flux/HGM4-19-1-06a-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-01a-Idea-of-flux/HGM4-19-1-01a-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-04a-Idea-of-flux/HGM4-19-1-04a-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-04b-Idea-of-flux/HGM4-19-1-04b-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-02a-Idea-of-flux/HGM4-19-1-02a-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-30-Idea-of-flux/HGM4-19-1-30-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-05a-Idea-of-flux/HGM4-19-1-05a-Idea-of-flux.pg,1
Library/FortLewis/Calc3/19-1-Idea-of-flux/HGM4-19-1-03a-Idea-of-flux/HGM4-19-1-03a-Idea-of-flux.pg,1
Library/FortLewis/Calc3/18-2-Line-integrals-parametrized/HGM5-18-2-19-Line-integrals-parametrized/HGM5-18-2-19-Line-integrals-parametrized.pg,1
Library/FortLewis/Calc3/16-5-Rectangular-integrals/HGM5-16-5-31-Rectangular-integrals/HGM5-16-5-31-Rectangular-integrals.pg,1
Library/FortLewis/Calc3/14-4-Gradients-in-plane/HGM4-14-4-48-Gradients-etc/HGM4-14-4-48-Gradients-etc.pg,1
Library/FortLewis/Calc3/20-3-Curl/HGM4-20-3-18-Curl/HGM4-20-3-18-Curl.pg,1
Library/FortLewis/Calc3/20-3-Curl/HGM4-20-3-01-Curl/HGM4-20-3-01-Curl.pg,1
Library/FortLewis/Calc3/12-2-Multivariable-graphs/HGM4-12-2-14c-Multivariable-functions-graphs/HGM4-12-2-14c-Multivariable-functions-graphs.pg,1
Library/FortLewis/Calc3/12-2-Multivariable-graphs/HGM4-12-2-14b-Multivariable-functions-graphs/HGM4-12-2-14b-Multivariable-functions-graphs.pg,1
Library/FortLewis/Calc3/12-2-Multivariable-graphs/HGM4-12-2-02a-Multivariable-functions-graphs/HGM4-12-2-02a-Multivariable-functions-graphs.pg,1
Library/FortLewis/Calc3/12-2-Multivariable-graphs/HGM4-12-2-14a-Multivariable-functions-graphs/HGM4-12-2-14a-Multivariable-functions-graphs.pg,1
Library/FortLewis/Calc3/17-3-Vector-fields/LGVectorField3D-01/LGVectorField3D-01.pg,1
Library/FortLewis/Calc3/16-5-Cylindrical-integrals/HGM4-16-5-37-Cylindrical-integrals/HGM4-16-5-37-Cylindrical-integrals.pg,1
Library/FortLewis/Calc3/16-5-Cylindrical-integrals/HGM5-16-5-14-Cylindrical-integrals/HGM5-16-5-14-Cylindrical-integrals.pg,1
Library/FortLewis/Calc3/16-5-Cylindrical-integrals/HGM5-16-5-18-Cylindrical-integrals/HGM5-16-5-18-Cylindrical-integrals.pg,1
Library/FortLewis/Calc3/16-5-Cylindrical-integrals/HGM5-16-5-31-Cylindrical-integrals/HGM5-16-5-31-Cylindrical-integrals.pg,1
Library/FortLewis/Calc3/16-5-Spherical-integrals/HGM5-16-5-31b-Spherical-integrals/HGM5-16-5-31b-Spherical-integrals.pg,1
Library/FortLewis/Calc3/16-5-Spherical-integrals/HGM5-16-5-31a-Spherical-integrals/HGM5-16-5-31a-Spherical-integrals.pg,1
Library/FortLewis/Calc3/16-5-Spherical-integrals/HGM4-16-5-34-Spherical-integrals/HGM4-16-5-34-Spherical-integrals.pg,1
Library/FortLewis/Calc3/16-5-Spherical-integrals/HGM5-16-5-15-Spherical-integrals/HGM5-16-5-15-Spherical-integrals.pg,1
Library/FortLewis/Calc3/12-3-Contour-diagrams/HGM4-12-3-18e-Contour-diagrams/HGM4-12-3-18e-Contour-diagrams.pg,1
Library/FortLewis/Calc3/12-3-Contour-diagrams/HGM4-12-3-18b-Contour-diagrams/HGM4-12-3-18b-Contour-diagrams.pg,1
Library/FortLewis/Calc3/12-3-Contour-diagrams/HGM4-12-3-18f-Contour-diagrams/HGM4-12-3-18f-Contour-diagrams.pg,1

@mgage
Copy link
Sponsor Member

mgage commented May 28, 2015

The header reference is to the file
http://localhost/webwork2_files/js/vendor/x3dom/x3dom-full.js Failed to load resource: the server responded with a status of 404 (Not Found)

Only the file x3dom.js is included with the pull request. What should be done -- include x3dom-full.js? or change the header line calling in x3dom-full.js instead of x3dom.js?

@goehle
Copy link
Member Author

goehle commented May 28, 2015

Whooops. I had to switch over to the full version of x3dom because it turned out I needed 2d geometry objects but I forgot to add it to git. It should be there now.

Cleaned up some commit messages and changed the window scale to be the average, not the max, of the axes scales.
@mgage
Copy link
Sponsor Member

mgage commented Jun 2, 2015

I've used it on my laptop and on my iPad. If anything it works better on the ipad since you can do a flat rotation of the image with two fingers. (rotates in the plane of the screen). I haven't figured out the key combination to do that on the laptop even after looking at the instructions.

There may eventually need to be some tweaks needed to the theme. On the laptop I found reducing the type size to 0.1 from 0.15 and changing the coloring of the tick figures to red made it easier to solve the problems. I solved 15 or so of them in detail.

I think this should be pulled -- minor changes in default settings for colors and size can come later.

mgage added a commit that referenced this pull request Jun 2, 2015
Javascript LiveGraph Replacement
@mgage mgage merged commit 43afbc3 into openwebwork:develop Jun 2, 2015
@goehle goehle deleted the livegraphup branch September 2, 2015 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants