vtkBooleanPolyDataFilter gives unexpected output for non-intersecting objects
What:
vtkBooleanPolyDataFilter
results in an empty vtkPolyData() if two input objects are not intersecting.
How to reproduce:
import vtk
a = vtk.vtkSphereSource()
a.SetCenter(0,0,0)
a.Update()
b = vtk.vtkSphereSource()
b.SetCenter(4,0,0)
b.Update()
boolean1 = vtk.vtkBooleanOperationPolyDataFilter()
boolean1.SetOperationToUnion()
boolean1.SetInputData(0, a.GetOutput())
boolean1.SetInputData(1, b.GetOutput())
boolean1.Update()
print(boolean1.GetOutput())
For the output, see below.
Expected behaviour:
Option 1: Require that the input is intersecting. Leave a message in the documentation. Add a function to vtkBooleanOperationPolyDataFilter
to check whether the objects are intersecting. (I don't see the point that the user should call vtkIntersectionPolyDataFilter
herself because vtkBooleanOperationPolyDataFilter
will call it anyways...)
Option 2:
- For intersection: return an empty
vtkPolyData()
. This is already the case. - For union:
vtkBooleanOperationPolyDataFilter
returns the true set-union for the non-intersecting points. Maybe simply the output ofvtkAppendPolyData
? Missing. - For difference: return the first input data (sphere
a
in the example). Missing.
Console output
ERROR: In ../Common/DataModel/vtkPointLocator.cxx, line 867
vtkPointLocator (0x7fa4e16b6140): No points to subdivide
Generic Warning: In ../Filters/General/vtkIntersectionPolyDataFilter.cxx, line 2535
No Intersection between objects
ERROR: In ../Filters/General/vtkDistancePolyDataFilter.cxx, line 80
vtkDistancePolyDataFilter (0x7fa4e16bd130): No points/cells to operate on
ERROR: In ../Filters/General/vtkDistancePolyDataFilter.cxx, line 80
vtkDistancePolyDataFilter (0x7fa4e16bd130): No points/cells to operate on
vtkPolyData (0x7fa4e159b160)
Debug: Off
Modified Time: 261793
Reference Count: 1
Registered Events: (none)
Information: 0x7fa4e1590680
Data Released: False
Global Release Data: Off
UpdateTime: 0
Field Data:
Debug: Off
Modified Time: 261790
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 0
Number Of Cells: 0
Cell Data:
Debug: Off
Modified Time: 261793
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (0x7fa4e1583d10)
Event: 33
EventName: ModifiedEvent
Command: 0x7fa4e1583f00
Priority: 0
Tag: 1
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Point Data:
Debug: Off
Modified Time: 261792
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (0x7fa4e1589490)
Event: 33
EventName: ModifiedEvent
Command: 0x7fa4e1583f00
Priority: 0
Tag: 1
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Bounds:
Xmin,Xmax: (1, -1)
Ymin,Ymax: (1, -1)
Zmin,Zmax: (1, -1)
Compute Time: 261799
Number Of Points: 0
Point Coordinates: 0x0
Locator: 0x0
Number Of Vertices: 0
Number Of Lines: 0
Number Of Polygons: 0
Number Of Triangle Strips: 0
Number Of Pieces: 1
Piece: -1
Ghost Level: 0