MCPcopy Create free account
hub / github.com/Kitware/VTK / ProcessUserDefinedCuts

Method ProcessUserDefinedCuts

Common/DataModel/vtkKdTree.cxx:921–974  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

919
920//------------------------------------------------------------------------------
921int vtkKdTree::ProcessUserDefinedCuts(double* minBounds)
922{
923 SCOPETIMER("ProcessUserDefinedCuts");
924
925 if (!this->Cuts)
926 {
927 vtkErrorMacro(<< "vtkKdTree::ProcessUserDefinedCuts - no cuts");
928 return 1;
929 }
930 // Fix the bounds for the entire partitioning. They must be at
931 // least as large of the bounds of all the data sets.
932
933 vtkKdNode* kd = this->Cuts->GetKdNodeTree();
934 double bounds[6];
935 kd->GetBounds(bounds);
936 int fixBounds = 0;
937
938 for (int j = 0; j < 3; j++)
939 {
940 int min = 2 * j;
941 int max = min + 1;
942
943 if (minBounds[min] < bounds[min])
944 {
945 bounds[min] = minBounds[min];
946 fixBounds = 1;
947 }
948 if (minBounds[max] > bounds[max])
949 {
950 bounds[max] = minBounds[max];
951 fixBounds = 1;
952 }
953 }
954
955 this->Top = vtkKdTree::CopyTree(kd);
956
957 if (fixBounds)
958 {
959 this->SetNewBounds(bounds);
960 }
961
962 // We don't really know the data bounds, so we'll just set them
963 // to the spatial bounds.
964
965 vtkKdTree::SetDataBoundsToSpatialBounds(this->Top);
966
967 // And, we don't know how many points are in each region. The number
968 // in the provided vtkBSPCuts object was for some other dataset. So
969 // we zero out those fields.
970
971 vtkKdTree::ZeroNumberOfPoints(this->Top);
972
973 return 0;
974}
975
976//------------------------------------------------------------------------------
977void vtkKdTree::ZeroNumberOfPoints(vtkKdNode* kd)

Callers 2

BuildLocatorInternalMethod · 0.95
BuildLocatorMethod · 0.80

Calls 2

SetNewBoundsMethod · 0.95
GetBoundsMethod · 0.45

Tested by

no test coverage detected