set uv-params in quads correctly

Just projecting might lead to wrong results if a face contains edges
twice.
This commit is contained in:
Matthias Hochsteger 2022-10-07 18:32:53 +02:00
parent a9234a589a
commit d837d92f0f

View File

@ -817,7 +817,15 @@ namespace netgen
Transformation<3> trafo;
if(face.IsConnectingCloseSurfaces())
for(const auto &s : segments)
{
Array<ArrayMem<int, 2>, PointIndex> p2seg(mesh.Points().Size());
for(int si : Range(segments))
{
const auto & s = segments[si];
p2seg[s[0]].Append(si);
p2seg[s[1]].Append(si);
}
for(const auto & s : segments)
{
auto edgenr = s.edgenr-1;
auto & edge = *edges[edgenr];
@ -850,13 +858,35 @@ namespace netgen
sel[1] = s[1];
sel[2] = tree.Find(trafo(mesh[s[1]]));
sel[3] = tree.Find(trafo(mesh[s[0]]));
for(auto i : Range(4))
sel.GeomInfo()[i] = face.Project(mesh[sel[i]]);
auto gis = sel.GeomInfo();
for(auto i : Range(2))
{
gis[i].u = s.epgeominfo[i].u;
gis[i].v = s.epgeominfo[i].v;
}
// find mapped segment to set PointGeomInfo correctly
Segment s_other;
for(auto si_other : p2seg[sel[2]])
{
s_other = segments[si_other];
if(s_other[0] == sel[2] && s_other[1] == sel[3])
break;
if(s_other[0] == sel[3] && s_other[1] == sel[2])
break;
}
for(auto i : Range(2))
{
auto i_other = sel[i+2] == s_other[i] ? i : 1-i;
gis[i+2].u = s_other.epgeominfo[i_other].u;
gis[i+2].v = s_other.epgeominfo[i_other].v;
}
sel.SetIndex(face.nr+1);
mesh.AddSurfaceElement(sel);
}
}
}
else
if(MeshFace(mesh, mparam, k, glob2loc))
n_failed_faces++;