mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: moved pointInTet() to inside() method in tetrahedron
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -174,10 +174,10 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return nearest point to p on tetrahedron
|
//- Return nearest point to p on tetrahedron
|
||||||
inline pointHit nearestPoint
|
inline pointHit nearestPoint(const point& p) const;
|
||||||
(
|
|
||||||
const point& p
|
//- Return true if point is inside tetrahedron
|
||||||
) const;
|
inline bool inside(const point& pt) const;
|
||||||
|
|
||||||
//- Return (min)containment sphere, i.e. the smallest sphere with
|
//- Return (min)containment sphere, i.e. the smallest sphere with
|
||||||
// all points inside. Returns pointHit with:
|
// all points inside. Returns pointHit with:
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -380,6 +380,38 @@ inline Foam::pointHit Foam::tetrahedron<Point, PointRef>::nearestPoint
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Point, class PointRef>
|
||||||
|
bool Foam::tetrahedron<Point, PointRef>::inside(const point& pt) const
|
||||||
|
{
|
||||||
|
// For robustness, assuming that the point is in the tet unless
|
||||||
|
// "definitively" shown otherwise by obtaining a positive dot
|
||||||
|
// product greater than a tolerance of SMALL.
|
||||||
|
|
||||||
|
// The tet is defined: tet(Cc, tetBasePt, pA, pB) where the normal
|
||||||
|
// vectors and base points for the half-space planes are:
|
||||||
|
// area[0] = Sa();
|
||||||
|
// area[1] = Sb();
|
||||||
|
// area[2] = Sc();
|
||||||
|
// area[3] = Sd();
|
||||||
|
// planeBase[0] = tetBasePt = tet.b()
|
||||||
|
// planeBase[1] = ptA = tet.c()
|
||||||
|
// planeBase[2] = tetBasePt = tet.b()
|
||||||
|
// planeBase[3] = tetBasePt = tet.b()
|
||||||
|
|
||||||
|
vector n = Sa();
|
||||||
|
n /= (Foam::mag(n) + VSMALL);
|
||||||
|
|
||||||
|
if (((pt - b_) & n) > SMALL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Point, class PointRef>
|
template<class Point, class PointRef>
|
||||||
|
|||||||
Reference in New Issue
Block a user