mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +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;
|
||||
if (inner_searchtree)
|
||||
{
|
||||
NgArray<STLTrigId> trigs;
|
||||
starttrig = GetNChartT()+1;
|
||||
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);
|
||||
const Point<3> & c = trig.center;
|
||||
|
||||
if (quadfun.Eval(c) > sqr (trig.rad))
|
||||
continue;
|
||||
return false;
|
||||
|
||||
Point<3> p = p3d;
|
||||
Vec<3> lam;
|
||||
int err = trig.ProjectInPlain(geometry->GetPoints(), GetNormal(), p, lam);
|
||||
bool inside = (err == 0 && lam(0) > -lamtol &&
|
||||
int err = trig.ProjectInPlain(geometry->GetPoints(), GetNormal(), p, lam);
|
||||
inside = (err == 0 && lam(0) > -lamtol &&
|
||||
lam(1) > -lamtol && (1-lam(0)-lam(1)) > -lamtol);
|
||||
|
||||
if (inside)
|
||||
{
|
||||
trignum=i;
|
||||
p3d = p;
|
||||
return i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if(inside)
|
||||
return trignum;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user