Closed fchapoton closed 7 years ago
Branch: u/chapoton/22253
Description changed:
---
+++
@@ -1 +1,15 @@
see https://groups.google.com/forum/#!topic/sage-devel/Wjo7NkmvCks
+
+
+The problem lies in the file `src/sage/plot/plot3d/index_face_set.pyx`, where the json is generated. There are two problems with the generated json:
+
+1. The quote signs used in the file are `'` and not `"` as per [Json spec](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
+2. Every dictionary key is unquoted, which is incorrect. Thus, a point
+
+ {x:0,y:0,z:0}
+
+ should really be
+
+ {"x":0,"y":0,"z":0}
+
+ as per Json spec.
Author: Frédéric Chapoton
Branch pushed to git repo; I updated commit sha1. New commits:
5f7e950 | trac 22253 fix doctests |
Branch pushed to git repo; I updated commit sha1. New commits:
11e4447 | trac 22253 fix more doctests |
Seems ok with the canvas3d viewer (in sagenb):
sage: u,v = var('u,v')
sage: def cf(u,v): return sin(u+v/2)**2
sage: P = parametric_plot3d((cos(u), sin(u)+cos(v), sin(v)),
....: (u,0,2*pi), (v,-pi,pi), color=(cf,colormaps.PiYG), plot_points=[60,60])
sage: P.show(viewer='canvas3d')
Needs to be tested in other kinds of notebooks.
Ok also in jupyter notebook. Remains to check in cloud (not that easy).
All doctests pass in sage/plot/plot3d. Works with the new native Three.js viewer.
I would like to point out that this modification will bloat Three.js files without any change to the rendering, since JavaScript doesn't care whether array keys are quoted or not. Presumably that was part of the motivation for using formally incorrect JSON to begin with, so I didn't change it when writing the Three.js viewer.
Reviewer: Paul Masson
one still needs to change
local/share/sage/ext/doctest/rich_output/example.canvas3d
but this is not under git control ?
This should be good now, but patchbots will not have a look. Please check and review.
Failing doctest from most recent alterations:
File "src/sage/repl/rich_output/output_graphics3d.py", line 159, in sage.repl.rich_output.output_graphics3d.OutputSceneCanvas3d.example
Failed example:
rich_output.canvas3d
Expected:
buffer containing 649 bytes
Got:
buffer containing 829 bytes
done, should be good now.
Changed branch from u/chapoton/22253 to fbd8b10
see https://groups.google.com/forum/#!topic/sage-devel/Wjo7NkmvCks
The problem lies in the file
src/sage/plot/plot3d/index_face_set.pyx
, where the json is generated. There are two problems with the generated json:'
and not"
as per Json spec.Every dictionary key is unquoted, which is incorrect. Thus, a point
should really be
as per Json spec.
CC: @novoselt @egourgoulhon
Component: graphics
Author: Frédéric Chapoton
Branch/Commit:
fbd8b10
Reviewer: Paul Masson
Issue created by migration from https://trac.sagemath.org/ticket/22253