#12212: Colormap for implicit_plot3d and parametric_plot3d
-------------------------------------+-------------------------------------
Reporter: niles | Owner: jason, was
Type: defect | Status: needs_work
Priority: major | Milestone: sage-6.4
Component: graphics | Resolution:
Keywords: colormap, plot | Merged in:
Authors: Joris | Reviewers: Frédéric Chapoton,
Vankerschaver, Frédéric Chapoton | Niles Johnson
Report Upstream: N/A | Work issues:
Branch: u/chapoton/12212 | Commit:
Dependencies: | 41fe504cbf6dc5244e22bfd6dd4b374fd7d1eb28
| Stopgaps:
-------------------------------------+-------------------------------------
Comment (by niles):
I've thought more about this now. First, here are some observations:
* `plot3d_adaptive`, `TrianglePlot`, and the rest of tri_plot.py
- This code is disjoint from the rest of the plotting code and needs
to be integrated at some point in the future.
- Makes use of `IndexFaceSet.partition`, but that method isn't used
anywhere else, except now in `GradualTextureTransform`
* Each face in an `IndexFaceSet` has a color attribute, but no other
texture attributes (namely opacity, but also ambient, diffuse,
specular)
- The color_data argument, as it currently stands, directly sets
this color attribute for each face as its constructed in
`ParametricSurface.triangulate` or `ImplicitSurface.triangulate`
- The two different triangulation methods differ substantially, and
therefore probably shouldn't be unified
- This approach (adding data to triangles) can only set color
values, not other texture values, unless `IndexFaceSet` is expanded
- I believe this is also connected to the problem of viewing with jmol,
but I'm not completely sure.
- Surfaces constructed with `plot3d_adaptive` are triangulated with a
different codebase (tri_plot.py) and then converted to `IndexFaceSet`
objects.
* `IndexFaceSet` is a subclass of `PrimitiveObject` (as in graphics
primitive), and hence has support for arbitrary texture information
via `PrimitiveObject.set_texture`.
- This sets the same texture information for *all* faces in a given
`IndexFaceSet` instance.
- The code in `plot3d_adaptive`, and hence also in
`GradualTextureTransform` which copies it, makes a different
instance of `IndexFaceSet` for each texture (e.g. color). These are
combined in a `Graphics3dGroup`.
- Grouping triangles by texture makes some sense because often
there will be many triangles with the same texture.
- `plot3d_adaptive` and `GradualTextureTransform` use the method
`IndexFaceSet.partition` to partition triangles according to the
values of a scalar function. In both cases this is done after a
single `IndexFaceSet` has been constructed.
* The `color_data` approach (setting attributes of individual faces as
they're constructed) is faster than the `GradualTextureTransform`
approach by nearly a factor of 2 (or 1/2; see timings below).
- This makes sense, given that `GradualTextureTransform` has to
construct the triangulation first and then partition it.
- The `color_data` approach might be more memory-intensive, but I
don't know how to measure this.
------
It could be possible to combine these two approaches:
* Partition triangles according to texture and hence take advantage of
the more robust support for textures in the graphics classes.
* Construct this partition during the triangulation process, rather
than after the fact.
Before I start working on this, please let me know if you have suggestions
or concerns about this idea.
Thanks!
--
Ticket URL: <http://trac.sagemath.org/ticket/12212#comment:77>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.