BUG: indexedOctree : intersection might be outside current box for triangle straddling two boxes.

This commit is contained in:
mattijs
2011-01-24 12:37:54 +00:00
parent 121a377626
commit 4f30c291bd

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1623,6 +1623,8 @@ void Foam::indexedOctree<Type>::traverseNode
{
const labelList& indices = contents_[getContent(index)];
if (indices.size())
{
if (findAny)
{
// Find any intersection
@ -1634,6 +1636,8 @@ void Foam::indexedOctree<Type>::traverseNode
point pt;
bool hit = shapes_.intersects(shapeI, start, end, pt);
// Note that intersection of shape might actually be
// in a neighbouring box. For findAny this is not important.
if (hit)
{
// Hit so pt is nearer than nearestPoint.
@ -1647,7 +1651,9 @@ void Foam::indexedOctree<Type>::traverseNode
}
else
{
// Find nearest intersection.
// Find nearest intersection
const treeBoundBox octantBb(subBbox(nodeI, octant));
point nearestPoint(end);
@ -1656,9 +1662,20 @@ void Foam::indexedOctree<Type>::traverseNode
label shapeI = indices[elemI];
point pt;
bool hit = shapes_.intersects(shapeI, start, nearestPoint, pt);
bool hit = shapes_.intersects
(
shapeI,
start,
nearestPoint,
pt
);
if (hit)
// Note that intersection of shape might actually be
// in a neighbouring box. Since we need to maintain strict
// (findAny=false) ordering skip such an intersection. It
// will be found when we are doing the next box.
if (hit && octantBb.contains(pt))
{
// Hit so pt is nearer than nearestPoint.
nearestPoint = pt;
@ -1676,6 +1693,7 @@ void Foam::indexedOctree<Type>::traverseNode
}
}
}
}
// Nothing intersected in this node
// Traverse to end of node. Do by ray tracing back from end and finding