[Numpy-discussion] constant shaded triangle mesh in mayavi2
Thu Sep 30 16:18:34 CDT 2010
On Thu, Sep 30, 2010 at 16:00, Geoffrey Irving <email@example.com> wrote:
> On Fri, Oct 1, 2010 at 9:38 AM, Robert Kern <firstname.lastname@example.org> wrote:
>> On Thu, Sep 30, 2010 at 15:30, Geoffrey Irving <email@example.com> wrote:
>>> I'm not sure where the correct place to ask questions about Mayavi, so
>>> feel free to redirect me elsewhere.
>>> I have a triangle mesh with a bunch of data on each face. The only
>>> color-relevant argument to triangular_mesh I know about is scalars,
>>> which is one value per vertex. Is there a way to set color per
>>> triangle, ideally with control over rgb separately so I can visualize
>>> three different fields at once?
>> Pretty difficult, unfortunately. The only way I have found is to
>> assign UV texture coordinates to the vertices and slap on a texture.
>> Assigning the UV coordinates is usually not easy.
> Is this a limitation in VTK, TVTK, or the Mayavi python code? The VTK
> documentation seems to imply it supports cell data on polygon meshes
> (though I don't know how one would set them):
> "Point and cell attribute values (e.g., scalars, vectors, etc.)
> also are represented"
> I'm happy to hack TVTK or Mayavi (in order of happiness) to support
> cell data if VTK supports it.
It's a VTK restriction. You can store whatever data you like on the on
the vertices or cells. There is no mapper (that I am aware of) that
takes that data and interprets them as RGB values on a per-vertex or
per-cell basis. There are mappers that turn scalar vertex and cell
attribute values into colors through a colormap table, but that's not
what you are asking for.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion