MantisBT - VTK
View Issue Details
0001647VTK(No Category)public2005-03-07 04:092016-08-12 09:54
john platt 
Kitware Robot 
normalmajoralways
closedmoved 
 
 
0001647: vtkCutter overwrites cell scalars cutting cells of different dimension
I think there is a problem colour mapping cell scalars using vtkCutter on an unstructured

grid. Take a grid with 2 cells, a hex and a quad, and cut both cells by a plane.

Cutting the hex creates 2 triangles - vtkHexahedron::Contour() calls

      newCellId = polys->InsertNextCell(3,pts);
      outCd->CopyData(inCd,cellId,newCellId);

creating new triangles with newCellId = 0 & 1.

Cutting the quad gives a single line - vtkQuad::Contour() calls

      newCellId = lines->InsertNextCell(2,pts);
      outCd->CopyData(inCd,cellId,newCellId);

creating a new line with newCellId = 0.

Unfortunately, the CopyData() in vtkQuad::Contour() overwrites the cell data for the first

triangle. On more complex geometries this causes the renderer to crash because the cell data

is not present.

I think the calls to copy the cell data need the new cell Id in the aggregate polydata, not

the individual lines or polys - something like

      outCD->CopyData(inCd, cellId, vtkCutter->NumberOfNewCells++);
No tags attached.
? Hexahedron.vtk (299) 2011-10-21 11:31
https://www.vtk.org/Bug/file/5245/Hexahedron.vtk
Issue History
2008-11-30 09:23Mathieu MalaterreAssigned ToMathieu Malaterre => François Bertel
2008-11-30 20:19François BertelAssigned ToFrançois Bertel =>
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:54Kitware RobotNote Added: 0036775
2016-08-12 09:54Kitware RobotStatusexpired => closed
2016-08-12 09:54Kitware RobotResolutionopen => moved
2016-08-12 09:54Kitware RobotAssigned To => Kitware Robot

Notes
(0002150)
Mathieu Malaterre   
2005-03-07 10:40   
John, do you have a dataset to reproduce ?
What if you change the line:

vtkQuad::Contour(...)
...
 vtkIdType offset = verts->GetNumberOfCells();

to also take into account the lines:

 vtkIdType offset = verts->GetNumberOfCells() + lines->GetNumberOfCells();


Thanks
(0002151)
Mathieu Malaterre   
2005-03-07 10:59   
John. I added a vtk dataset. Does this crash for you ?
(0002159)
john platt   
2005-03-07 19:45   
As you suggested, in vtkQuad, I changed

    outCd->CopyData(inCd,cellId,newCellId);
to
       vtkIdType offset = verts->GetNumberOfCells()
                         + lines->GetNumberOfCells();
    outCd->CopyData(inCd,cellId,newCellId+offset);
    
but the cell colour of 1 triangle is still incorrect.

I don't know how the vertex, line & poly cell Id's are mapped to Id's in the aggregate polydata. Suppose all the verts come first, followed by the lines and then the polys. Then to get the correct cell Id for a line, I would need to know the total number of vertices in advance. I seem to recall a comment in vtkDataSetSurfaceFilter about cell ordering. This method may work if vtkCutter processed the cells in point, line, triangle order - only a guess.

Many thanks for you help - John.

(0036775)
Kitware Robot   
2016-08-12 09:54   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.