[vtkusers] Bugs in vtk 4.0
Alexander Trum
a.trum at teraport.de
Thu Aug 29 15:07:16 EDT 2002
Hello,
We are using VTK 4.0 and we have found some bugs.
We have no CVS write access therefore i am writing this mail in the hope
somebody will fix it and check the changes in.
================================================================================
1. Bug in vtkIVWriter.cxx
================================================================================
change
--------------------------------------------------------------------------------
if (colors)
{
fprintf(fp,"\tMaterial {\n");
fprintf(fp,"\t\tdiffuseColor [\n");
fprintf(fp, "\t\t\t");
for (i=0; i<colors->GetNumberOfTuples(); i++)
{
unsigned char *rgba;
rgba = colors->GetPointer(4*i);
fprintf(fp, "%g %g %g, ", rgba[0]/255.0f,
rgba[1]/255.0f, rgba[2]/255.0f);
if (!((i+1)%2))
{
fprintf(fp, "\n\t\t\t");
}
}
fprintf(fp, "\n\t\t]\n");
fprintf(fp,"\t}\n");
}
colors->Delete();
--------------------------------------------------------------------------------
to
--------------------------------------------------------------------------------
if (colors)
{
fprintf(fp,"\tMaterial {\n");
fprintf(fp,"\t\tdiffuseColor [\n");
fprintf(fp, "\t\t\t");
for (i=0; i<colors->GetNumberOfTuples(); i++)
{
unsigned char *rgba;
rgba = colors->GetPointer(4*i);
fprintf(fp, "%g %g %g, ", rgba[0]/255.0f,
rgba[1]/255.0f, rgba[2]/255.0f);
if (!((i+1)%2))
{
fprintf(fp, "\n\t\t\t");
}
}
fprintf(fp, "\n\t\t]\n");
fprintf(fp,"\t}\n");
colors->Delete();
}
--------------------------------------------------------------------------------
because otherwise the program will crash if colors == NULL
================================================================================
2. Bug in vtkTriangleFilter.cxx
================================================================================
change the line 121 from
--------------------------------------------------------------------------------
if ( this->PassVerts )
--------------------------------------------------------------------------------
to
--------------------------------------------------------------------------------
if ( this->PassLines )
--------------------------------------------------------------------------------
because otherwise lines will only be passed if verts are passed!
================================================================================
3. Bug in vtkOBBTree.cxx
================================================================================
change the lines 1908 and 1909 from
--------------------------------------------------------------------------------
delete OBBstackA;
delete OBBstackB;
--------------------------------------------------------------------------------
to
--------------------------------------------------------------------------------
delete[] OBBstackA;
delete[] OBBstackB;
--------------------------------------------------------------------------------
because otherwise there will be memory leaks!
================================================================================
4. Bug in vtkDecimatePro.cxx
================================================================================
change
--------------------------------------------------------------------------------
static float ComputeEdgeError(float x[3], float x1[3], float x2[3])
{
float projDist = vtkLine::DistanceToLine(x, x1, x2);
float edgeLength = vtkMath::Distance2BetweenPoints(x1,x2);
return (projDist < edgeLength ? projDist : edgeLength);
}
--------------------------------------------------------------------------------
to
--------------------------------------------------------------------------------
static float ComputeEdgeError(float x[3], float x1[3], float x2[3])
{
float projDist = vtkLine::DistanceToLine(x, x1, x2);
float edgeLength = vtkMath::Distance2BetweenPoints(x1,x2);
float e = (projDist < edgeLength ? projDist : edgeLength);
if (e < 0.0) e = 0.0;
return e;
}
--------------------------------------------------------------------------------
because the implementation of vtkLine::DistanceToLine returns sometimes
negative values!!!
Perhaps it is much more better to fix this error in
vtkLine::DistanceToLine!
Effects: Only a few polygons will be kept after decimation of some large
polygonal models
if preserve topology is off and accumulate error is on!!!
Thanks a lot,
Alexander
--
Alexander Trum
Dipl.-Math. (FH)
Senior Software Developer
Engineering IT Consulting
Teraport GmbH
Phone +49 89 651086 721
Fax +49 89 651086 701
Mobile +49 173 38 25 490
mailto:alexander.trum at teraport.de
http://www.teraport.de
More information about the vtkusers
mailing list