Skip to content
Snippets Groups Projects
Commit 7f21cc34 authored by mattijs's avatar mattijs
Browse files

BUG: searachableSphere: handle point on centre

parent 1e81657d
No related merge requests found
......@@ -48,13 +48,15 @@ Foam::pointIndexHit Foam::searchableSphere::findNearest
pointIndexHit info(false, sample, -1);
const vector n(sample-centre_);
scalar magN = mag(n);
scalar magSqrN = magSqr(n);
if (nearestDistSqr > sqr(magN-radius_))
if (nearestDistSqr >= magSqrN)
{
scalar magN = Foam::sqrt(magSqrN);
if (magN < ROOTVSMALL)
{
info.rawPoint() = centre_ + vector(1,0,0)/magN*radius_;
info.rawPoint() = centre_ + vector(1,0,0)*radius_;
}
else
{
......
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