surfaceFeatures: Prevent floating point error when edge is parallel to plane

This commit is contained in:
Will Bainbridge
2020-07-01 14:32:51 +01:00
parent 559e6f9ce5
commit e8a2c4570b
3 changed files with 4 additions and 26 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -130,8 +130,6 @@ public:
Point& edgePoint
) const;
bool insideBoundBox(const Point&) const;
// Ostream operator

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -257,23 +257,6 @@ Foam::scalar Foam::line<Point, PointRef>::nearestDist
}
template<class Point, class PointRef>
bool Foam::line<Point, PointRef>::insideBoundBox(const Point& p) const
{
if
(
( p.x() < min(a_.x(), b_.x()) || p.x() > max(a_.x(), b_.x()) )
|| ( p.y() < min(a_.y(), b_.y()) || p.y() > max(a_.y(), b_.y()) )
|| ( p.z() < min(a_.z(), b_.z()) || p.z() > max(a_.z(), b_.z()) )
)
{
return false;
}
return true;
}
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
template<class Point, class PointRef>

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1540,10 +1540,7 @@ void Foam::selectCutEdges
// If edge does not intersect the plane, delete.
const scalar intersect = cutPlane.lineIntersect(line);
const point featPoint = intersect*(p1 - p0) + p0;
if (!line.insideBoundBox(featPoint))
if (intersect < 0 || intersect > 1)
{
edgeStat[edgei] = surfaceFeatures::NONE;
}