mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +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())
|
: BoxTree(box.PMin(), box.PMax())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
void SetTolerance(double _tol) { tol = _tol; }
|
||||||
double GetTolerance() { return tol; }
|
double GetTolerance() { return tol; }
|
||||||
|
|
||||||
size_t GetNLeaves()
|
size_t GetNLeaves()
|
||||||
|
@ -79,12 +79,17 @@ namespace netgen
|
|||||||
Meshing2 :: ~Meshing2 ()
|
Meshing2 :: ~Meshing2 ()
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
void Meshing2 :: AddPoint (const Point3d & p, PointIndex globind,
|
int Meshing2 :: AddPoint (const Point3d & p, PointIndex globind,
|
||||||
MultiPointGeomInfo * mgi,
|
MultiPointGeomInfo * mgi,
|
||||||
bool pointonsurface)
|
bool pointonsurface)
|
||||||
{
|
{
|
||||||
//(*testout) << "add point " << globind << endl;
|
//(*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,
|
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);
|
bool pointonsurface = true);
|
||||||
|
DLL_HEADER PointIndex GetGlobalIndex(int pi) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
DLL_HEADER void AddBoundaryElement (INDEX i1, INDEX i2,
|
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 } );
|
uv_box.Add( {seg.epgeominfo[i].u, seg.epgeominfo[i].v } );
|
||||||
|
|
||||||
BoxTree<2> uv_tree(uv_box);
|
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;
|
Array<int> found_points;
|
||||||
|
|
||||||
for(auto & seg : segments)
|
for(auto & seg : segments)
|
||||||
@ -368,15 +376,21 @@ namespace netgen
|
|||||||
Point<2> uv = {gi[j].u, gi[j].v};
|
Point<2> uv = {gi[j].u, gi[j].v};
|
||||||
uv_tree.GetIntersecting(uv, uv, found_points);
|
uv_tree.GetIntersecting(uv, uv, found_points);
|
||||||
|
|
||||||
if(found_points.Size())
|
bool found = false;
|
||||||
locpnum[j] = found_points[0];
|
for(auto& fp : found_points)
|
||||||
else
|
{
|
||||||
|
if(meshing.GetGlobalIndex(fp - 1) == seg[j])
|
||||||
|
{
|
||||||
|
locpnum[j] = fp;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!found)
|
||||||
{
|
{
|
||||||
PointIndex pi = seg[j];
|
PointIndex pi = seg[j];
|
||||||
meshing.AddPoint (mesh.Point(pi), pi);
|
locpnum[j] = meshing.AddPoint (mesh.Point(pi), pi) + 1;
|
||||||
glob2loc[pi] = ++cntpt;
|
glob2loc[pi] = locpnum[j];
|
||||||
gis.Append (gi[j]);
|
gis.Append (gi[j]);
|
||||||
locpnum[j] = gis.Size();
|
|
||||||
uv_tree.Insert(uv, locpnum[j]);
|
uv_tree.Insert(uv, locpnum[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -391,11 +405,10 @@ namespace netgen
|
|||||||
auto gi = occface.Project(mesh[pi]);
|
auto gi = occface.Project(mesh[pi]);
|
||||||
MultiPointGeomInfo mgi;
|
MultiPointGeomInfo mgi;
|
||||||
mgi.AddPointGeomInfo(gi);
|
mgi.AddPointGeomInfo(gi);
|
||||||
meshing.AddPoint(mesh[pi], pi, &mgi);
|
glob2loc[pi] = meshing.AddPoint(mesh[pi], pi, &mgi) + 1;
|
||||||
gis.Append(gi);
|
gis.Append(gi);
|
||||||
Point<2> uv = { gi.u, gi.v };
|
Point<2> uv = { gi.u, gi.v };
|
||||||
uv_tree.Insert(uv, gis.Size());
|
uv_tree.Insert(uv, glob2loc[pi]);
|
||||||
glob2loc[pi] = ++cntpt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user