[vtkusers] coloring PolyData into discrete regions

leonid leonid.gluhovsky at gmail.com
Sat Jan 25 04:40:22 EST 2014


Hello.  I have a PolyData where the points are logically partitioned
into four groups (or regions).  The scalars attached to the points are
numbers
0, 1, 2, 3 specifying this partitioning.  I have chosen four colors and
want to render the PolyData so that each region is shown in its color.

When I use PointData scalars for color lookup (which is the default),
some form of interpolation is used to color the cells (triangles), and
I get smooth boundaries between regions (which is good for me) but
wrong colors on the boundaries (which is bad).  For example if I use
SetInterpolateScalarsBeforeMapping(1), on the boundary between regions
0 and 2 a narrow band of region 1 color is created, because if there is
a triangle edge where the vertices have values 0 and 2, somewhere along the
edge there will be points to which SetInterpolateScalarsBeforeMapping(1)
will assign value 1.  If I use SetInterpolateScalarsBeforeMapping(0),
OpenGL color interpolation kicks in and I get a color ramp on the boundaries
between regions.

If I use CellData scalars for color lookup each region does get its
own color and no other colors appear in the image.  But since each triangle
is now painted in a single color and I have too few triangles, the boundary
between regions looks very rugged.

I figure if I could use PointData scalars for color lookup and specify
that I want nearest-neighbor interpolation (for either setting of
SetInterpolateScalarsBeforeMapping) it would solve the problem,
but I didn't find a way to do it.

I'm sure I'm not the first one who wants to color a PolyData into discrete
colors.  How do you do it?

Many thanks in advance for any advice.




--
View this message in context: http://vtk.1045678.n5.nabble.com/coloring-PolyData-into-discrete-regions-tp5725629.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list