mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
Use unnamed namespace for struct Line in basegeom.cpp
See https://github.com/NGSolve/netgen/issues/198
This commit is contained in:
parent
c7adfee5d8
commit
36cdde4889
@ -214,22 +214,24 @@ namespace netgen
|
||||
}
|
||||
}
|
||||
|
||||
struct Line
|
||||
{
|
||||
Point<3> p0, p1;
|
||||
inline double Length() const { return (p1-p0).Length(); }
|
||||
inline double Dist(const Line& other) const
|
||||
namespace {
|
||||
struct Line
|
||||
{
|
||||
Vec<3> n = p1-p0;
|
||||
Vec<3> q = other.p1-other.p0;
|
||||
double nq = n*q;
|
||||
Point<3> p = p0 + 0.5*n;
|
||||
double lambda = (p-other.p0)*n / (nq + 1e-10);
|
||||
if (lambda >= 0 && lambda <= 1)
|
||||
return (p-other.p0-lambda*q).Length();
|
||||
return 1e99;
|
||||
}
|
||||
};
|
||||
Point<3> p0, p1;
|
||||
inline double Length() const { return (p1-p0).Length(); }
|
||||
inline double Dist(const Line& other) const
|
||||
{
|
||||
Vec<3> n = p1-p0;
|
||||
Vec<3> q = other.p1-other.p0;
|
||||
double nq = n*q;
|
||||
Point<3> p = p0 + 0.5*n;
|
||||
double lambda = (p-other.p0)*n / (nq + 1e-10);
|
||||
if (lambda >= 0 && lambda <= 1)
|
||||
return (p-other.p0-lambda*q).Length();
|
||||
return 1e99;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void NetgenGeometry :: Clear()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user