[vtkusers] Clipping UnstructureGrid data. Bug in vtkTetra::Clip ?

David Pont david_pont at hotmail.com
Mon Oct 2 09:58:19 EDT 2000


A quick look inside the code for the various vtk cells reveals that 
implemented Clip methods exist as follows:

YES: Line, Polygon, PolyLine, PolyVetrex, Quad, (Tetra), Triangle, 
TriangleStrip, Vertex,

NO: Hexahedron, Pixel, Pyramid, Voxel, Wedge

I have UnstructuredGrid data, composed of Hexahedra and Wedge cells, and 
would like do clipping (contouring works great). The Tetra cell appeared to 
have a "live" Clip method, so I made a new class vtkClipUnstructuredGrid. 
Internally I decomposed all my cells to tetrahedra and passed these on to 
Clip. At first nothing came out the other end. A closer look at the code 
showed there is probably a bug in vtkTetra::Clip.

I changed lines 742 and 752 as follows:

// Build the case table
  if ( insideOut )
    {   for ( i=0, index = 0; i < 3; i++)
CHANGED TO >>>>	for ( i=0, index = 0; i < 4; i++)
      {
      if (cellScalars->GetScalar(i) <= value)
	{
	index |= CASE_MASK[i];
	}
      }
    }
  else
    {
for ( i=0, index = 0; i < 3; i++)
CHANGED TO >>>> for ( i=0, index = 0; i < 4; i++)
      {
      if (cellScalars->GetScalar(i) > value)
	{
        index |= CASE_MASK[i];
	}
      }
    }

The 3 looks like a legacy from vtkTriangle::Clip.
With this change I get output, but cells at the boundary are not clipped, 
they are simply not output. So this vtkTetra::Clip appears to be a 'simple' 
implementation, that works like vtkThreshold, with the output being entire 
cells, "in or out".

I would like to get clipping working for UnstructuredGrid data. Has anyone 
done this, or got any ideas. If not I would like to take a look at it.

    regards
      Dave Pont
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.





More information about the vtkusers mailing list