Creating a finite vtkcylinder and using it extractpolydata

Hello,

I am trying to generate a finete vtkcylinder subtracting 2 planes from a traditional vtkcylinder. The I would like to use this finite to extract cells from a larger polydata. But I don’t get any cells returned…

Thank you

double normalized[3];

// Calculate the midpoint
double midpoint[3];for (int i = 0; i < 3; ++i) {midpoint[i] = (point1[i] + point2[i]) / 2.0;}

// The X axis is a vector from start to end
vtkMath::Subtract(point2, point1, normalized); double length = vtkMath::Norm(normalized);
vtkMath::Normalize(normalized);


  vtkNew<vtkCylinder> implicitCylinder;
  implicitCylinder->SetRadius(0.1);
  implicitCylinder->SetAxis(normalized);
  implicitCylinder->SetCenter(midpoint);	  


// Create vtkPlaneSource for the first plane
vtkNew<vtkPlane> planeSource1;
planeSource1->SetOrigin(point1);
planeSource1->SetNormal(normalized);

vtkNew<vtkPlane> planeSource2;
planeSource2->SetOrigin(point2);
planeSource2->SetNormal(normalized);


// combine the two implicit functions
  vtkNew<vtkImplicitBoolean> boolean;
  boolean->AddFunction(implicitCylinder);
  boolean->AddFunction(planeSource1);
      boolean->SetOperationTypeToDifference();

  vtkNew<vtkImplicitBoolean> boolean2;
  boolean2->AddFunction(boolean);	
  boolean2->AddFunction(planeSource2);	
      boolean2->SetOperationTypeToDifference();

    vtkNew<vtkExtractPolyDataGeometry> extractGeometry;
    extractGeometry->SetImplicitFunction(boolean2);
    extractGeometry->SetInputData(globalPolyData);
    extractGeometry->ExtractInsideOn();
    extractGeometry->ExtractBoundaryCellsOn();
    extractGeometry->Update();

I get:

There are 0 clipped points.
There are 0 clipped cells.

2024-03-06 16:40:17.416 (  85.907s) [    7FDAC5A575C0]         vtkOBBTree.cxx:1078   ERR| vtkOBBTree (0x55f2710abb70): Can't build OBB tree - no data available!
Time for Local OBB , Max Level:0  Cells Per Bucket:  25 Data Structure Construction: 3.92847 seconds

I plotted a line source with the same direction:

Captura de tela de 2024-03-06 18-02-06