Opened 3 years ago

Closed 3 years ago

#28343 closed enhancement (fixed)

Three.js: Support basic mesh plots

Reported by: paulmasson Owned by:
Priority: major Milestone: sage-8.9
Component: graphics Keywords: threejs
Cc: egourgoulhon Merged in:
Authors: Paul Masson Reviewers: Eric Gourgoulhon
Report Upstream: N/A Work issues:
Branch: f55a9ce (Commits, GitHub, GitLab) Commit: f55a9cecfdd02950da5ca90adeed539eb29d28dc
Dependencies: Stopgaps:

Status badges


This enhancement allows display of a black mesh grid on any surface by supplying the keyword mesh=True. To avoid z-fighting with the surface, the mesh is drawn twice, slightly above and slightly below the surface.

If the mesh alone is desired, it would be simple to hide the surface. The currently supported Boolean keyword does not allow this behavior, so some input would be needed as to best additional keyword practices. We could also allow setting the color and opacity of the grid separate from the material, but again input on appropriate keywords would be needed.

This ticket includes standardization of Line geometries in the Three.js template as well as additional cleanup and consistency. None of that should change existing behavior.

Change History (7)

comment:1 Changed 3 years ago by paulmasson

  • Branch set to u/paulmasson/mesh

comment:2 Changed 3 years ago by paulmasson

  • Commit set to 38b59f97155111e6edc1c414a0f864a03be88b21
  • Status changed from new to needs_review

New commits:

38b59f9Support basic mesh plots

comment:3 Changed 3 years ago by egourgoulhon

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

Thanks for this improvement! I've tested it on the examples with mesh=True of the 3D Graphics section of the reference manual. It looks nice!

There is one failing doctest:

sage -t --long --warn-long 78.5 src/sage/plot/plot3d/index_face_set.pyx
File "src/sage/plot/plot3d/index_face_set.pyx", line 1198, in sage.plot.plot3d.index_face_set.IndexFaceSet.json_repr
Failed example:
    ['{"vertices":[{"x":2,"y":0,"z":0},..., "face_colors":["#ff0000","#ff9900","#cbff00","#33ff00"], "opacity":1.0}']
    ['{"vertices":[{"x":2,"y":0,"z":0},{"x":0,"y":2,"z":0},{"x":0,"y":0,"z":2},{"x":0,"y":1,"z":1},{"x":1,"y":0,"z":1},{"x":1,"y":1,"z":0}], "faces":[[0,4,5],[3,4,5],[2,3,4],[1,3,5]], "faceColors":["#ff0000","#ff9900","#cbff00","#33ff00"], "opacity":1.0}']
1 item had failures:
   1 of  11 in sage.plot.plot3d.index_face_set.IndexFaceSet.json_repr
    [152 tests, 1 failure, 10.12 s]

comment:4 Changed 3 years ago by git

  • Commit changed from 38b59f97155111e6edc1c414a0f864a03be88b21 to f55a9cecfdd02950da5ca90adeed539eb29d28dc

Branch pushed to git repo; I updated commit sha1. New commits:

f55a9ceFix doctest

comment:5 Changed 3 years ago by paulmasson

  • Status changed from needs_work to needs_review

Doctest fixed. Let's try to get this into 8.9.

comment:6 Changed 3 years ago by egourgoulhon

  • Status changed from needs_review to positive_review


comment:7 Changed 3 years ago by vbraun

  • Branch changed from u/paulmasson/mesh to f55a9cecfdd02950da5ca90adeed539eb29d28dc
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.