ENH: Add sphere overlap function to treeDataEdge and a test.

This commit is contained in:
laurence
2012-01-16 09:33:10 +00:00
parent 6a6986b4ce
commit cb308ce790
5 changed files with 150 additions and 0 deletions

View File

@ -139,6 +139,25 @@ bool Foam::treeDataEdge::overlaps
}
// Check if any point on shape is inside sphere.
bool Foam::treeDataEdge::overlaps
(
const label index,
const point& centre,
const scalar radiusSqr
) const
{
if (cacheBb_)
{
return bbs_[index].overlaps(centre, radiusSqr);
}
else
{
return calcBb(edgeLabels_[index]).overlaps(centre, radiusSqr);
}
}
// Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex,
// nearestPoint.
void Foam::treeDataEdge::findNearest

View File

@ -148,6 +148,14 @@ public:
const treeBoundBox& sampleBb
) const;
//- Does (bb of) shape at index overlap bb
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