[vtkusers] vtkQuadricDecimation - color defects

David Gobbi david.gobbi at gmail.com
Mon Mar 18 18:09:29 EDT 2013


Hi Nigel,

I'm certain that you are correct, it is an overflow bug.  I looked at
vtkQuadricDecimation::SetPointAttributeArray() and it calls the
following vtkDataArray method for each component (in your case,
for R, G, B):

scalars->SetComponent(pointId, i, v);

SetComponent() just calls static_cast, it does no clamping. So
overflows are likely to occur.

Ideally vtkQuadricDecimation::SetPointAttributeArray() should call
GetDataTypeMin() and GetDataTypeMax() on the scalar array and
clamp the value to this range before inserting it into the array.  If you
are able to fix the code, we can get your fix into VTK 5.10.2/VTK 6.0.

 - David


On Mon, Mar 18, 2013 at 11:53 AM, Nigel Mcfarlane
<Nigel.Mcfarlane at beds.ac.uk> wrote:
> I am using vtkQuadricDecimation to reduce a triangular mesh with
> color_scalar attributes.  After decimation, I get single-point errors in the
> colors which look as if they might be an overflow error in the color
> interpolation.  If the decimation is repeated recursively, the errors
> accumulate and start to form on the boundary points, turning the mesh edges
> black.  The errors appear when there is high-frequency noise in the color
> pattern; if the color is smooth there is no problem.  It does not seem to
> depend on the topography of the mesh.  The color scalars are unsigned char
> with 3 components.  AttributeErrorMetric is On, NormalsAttribute is Off, and
> the TargetReduction is 0.5.  I am using VTK5.10, but it also happens in
> VTK4.   Is this a known problem, and if so is there anything I can do about
> it?
> Thank you
> Nigel McFarlane
> University of Bedfordshire, UK



More information about the vtkusers mailing list