mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
more stable occ parameter space projection
occ uv parameters are not very accurate sometimes, therefore new strategy for finding same uv points in parameter space: if uv coordinates are closer together than 0.9 * min(seg_length) and global point numbers are the same -> same uv point
This commit is contained in:
parent
9f2daabc0f
commit
bb25aa656a
@ -817,6 +817,7 @@ public:
|
||||
: BoxTree(box.PMin(), box.PMax())
|
||||
{ }
|
||||
|
||||
void SetTolerance(double _tol) { tol = _tol; }
|
||||
double GetTolerance() { return tol; }
|
||||
|
||||
size_t GetNLeaves()
|
||||
|
@ -79,12 +79,17 @@ namespace netgen
|
||||
Meshing2 :: ~Meshing2 ()
|
||||
{ ; }
|
||||
|
||||
void Meshing2 :: AddPoint (const Point3d & p, PointIndex globind,
|
||||
MultiPointGeomInfo * mgi,
|
||||
bool pointonsurface)
|
||||
int Meshing2 :: AddPoint (const Point3d & p, PointIndex globind,
|
||||
MultiPointGeomInfo * mgi,
|
||||
bool pointonsurface)
|
||||
{
|
||||
//(*testout) << "add point " << globind << endl;
|
||||
adfront.AddPoint (p, globind, mgi, pointonsurface);
|
||||
return adfront.AddPoint (p, globind, mgi, pointonsurface);
|
||||
}
|
||||
|
||||
PointIndex Meshing2 :: GetGlobalIndex(int pi) const
|
||||
{
|
||||
return adfront.GetGlobalIndex(pi);
|
||||
}
|
||||
|
||||
void Meshing2 :: AddBoundaryElement (int i1, int i2,
|
||||
|
@ -66,8 +66,9 @@ public:
|
||||
|
||||
|
||||
///
|
||||
DLL_HEADER void AddPoint (const Point3d & p, PointIndex globind, MultiPointGeomInfo * mgi = NULL,
|
||||
DLL_HEADER int AddPoint (const Point3d & p, PointIndex globind, MultiPointGeomInfo * mgi = NULL,
|
||||
bool pointonsurface = true);
|
||||
DLL_HEADER PointIndex GetGlobalIndex(int pi) const;
|
||||
|
||||
///
|
||||
DLL_HEADER void AddBoundaryElement (INDEX i1, INDEX i2,
|
||||
|
@ -350,6 +350,14 @@ namespace netgen
|
||||
uv_box.Add( {seg.epgeominfo[i].u, seg.epgeominfo[i].v } );
|
||||
|
||||
BoxTree<2> uv_tree(uv_box);
|
||||
double tol = 1e99;
|
||||
for(auto& seg : segments)
|
||||
{
|
||||
Point<2> p1 = { seg.epgeominfo[0].u, seg.epgeominfo[0].v };
|
||||
Point<2> p2 = { seg.epgeominfo[1].u, seg.epgeominfo[1].v };
|
||||
tol = min2(tol, Dist(p1, p2));
|
||||
}
|
||||
uv_tree.SetTolerance(0.9 * tol);
|
||||
Array<int> found_points;
|
||||
|
||||
for(auto & seg : segments)
|
||||
@ -368,15 +376,21 @@ namespace netgen
|
||||
Point<2> uv = {gi[j].u, gi[j].v};
|
||||
uv_tree.GetIntersecting(uv, uv, found_points);
|
||||
|
||||
if(found_points.Size())
|
||||
locpnum[j] = found_points[0];
|
||||
else
|
||||
bool found = false;
|
||||
for(auto& fp : found_points)
|
||||
{
|
||||
if(meshing.GetGlobalIndex(fp - 1) == seg[j])
|
||||
{
|
||||
locpnum[j] = fp;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
PointIndex pi = seg[j];
|
||||
meshing.AddPoint (mesh.Point(pi), pi);
|
||||
glob2loc[pi] = ++cntpt;
|
||||
locpnum[j] = meshing.AddPoint (mesh.Point(pi), pi) + 1;
|
||||
glob2loc[pi] = locpnum[j];
|
||||
gis.Append (gi[j]);
|
||||
locpnum[j] = gis.Size();
|
||||
uv_tree.Insert(uv, locpnum[j]);
|
||||
}
|
||||
}
|
||||
@ -391,11 +405,10 @@ namespace netgen
|
||||
auto gi = occface.Project(mesh[pi]);
|
||||
MultiPointGeomInfo mgi;
|
||||
mgi.AddPointGeomInfo(gi);
|
||||
meshing.AddPoint(mesh[pi], pi, &mgi);
|
||||
glob2loc[pi] = meshing.AddPoint(mesh[pi], pi, &mgi) + 1;
|
||||
gis.Append(gi);
|
||||
Point<2> uv = { gi.u, gi.v };
|
||||
uv_tree.Insert(uv, gis.Size());
|
||||
glob2loc[pi] = ++cntpt;
|
||||
uv_tree.Insert(uv, glob2loc[pi]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user