Opened 6 years ago

Last modified 6 weeks ago

#20978 needs_info defect

polygon3d view in jmol broken

Reported by: kcrisman Owned by:
Priority: minor Milestone: sage-9.7
Component: graphics Keywords: jmol threejs
Cc: paulmasson, novoselt, mkoeppe Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #30316 Stopgaps:

Status badges

Description (last modified by mkoeppe)

polygon3d([[0,0,0], [1,2,3], [3,0,0]]).show(viewer='jmol') 

does not show anything. See this ask.sagemath question.

EDIT: Issue previously reported as #19274. Description from that ticket:

Thomas Fernique reported the following bug by private email: from the console, some flat polygons in three-space lead to an empty picture with jmol (java version), for example:

sage: polygon([(0, 0, 0), (1, 0, 0), (1, 0, 1), (0, 0, 1)])

However, this is correctly displayed with jsmol (javascript version) from the notebook.

I can reproduce this bug on Sage 6.8, Debian GNU/Linux jessie 64 bit, openjdk-7-jre.

Still present in Sage 9.6.beta5, and still after upgrading to 14.32.35 (#30316).

Change History (29)

comment:1 Changed 6 years ago by paulmasson

  • Cc paulmasson added

comment:2 Changed 6 years ago by tscrim

When I add an arrow3d (for example), then it displays properly:

sage: polygon3d([[0,0,1],[0,1,0],[1,0,0]]) + arrow3d([0,0,0],[1,1,1])
sage: p2.plot() + arrow3d([0,0,0],[1,1,1])

It seems like it is just ignoring the polygon3d when it is the only object:

sage: p = polygon3d([[0,0,1],[0,1,0],[1,0,0]]) + arrow3d([0,0,0],[1,1,1])
sage: rp = p.default_render_params()
sage: rp.output_archive = None
sage: p.jmol_repr(rp)
['pmesh obj_1 "/home/travis/.sage/temp/apricot/5573/tmp_pU6Ppq-obj_1.pmesh"\ncolor pmesh  [0,0,255]']
<type 'sage.plot.plot3d.index_face_set.IndexFaceSet'>

sage: p = polygon3d([[0,0,1],[0,1,0],[1,0,0]]) + arrow3d([0,0,0],[1,1,1])
sage: p.jmol_repr(rp)
[['pmesh obj_2 "/home/travis/.sage/temp/apricot/5573/tmp_pU6Ppq-obj_2.pmesh"\ncolor pmesh  [0,0,255]'],
 [[['\ndraw line_3 width 0.02 {0.0 0.0 0.0} {0.896076951546 0.896076951546 0.896076951546}\ncolor $line_3  [102,102,255]\n'],
   [['pmesh obj_4 "/home/travis/.sage/temp/apricot/5573/tmp_pU6Ppq-obj_4.pmesh"\ncolor pmesh  [102,102,255]']]]]]
sage: type(p)
<class 'sage.plot.plot3d.base.Graphics3dGroup'>

sage: p = arrow3d([0,0,0],[1,1,1])
sage: p.plot()    # This works fine
Launched jmol viewer for Graphics3d Object
sage: p.jmol_repr(rp)
[[['\ndraw line_5 width 0.02 {0.0 0.0 0.0} {0.896076951546 0.896076951546 0.896076951546}\ncolor $line_5  [102,102,255]\n'],
  [['pmesh obj_6 "/home/travis/.sage/temp/apricot/5573/tmp_pU6Ppq-obj_6.pmesh"\ncolor pmesh  [102,102,255]']]]]
sage: type(p)
<class 'sage.plot.plot3d.base.TransformGroup'>

A somewhat strange thing is that the graphics group jmol_repr calls the jmol_repr of the polygon. Perhaps someone has an idea about this (and knows how to read the jmol input).

Last edited 6 years ago by tscrim (previous) (diff)

comment:3 follow-up: Changed 6 years ago by egourgoulhon

Works for me with sage 7.3.beta6 on Ubuntu 15.10 for both sage notebook and jupyter notebook (a blue triangle is displayed in the jmol output). Does *not* work from the sage console (only the bounding box is displayed).

comment:4 in reply to: ↑ 3 Changed 6 years ago by egourgoulhon

Replying to egourgoulhon:

Works for me with sage 7.3.beta6 on Ubuntu 15.10 for both sage notebook and jupyter notebook (a blue triangle is displayed in the jmol output). Does *not* work from the sage console (only the bounding box is displayed).

Addendum: in the sage notebook, the triangle is displayed only after one has clicked on the figure.

comment:5 Changed 6 years ago by paulmasson

I don't think this is a Sage problem. If you look at the temporary files under the hidden User/.sage directory that are passed to the Jmol viewer, the pmesh files for the polygons are there and included every time in the SCRIPT file in scene.spt.zip. The data for the polygons is exactly the same whether or not the arrow is included.

As a test, run this at the command line:

p=polygon([(0,0,0),(1,0,0),(1,1,0)])
for n in range(1,10):
     p+=polygon([(n,0,0),(n+1,0,0),(n+1,n+1,0)])
     p

When I run it the polygons don't being to appear until there are six of them, and don't appear reliably for higher numbers.

I think this is a Jmol display problem.

comment:6 Changed 6 years ago by tscrim

Hmmm...perhaps it is time to revive the discussion of moving to a different 3d viewing platform? At least we should probably tell upstream.

comment:7 Changed 6 years ago by paulmasson

  • Description modified (diff)

comment:8 Changed 6 years ago by mkoeppe

  • Cc novoselt mkoeppe added

comment:9 Changed 6 years ago by paulmasson

On #12402 I've written some basic Three.js support for Graphics3d objects that can handle examples here that fail in Jmol. If there is interest in having an option other than Jmol, feedback on #12402 would be appreciated.

comment:10 follow-up: Changed 6 years ago by mkoeppe

Is this usable with sage running in a terminal? Note that the failure documented in this ticket is about the Java version of Jmol, which is the one that is used in this situation.

comment:11 in reply to: ↑ 10 Changed 6 years ago by paulmasson

Replying to mkoeppe:

Is this usable with sage running in a terminal?

Yup! That's the entire point: an HTML file is generated at the command line and saved in a temporary file like other plots. It can then be displayed immediately in a browser, or embedded in an iframe for future application in notebooks or the cell server.

comment:12 follow-up: Changed 3 years ago by paulmasson

  • Keywords jmol threejs added
  • Milestone changed from sage-7.3 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

Since Three.js will be the default viewer in Sage 9.0 this ticket can be closed.

comment:13 in reply to: ↑ 12 Changed 3 years ago by egourgoulhon

  • Reviewers set to Eric Gourgoulhon
  • Status changed from needs_review to positive_review

Replying to paulmasson:

Since Three.js will be the default viewer in Sage 9.0 this ticket can be closed.

Yes indeed.

comment:14 follow-ups: Changed 3 years ago by kcrisman

  • Milestone changed from sage-duplicate/invalid/wontfix to sage-9.0
  • Priority changed from critical to minor
  • Reviewers Eric Gourgoulhon deleted
  • Status changed from positive_review to needs_info

Just because the default changes doesn't mean this is fixed, and some people may still be using Jmol from command line or whatever. But we can certainly modify the ticket.

comment:15 Changed 3 years ago by kcrisman

  • Summary changed from polygon3d view broken to polygon3d view in jmol broken

comment:16 in reply to: ↑ 14 Changed 3 years ago by egourgoulhon

Replying to kcrisman:

Just because the default changes doesn't mean this is fixed, and some people may still be using Jmol from command line or whatever.

Yes you are right of course, I've been too fast here.

comment:17 Changed 3 years ago by egourgoulhon

For the record, the issue is still there in Sage 9.0.beta0, even after the update of Jmol in #25026.

comment:18 in reply to: ↑ 14 Changed 3 years ago by paulmasson

Replying to kcrisman:

Just because the default changes doesn't mean this is fixed, and some people may still be using Jmol from command line or whatever. But we can certainly modify the ticket.

As I pointed out three years ago, this is not a Sage problem and won’t get fixed here. Are you keeping the ticket open monitor upstream activity? Otherwise it should be closed.

comment:19 Changed 3 years ago by kcrisman

We have tons of tickets here that monitor upstream activity, because they impact Sage usability in various contexts. I notice that "Report Upstream" is currently N/A, though, so maybe that should be changed and possibly worked on. I often do this with Maxima bugs but I don't know what the current Jmol upstream reporting process is.

comment:20 Changed 2 years ago by embray

  • Milestone changed from sage-9.0 to sage-9.1

Ticket retargeted after milestone closed

comment:21 Changed 2 years ago by mkoeppe

  • Milestone changed from sage-9.1 to sage-9.2

Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.

comment:22 Changed 19 months ago by mkoeppe

  • Milestone changed from sage-9.2 to sage-9.3

comment:23 Changed 14 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Moving this ticket to 9.4, as it seems unlikely that it will be merged in 9.3, which is in the release candidate stage

comment:24 Changed 10 months ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5

Setting a new milestone for this ticket based on a cursory review.

comment:25 Changed 5 months ago by mkoeppe

  • Milestone changed from sage-9.5 to sage-9.6

Stalled in needs_review or needs_info; likely won't make it into Sage 9.5.

comment:26 Changed 2 months ago by mkoeppe

  • Description modified (diff)

comment:27 Changed 2 months ago by mkoeppe

  • Dependencies set to #30316

comment:28 Changed 2 months ago by mkoeppe

  • Description modified (diff)

comment:29 Changed 6 weeks ago by mkoeppe

  • Milestone changed from sage-9.6 to sage-9.7
Note: See TracTickets for help on using tickets.