BUG: searchableSphere: findNearest

This commit is contained in:
laurence
2013-07-11 11:28:15 +01:00
parent 09d490f281
commit 6b91eb3bae

View File

@ -47,13 +47,11 @@ Foam::pointIndexHit Foam::searchableSphere::findNearest
{
pointIndexHit info(false, sample, -1);
const vector n(sample-centre_);
scalar magSqrN = magSqr(n);
const vector n(sample - centre_);
scalar magN = mag(n);
if (nearestDistSqr >= magSqrN)
if (nearestDistSqr >= sqr(magN - radius_))
{
scalar magN = Foam::sqrt(magSqrN);
if (magN < ROOTVSMALL)
{
info.rawPoint() = centre_ + vector(1,0,0)*radius_;