Skip to content
GitLab
Menu
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
0bbd3e55
Commit
0bbd3e55
authored
Feb 24, 2011
by
andy
Browse files
ENH: moved pointInTet() to inside() method in tetrahedron
parent
f2b04ab9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H
View file @
0bbd3e55
...
...
@@ -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
...
...
@@ -174,10 +174,10 @@ public:
)
const
;
//- Return nearest point to p on tetrahedron
inline
pointHit
nearestPoint
(
const
point
&
p
)
const
;
inline
pointHit
nearestPoint
(
const
point
&
p
)
const
;
//- Return true if point is inside tetrahedron
inline
bool
inside
(
const
point
&
pt
)
const
;
//- Return (min)containment sphere, i.e. the smallest sphere with
// all points inside. Returns pointHit with:
...
...
src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H
View file @
0bbd3e55
...
...
@@ -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
...
...
@@ -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 * * * * * * * * * * * * * //
template
<
class
Point
,
class
PointRef
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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