[Numpy-discussion] constant shaded triangle mesh in mayavi2

Geoffrey Irving irving@naml...
Thu Sep 30 16:26:05 CDT 2010


On Fri, Oct 1, 2010 at 10:18 AM, Robert Kern <robert.kern@gmail.com> wrote:
> On Thu, Sep 30, 2010 at 16:00, Geoffrey Irving <irving@naml.us> wrote:
>> On Fri, Oct 1, 2010 at 9:38 AM, Robert Kern <robert.kern@gmail.com> wrote:
>>> On Thu, Sep 30, 2010 at 15:30, Geoffrey Irving <irving@naml.us> wrote:
>>>> Hello,
>>>>
>>>> I'm not sure where the correct place to ask questions about Mayavi, so
>>>> feel free to redirect me elsewhere.
>>>
>>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>>
>>>> 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):
>>
>>    http://www.vtk.org/doc/release/5.6/html/a01445.html
>>    "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.

Visualizing a signle cell scalar field is still quite useful (the data
doesn't correspond to color).  In other words, the per-cell part of
the question is more important than than the RGB part.  Is there a
current way to set a cell attribute value on a Mayavi triangular_mesh?

Thanks,
Geoffrey


More information about the NumPy-Discussion mailing list