New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply flat shading when plotting 3d polyhedra with Three.js #31426
Comments
comment:1
Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date. |
comment:3
I thought changing the I tried this change without success: diff --git a/src/sage/geometry/polyhedron/base.py b/src/sage/geometry/polyhedron/base.py
index 843fe204cb..918ce178c9 100644
--- a/src/sage/geometry/polyhedron/base.py
+++ b/src/sage/geometry/polyhedron/base.py
@@ -815,6 +815,7 @@ class Polyhedron_base(Element):
wireframe='blue', fill='green',
position=None,
orthonormal=True, # whether to use orthonormal projections
+ threejs_flat_shading=True, # flat shading for threejs plotting
**kwds):
"""
Return a graphical representation.
@@ -847,6 +848,9 @@ class Polyhedron_base(Element):
- ``orthonormal`` -- Boolean (default: True); whether to use
orthonormal projections.
+ - ``threejs_flat_shading`` -- boolean (default: True);
+ whether to apply flat shading when plotting with Three.js
+
- ``**kwds`` -- optional keyword parameters that are passed to
all graphics objects. Ideas anyone? |
This comment has been minimized.
This comment has been minimized.
Attachment: polyhedron-flat-shading.png Flat shading wanted for polyhedra |
This comment has been minimized.
This comment has been minimized.
comment:5
I think there are two different things here:
I will set this as the default behavior. |
Branch: public/31426 |
Commit: |
comment:7
Fill in the author field with your full name |
This comment has been minimized.
This comment has been minimized.
Author: Laith Rastanawi |
Changed keywords from none to threejs, flat shading, polyhedra |
comment:9
Stalled in |
comment:10
These are nice improvements! Thanks for working on this. |
Reviewer: Matthias Koeppe |
Changed branch from public/31426 to |
Changed commit from |
comment:13
It seems the wrong shading sometimes persists. Juanjo's answer to Ask Sage question 63031 |
comment:14
Replying to @slel:
The situation is as follows:
I think the function
This By the way, the current implementations force the flat shading even if the user |
We should ensure flat shading is the default
when plotting 3d polyhedra with Three.js.
In this example, only the middle cube (at the origin)
has flat shading and looks correct:
The special case of Platonic solids (as purely graphics objects)
was done in #27836.
In this ticket we do the following:
We fix a bug in
plot3d.platonic
:When translating such a platonic solid,
the default behavior of flat shading is ignored
as shown in the previous example.
We fix that.
We set flat shading to be the default behavior
for plots of
geometry.polyhedron
.CC: @egourgoulhon @jcamp0x2a @LaisRast @guenterrote @paulmasson @slel
Component: graphics
Keywords: threejs, flat shading, polyhedra
Author: Laith Rastanawi
Branch:
2125039
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/31426
The text was updated successfully, but these errors were encountered: