------------------------------------------------------------------------------ Compute the sphere tree leafs (i.e., spheres around each cell)
| 1055 | //------------------------------------------------------------------------------ |
| 1056 | // Compute the sphere tree leafs (i.e., spheres around each cell) |
| 1057 | void vtkSphereTree::BuildTreeSpheres(vtkDataSet* input) |
| 1058 | { |
| 1059 | // See if anything has to be done |
| 1060 | if (this->Tree != nullptr && this->BuildTime > this->MTime) |
| 1061 | { |
| 1062 | return; |
| 1063 | } |
| 1064 | else if (this->Tree != nullptr) |
| 1065 | { |
| 1066 | this->Tree->Delete(); |
| 1067 | delete[] this->Selected; |
| 1068 | } |
| 1069 | |
| 1070 | // Allocate |
| 1071 | // |
| 1072 | vtkIdType numCells = input->GetNumberOfCells(); |
| 1073 | vtkDoubleArray* newScalars = vtkDoubleArray::New(); |
| 1074 | newScalars->SetNumberOfComponents(4); |
| 1075 | newScalars->SetNumberOfTuples(input->GetNumberOfCells()); |
| 1076 | this->Tree = newScalars; |
| 1077 | this->TreePtr = newScalars->GetPointer(0); |
| 1078 | |
| 1079 | this->Selected = new unsigned char[numCells]; |
| 1080 | |
| 1081 | if (input->GetDataObjectType() == VTK_STRUCTURED_GRID) |
| 1082 | { |
| 1083 | StructuredSpheres::Execute(vtkStructuredGrid::SafeDownCast(input), this->TreePtr); |
| 1084 | } |
| 1085 | |
| 1086 | else if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID) |
| 1087 | { |
| 1088 | UnstructuredSpheres::Execute(numCells, vtkUnstructuredGrid::SafeDownCast(input), this->TreePtr, |
| 1089 | this->BuildHierarchy, this->AverageRadius, this->SphereBounds); |
| 1090 | } |
| 1091 | |
| 1092 | else // default algorithm |
| 1093 | { |
| 1094 | DataSetSpheres::Execute(numCells, input, this->TreePtr, this->BuildHierarchy, |
| 1095 | this->AverageRadius, this->SphereBounds); |
| 1096 | } |
| 1097 | |
| 1098 | this->BuildTime.Modified(); |
| 1099 | } |
| 1100 | |
| 1101 | //------------------------------------------------------------------------------ |
| 1102 | void vtkSphereTree::BuildTreeHierarchy(vtkDataSet* input) |
no test coverage detected