Use unnamed namespace for struct Line in basegeom.cpp

See https://github.com/NGSolve/netgen/issues/198
This commit is contained in:
Matthias Hochsteger 2024-12-06 11:15:40 +01:00
parent c7adfee5d8
commit 36cdde4889

View File

@ -214,22 +214,24 @@ namespace netgen
} }
} }
struct Line namespace {
{ struct Line
Point<3> p0, p1;
inline double Length() const { return (p1-p0).Length(); }
inline double Dist(const Line& other) const
{ {
Vec<3> n = p1-p0; Point<3> p0, p1;
Vec<3> q = other.p1-other.p0; inline double Length() const { return (p1-p0).Length(); }
double nq = n*q; inline double Dist(const Line& other) const
Point<3> p = p0 + 0.5*n; {
double lambda = (p-other.p0)*n / (nq + 1e-10); Vec<3> n = p1-p0;
if (lambda >= 0 && lambda <= 1) Vec<3> q = other.p1-other.p0;
return (p-other.p0-lambda*q).Length(); double nq = n*q;
return 1e99; 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() void NetgenGeometry :: Clear()
{ {