Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
4f30c291
Commit
4f30c291
authored
Jan 24, 2011
by
mattijs
Browse files
BUG: indexedOctree : intersection might be outside current box for triangle straddling two boxes.
parent
121a3776
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/meshTools/indexedOctree/indexedOctree.C
View file @
4f30c291
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-201
0
OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-201
1
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -1623,56 +1623,74 @@ void Foam::indexedOctree<Type>::traverseNode
{
const
labelList
&
indices
=
contents_
[
getContent
(
index
)];
if
(
f
ind
Any
)
if
(
ind
ices
.
size
()
)
{
// Find any intersection
forAll
(
indices
,
elemI
)
if
(
findAny
)
{
label
shapeI
=
indices
[
elemI
];
point
pt
;
bool
hit
=
shapes_
.
intersects
(
shapeI
,
start
,
end
,
pt
);
// Find any intersection
if
(
hit
)
forAll
(
indices
,
elemI
)
{
// Hit so pt is nearer than nearestPoint.
// Update hit info
hitInfo
.
setHit
();
hitInfo
.
setIndex
(
shapeI
);
hitInfo
.
setPoint
(
pt
);
return
;
}
}
}
else
{
// Find nearest intersection.
label
shapeI
=
indices
[
elemI
];
point
nearestPoint
(
end
);
point
pt
;
bool
hit
=
shapes_
.
intersects
(
shapeI
,
start
,
end
,
pt
);
forAll
(
indices
,
elemI
)
// 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.
// Update hit info
hitInfo
.
setHit
();
hitInfo
.
setIndex
(
shapeI
);
hitInfo
.
setPoint
(
pt
);
return
;
}
}
}
else
{
label
shapeI
=
indices
[
elemI
];
// Find nearest intersection
point
pt
;
bool
hit
=
shapes_
.
intersects
(
shapeI
,
start
,
nearestPoint
,
pt
);
const
treeBoundBox
octantBb
(
subBbox
(
nodeI
,
octant
));
if
(
hit
)
point
nearestPoint
(
end
);
forAll
(
indices
,
elemI
)
{
// Hit so pt is nearer than nearestPoint.
nearestPoint
=
pt
;
// Update hit info
hitInfo
.
setHit
();
hitInfo
.
setIndex
(
shapeI
);
hitInfo
.
setPoint
(
pt
);
label
shapeI
=
indices
[
elemI
];
point
pt
;
bool
hit
=
shapes_
.
intersects
(
shapeI
,
start
,
nearestPoint
,
pt
);
// 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
;
// Update hit info
hitInfo
.
setHit
();
hitInfo
.
setIndex
(
shapeI
);
hitInfo
.
setPoint
(
pt
);
}
}
}
if
(
hitInfo
.
hit
())
{
// Found intersected shape.
return
;
if
(
hitInfo
.
hit
())
{
// Found intersected shape.
return
;
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment