mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: treDataPrimitivePatch: added self intersection operator
This commit is contained in:
@ -187,6 +187,19 @@ Foam::treeDataPrimitivePatch<PatchType>::findAllIntersectOp::findAllIntersectOp
|
||||
{}
|
||||
|
||||
|
||||
template<class PatchType>
|
||||
Foam::treeDataPrimitivePatch<PatchType>::
|
||||
findSelfIntersectOp::findSelfIntersectOp
|
||||
(
|
||||
const indexedOctree<treeDataPrimitivePatch<PatchType> >& tree,
|
||||
const label edgeID
|
||||
)
|
||||
:
|
||||
tree_(tree),
|
||||
edgeID_(edgeID)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class PatchType>
|
||||
@ -645,4 +658,46 @@ bool Foam::treeDataPrimitivePatch<PatchType>::findAllIntersectOp::operator()
|
||||
}
|
||||
|
||||
|
||||
template<class PatchType>
|
||||
bool Foam::treeDataPrimitivePatch<PatchType>::findSelfIntersectOp::operator()
|
||||
(
|
||||
const label index,
|
||||
const point& start,
|
||||
const point& end,
|
||||
point& intersectionPoint
|
||||
) const
|
||||
{
|
||||
if (edgeID_ == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"findSelfIntersectOp::operator()\n"
|
||||
"(\n"
|
||||
" const label index,\n"
|
||||
" const point& start,\n"
|
||||
" const point& end,\n"
|
||||
" point& intersectionPoint\n"
|
||||
") const"
|
||||
) << "EdgeID not set. Please set edgeID to the index of"
|
||||
<< " the edge you are testing"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const treeDataPrimitivePatch<PatchType>& shape = tree_.shapes();
|
||||
const PatchType& patch = shape.patch();
|
||||
|
||||
const typename PatchType::FaceType& f = patch.localFaces()[index];
|
||||
const edge& e = patch.edges()[edgeID_];
|
||||
|
||||
if (findIndex(f, e[0]) == -1 && findIndex(f, e[1]) == -1)
|
||||
{
|
||||
return findIntersection(tree_, index, start, end, intersectionPoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -141,8 +141,8 @@ public:
|
||||
|
||||
findIntersectOp(const indexedOctree<treeDataPrimitivePatch>& tree);
|
||||
|
||||
//- Calculate intersection of triangle with ray. Sets result
|
||||
// accordingly
|
||||
//- Calculate intersection of any face with ray. Sets result
|
||||
// accordingly. Used to find first intersection.
|
||||
bool operator()
|
||||
(
|
||||
const label index,
|
||||
@ -167,8 +167,34 @@ public:
|
||||
DynamicList<label>& shapeMask
|
||||
);
|
||||
|
||||
//- Calculate intersection of triangle with ray. Sets result
|
||||
// accordingly
|
||||
//- Calculate intersection of unique face with ray. Sets result
|
||||
// accordingly. Used to find all faces.
|
||||
bool operator()
|
||||
(
|
||||
const label index,
|
||||
const point& start,
|
||||
const point& end,
|
||||
point& intersectionPoint
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
class findSelfIntersectOp
|
||||
{
|
||||
const indexedOctree<treeDataPrimitivePatch>& tree_;
|
||||
|
||||
const label edgeID_;
|
||||
|
||||
public:
|
||||
|
||||
findSelfIntersectOp
|
||||
(
|
||||
const indexedOctree<treeDataPrimitivePatch>& tree,
|
||||
const label edgeID
|
||||
);
|
||||
|
||||
//- Calculate intersection of face with edge of patch. Excludes
|
||||
// faces that use edgeID. Used to find self intersection.
|
||||
bool operator()
|
||||
(
|
||||
const label index,
|
||||
|
||||
Reference in New Issue
Block a user