vtkCellCenters() generates non plausible centers for vtk.VTK_CONVEX_POINT_SET
When I apply vtkCellCenters() to a unstructured grid with cell types vtk.VTK_CONVEX_POINT_SET (41), the cell centers are not in the centers of the cells.
Steps for reproduction:
import vtk
import numpy as np
expected_values = [[9, 0, 0.5], [12, 0, 0.5],
[15, 0, 0.5], [18, 0, 0.5],
[21, 0, 0.5], [24, 0, 0.5],
[27, 0, 0.5]]
# Lese die VTU-Datei ein
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName("test.vtu")
reader.Update()
# Erstelle den vtkCellCenters-Filter
cell_centers = vtk.vtkCellCenters()
cell_centers.SetInputConnection(reader.GetOutputPort())
cell_centers.Update()
# Hole die Mittelpunkte
centers = cell_centers.GetOutput()
# Drucke die Mittelpunkte
for i in range(centers.GetNumberOfPoints()):
print(expected_values[i])
print(centers.GetPoint(i))
print("-----")
returns
[9, 0, 0.5]
(8.56698751449585, -1.25, 0.5)
-----
[12, 0, 0.5]
(11.0, -1.0000000000000002, 0.5)
-----
[15, 0, 0.5]
(13.755050659179688, -0.595491498708725, 0.5)
-----
[18, 0, 0.5]
(16.700961112976074, -0.25, 0.5)
-----
[21, 0, 0.5]
(19.730704307556152, 0.012229330837726593, 0.5)
-----
[24, 0, 0.5]
(22.792892456054688, 0.2071067690849303, 0.5)
-----
[27, 0, 0.5]
(25.864808082580566, 0.35286852717399597, 0.5)
Here the first value is the expected value and the second value is calculated by vtkCellCenters()