ARRAY<MeshPoint> & ps,
ARRAY<double> & params,
Mesh & mesh)
-@@ -49,23 +49,19 @@
+@@ -49,23 +49,18 @@
hvalue[0] = 0;
pnt = c->Value(s0);
{
oldpnt = pnt;
pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
-+ double dist = pnt.Distance(oldpnt);
- hvalue[i] = hvalue[i-1] +
- 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
+- hvalue[i] = hvalue[i-1] +
+- 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
- pnt.Distance(oldpnt);
-+ dist;
++ double dist = pnt.Distance(oldpnt);
++ hvalue[i] = hvalue[i-1] + min( 1.0,
++ 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*dist);
//(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
// << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
}
// nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
-@@ -74,13 +70,16 @@
+@@ -74,13 +69,16 @@
ps.SetSize(nsubedges-1);
params.SetSize(nsubedges+1);
{
- params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
+ // EAP. For nsubedges comparable to DIVIDEEDGESECTIONS (issue 0021073)
-+ double d1 = i1 - (hvalue[i1]-i)/(hvalue[i1]-hvalue[i1-1]);
++ double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
+ params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
+ //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
pnt = c->Value(params[i]);
ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
i++;
-@@ -112,7 +111,7 @@
+@@ -112,7 +110,7 @@
static void FindEdges (OCCGeometry & geom, Mesh & mesh)
{
multithread.task = "Edge meshing";
(*testout) << "edge meshing" << endl;
-@@ -124,6 +123,7 @@
+@@ -124,6 +122,7 @@
(*testout) << "nedges = " << nedges << endl;
double eps = 1e-6 * geom.GetBoundingBox().Diam();
for (int i = 1; i <= nvertices; i++)
{
-@@ -133,7 +133,7 @@
+@@ -133,7 +132,7 @@
bool exists = 0;
if (merge_solids)
for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
{
exists = 1;
break;
-@@ -163,6 +163,7 @@
+@@ -163,6 +162,7 @@
{
TopoDS_Face face = TopoDS::Face(exp1.Current());
int facenr = geom.fmap.FindIndex(face);
if (face2solid[0][facenr-1] == 0)
face2solid[0][facenr-1] = solidnr;
-@@ -184,6 +185,9 @@
+@@ -184,6 +184,9 @@
int facenr = 0;
int edgenr = 0;
(*testout) << "faces = " << geom.fmap.Extent() << endl;
int curr = 0;
-@@ -232,6 +236,11 @@
+@@ -232,6 +235,11 @@
continue;
}
if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
geom.vmap.FindIndex(TopExp::LastVertex (edge)))
{
-@@ -276,8 +285,8 @@
+@@ -276,8 +284,8 @@
pnums.Last() = -1;
for (PointIndex pi = 1; pi < first_ep; pi++)
{
}
}
-@@ -287,7 +296,7 @@
+@@ -287,7 +295,7 @@
bool exists = 0;
int j;
for (j = first_ep; j <= mesh.GetNP(); j++)
{
exists = 1;
break;
-@@ -394,7 +403,7 @@
+@@ -394,7 +402,7 @@
int i, j, k;
int changed;
multithread.task = "Surface meshing";
geom.facemeshstatus = 0;
-@@ -751,7 +760,7 @@
+@@ -751,7 +759,7 @@
multithread.task = savetask;
}
{
double hret;
kappa *= mparam.curvaturesafety;
-@@ -779,7 +788,7 @@
+@@ -779,7 +787,7 @@
double nq = n*q;
Point<3> p = p0 + 0.5*n;
if (lambda >= 0 && lambda <= 1)
{
-@@ -799,55 +808,55 @@
+@@ -799,55 +807,55 @@
//(*testout) << "curvature " << curvature << endl;
-@@ -886,51 +895,47 @@
+@@ -886,51 +894,47 @@
pm1.SetX(0.5*(par0.X()+par2.X())); pm1.SetY(0.5*(par0.Y()+par2.Y()));
pm2.SetX(0.5*(par1.X()+par0.X())); pm2.SetY(0.5*(par1.Y()+par0.Y()));
(*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
*/
}
-@@ -970,7 +975,7 @@
+@@ -970,7 +974,7 @@
if (mparam.uselocalh)
{
multithread.percent = 0;
mesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading);
-@@ -1075,7 +1080,6 @@
+@@ -1075,7 +1079,6 @@
if (triangulation.IsNull()) continue;
BRepAdaptor_Surface sf(face, Standard_True);
int ntriangles = triangulation -> NbTriangles();
for (int j = 1; j <= ntriangles; j++)
-@@ -1096,7 +1100,7 @@
+@@ -1096,7 +1099,7 @@
maxside = max (maxside, p[1].Distance(p[2]));
//cout << "\rFace " << i << " pos11 ntriangles " << ntriangles << " maxside " << maxside << flush;