Opened 2 years ago
Closed 2 years ago
#30613 closed defect (fixed)
Fix clipping issue for plots with small/large extents in Three.js
Reported by: | Joshua Campbell | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | sage-9.3 |
Component: | graphics | Keywords: | threejs near far clip clipping distance size |
Cc: | Paul Masson | Merged in: | |
Authors: | Joshua Campbell | Reviewers: | Eric Gourgoulhon |
Report Upstream: | N/A | Work issues: | |
Branch: | cb818f8 (Commits, GitHub, GitLab) | Commit: | cb818f8a14148a4444e1ad85add1a9882063d63b |
Dependencies: | Stopgaps: |
Description
Plots that are very small/large in world-space coordinates can run into clipping issues with the default near and far clipping distances set in the Three.js viewer.
For example, the large "cool self-intersecting surface (Eppener surface?)" near the bottom of the documentation for Parametric Plots appears completely blank due to far clipping:
sage: var('u,v') sage: f_x = u - u^3/3 + u*v^2 sage: f_y = v - v^3/3 + v*u^2 sage: f_z = u^2 - v^2 sage: parametric_plot3d([f_x, f_y, f_z], (u,-25,25), (v,-25,25), plot_points=[50,50], frame=False, color="green") Graphics3d Object
...and the following small plot appears empty due to near clipping:
dodecahedron().scale(1/1000)
This ticket proposes to fix this problem by scaling both the near and far clipping distances based on the overall size of the plot in world-space coordinates.
Change History (4)
comment:1 Changed 2 years ago by
Authors: | → Joshua Campbell |
---|---|
Branch: | → u/gh-jcamp0x2a/30613-threejs-clip-distance |
Commit: | → cb818f8a14148a4444e1ad85add1a9882063d63b |
Status: | new → needs_review |
comment:2 follow-up: 3 Changed 2 years ago by
Reviewers: | → Eric Gourgoulhon |
---|---|
Status: | needs_review → positive_review |
LGTM. Thanks for the fix!
comment:3 Changed 2 years ago by
Cc: | Paul Masson added |
---|
Replying to egourgoulhon:
LGTM. Thanks for the fix!
Oops, looks like I neglected to fill out the CC field when creating this ticket. I had forgotten all about it. Going to add Paul just to make sure he's in the loop, too.
Thanks for taking a look at it!
comment:4 Changed 2 years ago by
Branch: | u/gh-jcamp0x2a/30613-threejs-clip-distance → cb818f8a14148a4444e1ad85add1a9882063d63b |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
New commits:
Scale clipping planes by overall plot size to accomodate very large/small plots