Commit 109dadd7 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[disttobound] add overload for point-box

parent 04e587e9
......@@ -146,6 +146,27 @@ computeDistanceToBoundary(const Point<ctype1, 3>& p,
return distance;
}
/*!
* \ingroup Distance
* \brief Compute the distance of a point
* to the surface of a box.
* \param p The point
* \param box The box
*/
template<class ctype1, class ctype2>
PromotedType<ctype1, ctype2>
computeDistanceToBoundary(const Point<ctype1, 3>& p,
const Box<ctype2>& box)
{
using std::min;
using ctype = PromotedType<ctype1, ctype2>;
ctype distance = std::numeric_limits<ctype>::max();
for (unsigned int i = 0; i < box.numFaces(); ++i)
distance = min(distance, computeDistance(box.face(i), p));
return distance;
}
/*!
* \ingroup Distance
* \brief Compute the distance of a geometry
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment