Skip to content Skip to sidebar Skip to footer

Mayavi: Interpolate Face Colors In Triangular_mesh

I have pieced together the following code to plot a triangular mesh with the colors specified by an additional scalar function: #! /usr/bin/env python import numpy as np from mayav

Solution 1:

I think you want to use point data instead of cell data. With cell data, a single scalar value is not localized to any point. It is assigned to the entire face. It looks like you just want to assign the t data to the vertices instead. The default rendering of point scalars will smoothly interpolate across each face.

point_data = mesh.mlab_source.dataset.point_data
point_data.scalars = t
point_data.scalars.name = 'Point data'
point_data.update()

mesh2 = mlab.pipeline.set_active_attribute(mesh,
        point_scalars='Point data')

Post a Comment for "Mayavi: Interpolate Face Colors In Triangular_mesh"