int PolyDataGenerator::BlockInsideOrOutsideSurface(const Block &block) { // Create an OBB tree for the block vtkOBBTree *blockSlightlyLargerOBBTree = block.CreateOBBTreeModel(1.0); // Count the number of domain OBB leaf nodes that intersect the single // node created for the block. int intersection_count = 0; Locator->IntersectWithOBBTree(blockSlightlyLargerOBBTree, NULL, IntersectingLeafCounter, static_cast<void*>(&intersection_count)); // Delete the underlying polydata blockSlightlyLargerOBBTree->GetDataSet()->Delete(); // And the OBBTree itself blockSlightlyLargerOBBTree->Delete(); if (intersection_count == 0) { // either entirely inside or entirely outside double middlePosition[3]; middlePosition[0] = block.Middle().Position[0]; middlePosition[1] = block.Middle().Position[1]; middlePosition[2] = block.Middle().Position[2]; return Locator->InsideOrOutside(middlePosition); } return 0; }