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

Method Distance2ToBounds

Common/DataModel/vtkCellLocator.cxx:1057–1073  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Calculate the distance between the point x and the specified bounds WARNING!!!!! Be very careful altering this routine. Simple changes to this routine can make it 25% slower!!!!

Source from the content-addressed store, hash-verified

1055// WARNING!!!!! Be very careful altering this routine. Simple changes to this
1056// routine can make it 25% slower!!!!
1057double vtkCellLocator::Distance2ToBounds(const double x[3], double bounds[6])
1058{
1059 // Are we within the bounds?
1060 if (x[0] >= bounds[0] && x[0] <= bounds[1] && x[1] >= bounds[2] && x[1] <= bounds[3] &&
1061 x[2] >= bounds[4] && x[2] <= bounds[5])
1062 {
1063 return 0.0;
1064 }
1065 double deltas[3];
1066 // NOLINTNEXTLINE(readability-avoid-nested-conditional-operator)
1067 deltas[0] = x[0] < bounds[0] ? bounds[0] - x[0] : (x[0] > bounds[1] ? x[0] - bounds[1] : 0.0);
1068 // NOLINTNEXTLINE(readability-avoid-nested-conditional-operator)
1069 deltas[1] = x[1] < bounds[2] ? bounds[2] - x[1] : (x[1] > bounds[3] ? x[1] - bounds[3] : 0.0);
1070 // NOLINTNEXTLINE(readability-avoid-nested-conditional-operator)
1071 deltas[2] = x[2] < bounds[4] ? bounds[4] - x[2] : (x[2] > bounds[5] ? x[2] - bounds[5] : 0.0);
1072 return vtkMath::SquaredNorm(deltas);
1073}
1074
1075//------------------------------------------------------------------------------
1076vtkIdType vtkCellLocator::FindCell(double x[3], double vtkNotUsed(tol2), vtkGenericCell* cell,

Callers 2

Distance2ToBucketMethod · 0.95

Calls 1

SquaredNormFunction · 0.70

Tested by

no test coverage detected