diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C index 81b3a1c85a6a1448fe2c652e3aa6a0a8ecc6e2e5..05b37e2f76047d869fb71536761c8b95995c6864 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C @@ -75,6 +75,27 @@ bool Foam::dynamicTreeDataPoint::overlaps } +// Check if any point on shape is inside sphere. +bool Foam::dynamicTreeDataPoint::overlaps +( + const label index, + const point& centre, + const scalar radiusSqr +) const +{ + const point& p = points_[index]; + + const scalar distSqr = magSqr(p - centre); + + if (distSqr <= radiusSqr) + { + return true; + } + + return false; +} + + // Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex, // nearestPoint. void Foam::dynamicTreeDataPoint::findNearest diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H index 6ada3c05125eb8c6b506b9d2b2adf000353b639e..9afcb3e08cba4d19a1cecebdeebf09c6f7f01a17 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.H @@ -105,6 +105,14 @@ public: const treeBoundBox& sampleBb ) const; + //- Check if any point on shape is inside sphere. + bool overlaps + ( + const label index, + const point& centre, + const scalar radiusSqr + ) const; + //- Calculates nearest (to sample) point in shape. // Returns actual point and distance (squared) void findNearest