ipyvolume icon indicating copy to clipboard operation
ipyvolume copied to clipboard

`ipyvolume.save` fails to serialize `pythreejs.OrbitControls` due to +-Infinity

Open notEvil opened this issue 3 years ago • 1 comments

Hi,

the following code

import ipyvolume
import pythreejs
import sys

figure = ipyvolume.figure()
controls = pythreejs.OrbitControls(controlling=figure.camera)
if False:
    controls.maxAzimuthAngle = sys.float_info.max
    controls.maxDistance = sys.float_info.max
    controls.maxZoom = sys.float_info.max
    controls.minAzimuthAngle = -sys.float_info.max
figure.controls = controls
ipyvolume.save("./2022-02-18 min.html")

produces "JSON.parse: unexpected character at line 417 column 28 of the JSON data". Its because the object contains a couple of +-Infinity. With if True the error disappears.

notEvil avatar Feb 18 '22 08:02 notEvil

There is https://github.com/jupyter-widgets/pythreejs/issues/366, looks like a pythreejs issue spilling over

notEvil avatar Feb 21 '22 08:02 notEvil