surfaceFeatureExtract: Refactored core line and edge functions corresponding classes
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -97,12 +97,15 @@ public:
|
||||
//- Return end vertex label
|
||||
inline label& end();
|
||||
|
||||
//- Given one vertex, return the other
|
||||
inline label otherVertex(const label a) const;
|
||||
//- Return true if connected to given edge
|
||||
inline bool connected(const edge& a) const;
|
||||
|
||||
//- Return common vertex
|
||||
inline label commonVertex(const edge& a) const;
|
||||
|
||||
//- Given one vertex, return the other
|
||||
inline label otherVertex(const label a) const;
|
||||
|
||||
//- Flip the edge in-place.
|
||||
inline void flip();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -100,20 +100,21 @@ inline Foam::label& Foam::edge::end()
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::edge::otherVertex(const label a) const
|
||||
inline bool Foam::edge::connected(const edge& a) const
|
||||
{
|
||||
if (a == start())
|
||||
if
|
||||
(
|
||||
start() == a.start()
|
||||
|| start() == a.end()
|
||||
|| end() == a.start()
|
||||
|| end() == a.end()
|
||||
)
|
||||
{
|
||||
return end();
|
||||
}
|
||||
else if (a == end())
|
||||
{
|
||||
return start();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The given vertex is not on the edge in the first place.
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,6 +137,23 @@ inline Foam::label Foam::edge::commonVertex(const edge& a) const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::edge::otherVertex(const label a) const
|
||||
{
|
||||
if (a == start())
|
||||
{
|
||||
return end();
|
||||
}
|
||||
else if (a == end())
|
||||
{
|
||||
return start();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The given vertex is not on the edge in the first place.
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
inline void Foam::edge::flip()
|
||||
{
|
||||
Swap(operator[](0), operator[](1));
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -130,6 +130,8 @@ public:
|
||||
Point& edgePoint
|
||||
) const;
|
||||
|
||||
bool insideBoundBox(const Point&) const;
|
||||
|
||||
|
||||
// Ostream operator
|
||||
|
||||
|
||||
@ -257,6 +257,23 @@ 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>
|
||||
|
||||
Reference in New Issue
Block a user