[vtkusers] Problem while extracting geometry with vtkDataSetSurfaceFilter

Arnaud RIVET arnaud.rivet at cdr.hutchinson.fr
Thu Apr 18 09:43:30 EDT 2013


Hi,

I have a problem with the use of 'vtkDataSetSurfaceFilter' : it seems I 
have lost one point from my geometry (the first one).
Moreover, if I want the normals to the surfaces, they are not the expected 
ones. What have I missed ?
I am using a single cube and here is my Python code :


# construct the UnstructuredGrid mesh
# (i have also used a vtkFieldData and a vtkDataObjectToDataSetFilter to 
construct my UnstructuredGrid, with the same results)
def GetMesh( ):
        # initialization
        mesh = vtkUnstructuredGrid()
 
        # coordinates of the points
        points = [ [0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0], [0, 0, 1], 
[0, 1, 1], [1, 1, 1], [1, 0, 1] ]
 
        # set points
        vtk_points = vtkPoints()
        for point in points:
                vtk_points.InsertNextPoint( point[0], point[1], point[2] )
 
        mesh.SetPoints( vtk_points )
 
        # set connectivity
        pts = vtkIdList()
        pts.SetNumberOfIds(8)
        for k in range(8):
                pts.InsertId( k, k+1 )
 
        mesh.InsertNextCell( VTK_HEXAHEDRON, pts )
 
        return mesh

meshUG = GetMesh()

# extract surface
surfFilter = vtkDataSetSurfaceFilter()
# print 'USE OF GEOMETRYFILTER -> HANGS'
# surfFilter = vtkGeometryFilter()
surfFilter.SetInput( meshUG )
surfFilter.Update()

# check results
nbMeshPoints = meshUG.GetNumberOfPoints() # result = 8 (OK)
nbMeshCells = meshUG.GetNumberOfCells() # result = 1 (OK)
nbSurfacePoints = surfFilter.GetOutput().GetNumberOfPoints() # result = 7 
(NOT OK : THE FIRST POINT IS MISSING)
nbSurfaceCells = surfFilter.GetOutput().GetNumberOfCells() # result = 6 
(OK ??? THE NORMALS ARE NOT THE EXPECTED ONES)
 
A.R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130418/af23855a/attachment.htm>


More information about the vtkusers mailing list