Merging points of neighbour cells with vtkCleanPolyData

Hi,

I wish to extract the outer surface of a shape made of hexahedron. vtkGeometryFilter unfortunately can’t do it because these hexahedron are not sharing points.

@will.schroeder suggested to use vtkCleanPolyData : PointMergingOn setting enabling vtkMergePoints is exactly what I need.

Unfortunately the algorithm destroy my polygons as shown on the right side picture, despite defining a 0 tolerance to only merge points that are equal (left part highlight all points that appear more than once in the whole piece, which proves all these hexahedron are all disconnected).

Defining tolerance as absolute produce another kind of monster where all hexahedron faces turn to triangle instead of quads, despite all degenerate geometry transformation are forbidden by settings.

I think I enabled the settings as suggested by the algorithm documentation :

// This is supposed to filter outer surface, but actually does not filter 
// anything when input is made of hexahedron with non merged points but
// converts source to polygons, which is our goal here
convertToPoly = new vtkGeometryFilter();
convertToPoly.SetInputConnection(output);

// This will merge doublon points only if their coordinates exactly match
cleanPolyData = new vtkCleanPolyData();
cleanPolyData.SetInputConnection(convertToPoly.GetOutputPort());
cleanPolyData.SetTolerance(0.0);
cleanPolyData.ToleranceIsAbsoluteOff(); // relative to bounding box

cleanPolyData.PointMergingOn();

cleanPolyData.ConvertLinesToPointsOff();
cleanPolyData.ConvertPolysToLinesOff();
cleanPolyData.ConvertStripsToPolysOff();

I should mention I am working with VTK Java Wrapper and that rendering is performed with JOGL on MacOS instead of VTK (because VTK rendering crashes in this case).

Would anyone suggest a better setting or algorithm to merge points that are duplicated?

Thanks!