mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 22:20:35 +05:00
Use BoxTree::GetFirstIntersecting in STLChart::ProjectNormal
This commit is contained in:
parent
90c6f0256d
commit
85d7f5e628
@ -832,31 +832,37 @@ STLTrigId STLChart :: ProjectNormal (Point<3> & p3d) const
|
|||||||
int starttrig = 1;
|
int starttrig = 1;
|
||||||
if (inner_searchtree)
|
if (inner_searchtree)
|
||||||
{
|
{
|
||||||
NgArray<STLTrigId> trigs;
|
|
||||||
starttrig = GetNChartT()+1;
|
starttrig = GetNChartT()+1;
|
||||||
Point<2> p2d = Project2d (p3d);
|
Point<2> p2d = Project2d (p3d);
|
||||||
inner_searchtree->GetIntersecting(p2d, p2d, trigs);
|
|
||||||
|
|
||||||
for (STLTrigId i : trigs)
|
|
||||||
|
bool inside = false;
|
||||||
|
STLTrigId trignum;
|
||||||
|
inner_searchtree->GetFirstIntersecting(p2d, p2d, [&](auto i)
|
||||||
{
|
{
|
||||||
auto & trig = geometry->GetTriangle(i);
|
auto & trig = geometry->GetTriangle(i);
|
||||||
const Point<3> & c = trig.center;
|
const Point<3> & c = trig.center;
|
||||||
|
|
||||||
if (quadfun.Eval(c) > sqr (trig.rad))
|
if (quadfun.Eval(c) > sqr (trig.rad))
|
||||||
continue;
|
return false;
|
||||||
|
|
||||||
Point<3> p = p3d;
|
Point<3> p = p3d;
|
||||||
Vec<3> lam;
|
Vec<3> lam;
|
||||||
int err = trig.ProjectInPlain(geometry->GetPoints(), GetNormal(), p, lam);
|
int err = trig.ProjectInPlain(geometry->GetPoints(), GetNormal(), p, lam);
|
||||||
bool inside = (err == 0 && lam(0) > -lamtol &&
|
inside = (err == 0 && lam(0) > -lamtol &&
|
||||||
lam(1) > -lamtol && (1-lam(0)-lam(1)) > -lamtol);
|
lam(1) > -lamtol && (1-lam(0)-lam(1)) > -lamtol);
|
||||||
|
|
||||||
if (inside)
|
if (inside)
|
||||||
{
|
{
|
||||||
|
trignum=i;
|
||||||
p3d = p;
|
p3d = p;
|
||||||
return i;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if(inside)
|
||||||
|
return trignum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user