| 200 | } |
| 201 | |
| 202 | void operator()(vtkIdType cellId, vtkIdType endCellId) |
| 203 | { |
| 204 | vtkDataSet* ds = this->DataSet; |
| 205 | double* sphere = this->Spheres + 4 * cellId; |
| 206 | double r, bounds[6]; |
| 207 | double& radius = this->Radius.Local(); |
| 208 | vtkIdType& count = this->Count.Local(); |
| 209 | double& xmin = this->XMin.Local(); |
| 210 | double& ymin = this->YMin.Local(); |
| 211 | double& zmin = this->ZMin.Local(); |
| 212 | double& xmax = this->XMax.Local(); |
| 213 | double& ymax = this->YMax.Local(); |
| 214 | double& zmax = this->ZMax.Local(); |
| 215 | |
| 216 | for (; cellId < endCellId; ++cellId, sphere += 4) |
| 217 | { |
| 218 | ds->GetCellBounds(cellId, bounds); |
| 219 | sphere[0] = (bounds[0] + bounds[1]) / 2.0; |
| 220 | sphere[1] = (bounds[2] + bounds[3]) / 2.0; |
| 221 | sphere[2] = (bounds[4] + bounds[5]) / 2.0; |
| 222 | sphere[3] = sqrt((bounds[1] - sphere[0]) * (bounds[1] - sphere[0]) + |
| 223 | (bounds[3] - sphere[1]) * (bounds[3] - sphere[1]) + |
| 224 | (bounds[5] - sphere[2]) * (bounds[5] - sphere[2])); |
| 225 | |
| 226 | if (this->ComputeBoundsAndRadius) |
| 227 | { |
| 228 | // Keep a bounds for the dataset |
| 229 | r = sphere[3]; |
| 230 | xmin = std::min(xmin, (sphere[0] - r)); |
| 231 | xmax = std::max(xmax, (sphere[0] + r)); |
| 232 | ymin = std::min(ymin, (sphere[1] - r)); |
| 233 | ymax = std::max(ymax, (sphere[1] + r)); |
| 234 | zmin = std::min(zmin, (sphere[2] - r)); |
| 235 | zmax = std::max(zmax, (sphere[2] + r)); |
| 236 | |
| 237 | // Keep a running average of the radius |
| 238 | count++; |
| 239 | radius = radius + (r - radius) / static_cast<double>(count); |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | // Compute approximation to the average radius, compute bounds |
| 245 | void Reduce() |
nothing calls this directly
no test coverage detected