[vtkusers] Is there a way to check data before using vtkBooleanOperationPolyDataFilter?
ftouvet
francois.touvet at inria.fr
Tue Jan 28 12:06:15 EST 2014
I checked the normals of the two models and there it was: the first had all
its normals pointing outward while the second had it pointing inward...
I tried the two solutions: all normals pointing inward gives non-correct
results, all pointing outward does.
I changed also most of the parameters of my vtkPolyDataNormals, which were
useless in my case.
Here is the effective pipeline:
#Poly1 = polydata with normals pointing outward
# Smooth the polyData
smoothf0 = vtkSmoothPolyDataFilter()
smoothf0.SetInput(poly1)
smoothf0.Update()
# Conversion to Triangles
trif0 = vtk.vtkTriangleFilter()
trif0.SetInput(smoothf0.GetOutput())
trif0.PassVertsOff()
trif0.PassLinesOff()
trif0.Update()
# Recompute Normals
normalf0 = vtk.vtkPolyDataNormals()
normalf0.SetInput(trif0.GetOutput())
normalf0.ComputePointNormalsOn()
normalf0.ComputeCellNormalsOff()
normalf0.SplittingOff()
normalf0.ConsistencyOn()
normalf0.AutoOrientNormalsOff()
normalf0.Update()
#Poly2 = polydata with normals pointing inward
# Smooth the polyData
smoothf1 = vtkSmoothPolyDataFilter()
smoothf1.SetInput(poly2)
smoothf1.Update()
# Remove Duplicate points/unused points/degenerate cells
cleanf1 = vtk.vtkCleanPolyData()
cleanf1.SetInput(smoothf1.GetOutput())
cleanf1.ConvertStripsToPolysOn()
cleanf1.ConvertPolysToLinesOn()
cleanf1.ConvertLinesToPointsOn()
cleanf1.Update()
# Conversion to Triangles
trif1 = vtk.vtkTriangleFilter()
trif1.SetInput(cleanf1.GetOutput())
trif1.PassVertsOff()
trif1.PassLinesOff()
trif1.Update()
# Recompute Normals
normalf1 = vtk.vtkPolyDataNormals()
normalf1.SetInput(trif1.GetOutput())
normalf1.ComputePointNormalsOn()
normalf1.ComputeCellNormalsOff()
normalf1.SplittingOff()
normalf1.ConsistencyOn()
normalf1.FlipNormalsOn() # must be outward!
normalf1.AutoOrientNormalsOff()
normalf1.Update()
# Treatment
# Design Boolean operation. Operation = 0,1,2 for Union; Intersection,
Difference
boolFilter = vtk.vtkBooleanOperationPolyDataFilter()
boolFilter.SetOperation(Operation)
boolFilter.SetInput(0,normalf0.GetOutput());
boolFilter.SetInput(1,normalf1.GetOutput());
boolFilter.Update()
--
View this message in context: http://vtk.1045678.n5.nabble.com/Is-there-a-way-to-check-data-before-using-vtkBooleanOperationPolyDataFilter-tp5725561p5725675.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list