From 1e78a1486552d9ab5e6c83de2fa4cc2878985038 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Wed, 13 Jan 2010 19:08:01 +0000 Subject: [PATCH] Handle tracking on face or edge --- src/meshTools/indexedOctree/indexedOctree.C | 54 +++++++++++---------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/src/meshTools/indexedOctree/indexedOctree.C b/src/meshTools/indexedOctree/indexedOctree.C index 128e6bf6002..1d444eff3da 100644 --- a/src/meshTools/indexedOctree/indexedOctree.C +++ b/src/meshTools/indexedOctree/indexedOctree.C @@ -957,6 +957,7 @@ Foam::point Foam::indexedOctree<Type>::pushPointIntoFace } else if (nFaces == 1) { + // Point is on a single face keepFaceID = faceIndices[0]; } else @@ -1782,16 +1783,6 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine label i = 0; for (; i < 100000; i++) { - if (verbose) - { - Pout<< "iter:" << i - << " at startPoint:" << hitInfo.rawPoint() << endl - << " node:" << nodeI - << " octant:" << octant - << " bb:" << subBbox(nodeI, octant) << endl; - } - - // Ray-trace to end of current node. Updates point (either on triangle // in case of hit or on node bounding box in case of miss) @@ -1808,6 +1799,19 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine ) ); + if (verbose) + { + Pout<< "iter:" << i + << " at current:" << hitInfo.rawPoint() + << " (perturbed:" << startPoint << ")" << endl + << " node:" << nodeI + << " octant:" << octant + << " bb:" << subBbox(nodeI, octant) << endl; + } + + + + // Faces of current bounding box current point is on direction hitFaceID = 0; @@ -1833,12 +1837,23 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine break; } - if (hitFaceID == 0) + if (hitFaceID == 0 || hitInfo.rawPoint() == treeEnd) { // endpoint inside the tree. Return miss. break; } + // Create a point on other side of face. + point perturbedPoint + ( + pushPoint + ( + octantBb, + hitFaceID, + hitInfo.rawPoint(), + false // push outside of octantBb + ) + ); if (verbose) { @@ -1848,14 +1863,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine << " node:" << nodeI << " octant:" << octant << " bb:" << subBbox(nodeI, octant) << nl - << " walking to neighbour containing:" - << pushPoint - ( - octantBb, - hitFaceID, - hitInfo.rawPoint(), - false // push outside of octantBb - ) + << " walking to neighbour containing:" << perturbedPoint << endl; } @@ -1866,13 +1874,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine bool ok = walkToNeighbour ( - pushPoint - ( - octantBb, - hitFaceID, - hitInfo.rawPoint(), - false // push outside of octantBb - ), + perturbedPoint, hitFaceID, // face(s) that hitInfo is on nodeI, -- GitLab