STLPointId ...

This commit is contained in:
Joachim Schöberl 2019-09-21 02:04:35 +02:00
parent 9b13bde72b
commit 5332762b96
7 changed files with 188 additions and 190 deletions

View File

@ -45,7 +45,7 @@ void STLMeshing (STLGeometry & geom,
*/ */
{ {
ref = NULL; ref = NULL;
edgedata = new STLEdgeDataList(*this); edgedata = make_unique<STLEdgeDataList>(*this);
externaledges.SetSize(0); externaledges.SetSize(0);
Clear(); Clear();
meshchart = 0; // initialize all ?? JS meshchart = 0; // initialize all ?? JS
@ -65,7 +65,7 @@ void STLMeshing (STLGeometry & geom,
STLGeometry :: ~STLGeometry() STLGeometry :: ~STLGeometry()
{ {
// for (auto p : atlas) delete p; // for (auto p : atlas) delete p;
delete edgedata; // delete edgedata;
delete ref; delete ref;
} }
@ -153,7 +153,7 @@ void STLGeometry :: MarkNonSmoothNormals(const STLParameters& stlparam)
double dirtyangle = stlparam.yangle/180.*M_PI; double dirtyangle = stlparam.yangle/180.*M_PI;
int cnt = 0; int cnt = 0;
int lp1,lp2; STLPointId lp1,lp2;
for (i = 1; i <= GetNT(); i++) for (i = 1; i <= GetNT(); i++)
{ {
for (j = 1; j <= NONeighbourTrigs(i); j++) for (j = 1; j <= NONeighbourTrigs(i); j++)
@ -243,7 +243,7 @@ void STLGeometry :: SmoothNormals(const STLParameters& stlparam)
int nbt = 0; int nbt = 0;
int fp1,fp2; STLPointId fp1,fp2;
for (k = 1; k <= NONeighbourTrigs(i); k++) for (k = 1; k <= NONeighbourTrigs(i); k++)
{ {
trig.GetNeighbourPoints(GetTriangle(NeighbourTrig(i, k)),fp1,fp2); trig.GetNeighbourPoints(GetTriangle(NeighbourTrig(i, k)),fp1,fp2);
@ -1803,7 +1803,7 @@ double STLGeometry :: CalcTrigBadness(int i)
{ {
int j; int j;
double maxbadness = 0; double maxbadness = 0;
int ap1, ap2; STLPointId ap1, ap2;
for (j = 1; j <= NONeighbourTrigs(i); j++) for (j = 1; j <= NONeighbourTrigs(i); j++)
{ {
GetTriangle(i).GetNeighbourPoints(GetTriangle(NeighbourTrig(i,j)), ap1, ap2); GetTriangle(i).GetNeighbourPoints(GetTriangle(NeighbourTrig(i,j)), ap1, ap2);
@ -1880,7 +1880,7 @@ void STLGeometry :: MarkRevertedTrigs(const STLParameters& stlparam)
double revertedangle = stldoctor.smoothangle/180.*M_PI; double revertedangle = stldoctor.smoothangle/180.*M_PI;
int cnt = 0; int cnt = 0;
int ap1, ap2; STLPointId ap1, ap2;
for (i = 1; i <= GetNT(); i++) for (i = 1; i <= GetNT(); i++)
{ {
found = 0; found = 0;
@ -1918,7 +1918,7 @@ void STLGeometry :: SmoothDirtyTrigs(const STLParameters& stlparam)
int i,j; int i,j;
int changed = 1; int changed = 1;
int ap1, ap2; STLPointId ap1, ap2;
while (changed) while (changed)
{ {
@ -2148,59 +2148,59 @@ int STLGeometry :: CheckGeometryOverlapping()
mutex inters_mutex; mutex inters_mutex;
ParallelFor( 1, GetNT()+1, [&] (int first, int next) ParallelFor( 1, GetNT()+1, [&] (int first, int next)
{ {
NgArray<int> inters; NgArray<int> inters;
for (int i=first; i<next; i++) { for (int i=first; i<next; i++) {
const STLTriangle & tri = GetTriangle(i); const STLTriangle & tri = GetTriangle(i);
Point<3> tpmin = tri.box.PMin(); Point<3> tpmin = tri.box.PMin();
Point<3> tpmax = tri.box.PMax(); Point<3> tpmax = tri.box.PMax();
setree.GetIntersecting (tpmin, tpmax, inters); setree.GetIntersecting (tpmin, tpmax, inters);
for (int j = 1; j <= inters.Size(); j++) for (int j = 1; j <= inters.Size(); j++)
{ {
const STLTriangle & tri2 = GetTriangle(inters.Get(j)); const STLTriangle & tri2 = GetTriangle(inters.Get(j));
const Point<3> *trip1[3], *trip2[3]; const Point<3> *trip1[3], *trip2[3];
Point<3> hptri1[3], hptri2[3]; Point<3> hptri1[3], hptri2[3];
/* /*
for (k = 1; k <= 3; k++) for (k = 1; k <= 3; k++)
{ {
trip1[k-1] = &GetPoint (tri.PNum(k)); trip1[k-1] = &GetPoint (tri.PNum(k));
trip2[k-1] = &GetPoint (tri2.PNum(k)); trip2[k-1] = &GetPoint (tri2.PNum(k));
} }
*/ */
for (int k = 0; k < 3; k++) for (int k = 0; k < 3; k++)
{ {
hptri1[k] = GetPoint (tri[k]); hptri1[k] = GetPoint (tri[k]);
hptri2[k] = GetPoint (tri2[k]); hptri2[k] = GetPoint (tri2[k]);
trip1[k] = &hptri1[k]; trip1[k] = &hptri1[k];
trip2[k] = &hptri2[k]; trip2[k] = &hptri2[k];
} }
if (IntersectTriangleTriangle (&trip1[0], &trip2[0])) if (IntersectTriangleTriangle (&trip1[0], &trip2[0]))
{ {
lock_guard<mutex> guard(inters_mutex); lock_guard<mutex> guard(inters_mutex);
{ {
oltrigs++; oltrigs++;
PrintMessage(5,"Intersecting Triangles: trig ",i," with ",inters.Get(j),"!"); PrintMessage(5,"Intersecting Triangles: trig ",i," with ",inters.Get(j),"!");
SetMarkedTrig(i, 1); SetMarkedTrig(i, 1);
SetMarkedTrig(inters.Get(j), 1); SetMarkedTrig(inters.Get(j), 1);
} }
} }
} }
} }
}); });
} }
PrintMessage(3,"Check overlapping geometry ... ", oltrigs, " triangles overlap"); PrintMessage(3,"Check overlapping geometry ... ", oltrigs, " triangles overlap");
return oltrigs; return oltrigs;
} }
/* /*
void STLGeometry :: InitSTLGeometry() void STLGeometry :: InitSTLGeometry()
{ {
STLTopology::InitSTLGeometry(); STLTopology::InitSTLGeometry();
int i, j, k; int i, j, k;
@ -2215,88 +2215,88 @@ void STLGeometry :: InitSTLGeometry()
NgArray<int> normal_cnt; // counts number of added normals in a point NgArray<int> normal_cnt; // counts number of added normals in a point
Box3d bb (GetBoundingBox().PMin() + Vec3d (-1,-1,-1), Box3d bb (GetBoundingBox().PMin() + Vec3d (-1,-1,-1),
GetBoundingBox().PMax() + Vec3d (1, 1, 1)); GetBoundingBox().PMax() + Vec3d (1, 1, 1));
Point3dTree pointtree (bb.PMin(), Point3dTree pointtree (bb.PMin(),
bb.PMax()); bb.PMax());
NgArray<int> pintersect; NgArray<int> pintersect;
double gtol = GetBoundingBox().CalcDiam()/geometry_tol_fact; double gtol = GetBoundingBox().CalcDiam()/geometry_tol_fact;
for(i = 1; i <= GetReadNT(); i++) for(i = 1; i <= GetReadNT(); i++)
{ {
//if (i%500==499) {(*mycout) << (double)i/(double)GetReadNT()*100. << "%" << endl;} //if (i%500==499) {(*mycout) << (double)i/(double)GetReadNT()*100. << "%" << endl;}
STLReadTriangle t = GetReadTriangle(i); STLReadTriangle t = GetReadTriangle(i);
STLTriangle st; STLTriangle st;
Vec3d n = t.normal; Vec3d n = t.normal;
for (k = 0; k < 3; k++) for (k = 0; k < 3; k++)
{ {
Point3d p = t.pts[k]; Point3d p = t.pts[k];
Point3d pmin = p - Vec3d (gtol, gtol, gtol); Point3d pmin = p - Vec3d (gtol, gtol, gtol);
Point3d pmax = p + Vec3d (gtol, gtol, gtol); Point3d pmax = p + Vec3d (gtol, gtol, gtol);
pointtree.GetIntersecting (pmin, pmax, pintersect); pointtree.GetIntersecting (pmin, pmax, pintersect);
if (pintersect.Size() > 1) if (pintersect.Size() > 1)
(*mycout) << "found too much " << char(7) << endl; (*mycout) << "found too much " << char(7) << endl;
int foundpos = 0; int foundpos = 0;
if (pintersect.Size()) if (pintersect.Size())
foundpos = pintersect.Get(1); foundpos = pintersect.Get(1);
if (foundpos) if (foundpos)
{ {
normal_cnt[foundpos]++; normal_cnt[foundpos]++;
SetNormal(foundpos,GetNormal(foundpos)+n); SetNormal(foundpos,GetNormal(foundpos)+n);
// (*testout) << "found p " << p << endl; // (*testout) << "found p " << p << endl;
} }
else else
{ {
foundpos = AddPoint(p); foundpos = AddPoint(p);
AddNormal(n); AddNormal(n);
normal_cnt.Append(1); normal_cnt.Append(1);
pointtree.Insert (p, foundpos); pointtree.Insert (p, foundpos);
} }
//(*mycout) << "foundpos=" << foundpos << endl; //(*mycout) << "foundpos=" << foundpos << endl;
st.pts[k] = foundpos; st.pts[k] = foundpos;
} }
if ( (st.pts[0] == st.pts[1]) || if ( (st.pts[0] == st.pts[1]) ||
(st.pts[0] == st.pts[2]) || (st.pts[0] == st.pts[2]) ||
(st.pts[1] == st.pts[2]) ) (st.pts[1] == st.pts[2]) )
{ {
(*mycout) << "ERROR: STL Triangle degenerated" << endl; (*mycout) << "ERROR: STL Triangle degenerated" << endl;
} }
else else
{ {
// do not add ? js // do not add ? js
AddTriangle(st); AddTriangle(st);
} }
//(*mycout) << "TRIG" << i << " = " << st << endl; //(*mycout) << "TRIG" << i << " = " << st << endl;
} }
//normal the normals //normal the normals
for (i = 1; i <= GetNP(); i++) for (i = 1; i <= GetNP(); i++)
{ {
SetNormal(i,1./(double)normal_cnt[i]*GetNormal(i)); SetNormal(i,1./(double)normal_cnt[i]*GetNormal(i));
} }
trigsconverted = 1; trigsconverted = 1;
vicinity.SetSize(GetNT()); vicinity.SetSize(GetNT());
markedtrigs.SetSize(GetNT()); markedtrigs.SetSize(GetNT());
for (i = 1; i <= GetNT(); i++) for (i = 1; i <= GetNT(); i++)
{ {
markedtrigs.Elem(i) = 0; markedtrigs.Elem(i) = 0;
vicinity.Elem(i) = 1; vicinity.Elem(i) = 1;
} }
ha_points.SetSize(GetNP()); ha_points.SetSize(GetNP());
for (i = 1; i <= GetNP(); i++) for (i = 1; i <= GetNP(); i++)
ha_points.Elem(i) = 0; ha_points.Elem(i) = 0;
calcedgedataanglesnew = 0; calcedgedataanglesnew = 0;
edgedatastored = 0; edgedatastored = 0;
@ -2308,7 +2308,7 @@ void STLGeometry :: InitSTLGeometry()
ClearLineEndPoints(); ClearLineEndPoints();
(*mycout) << "done" << endl; (*mycout) << "done" << endl;
} }
*/ */
@ -2401,13 +2401,13 @@ void STLGeometry :: StoreEdgeData()
// put stlgeom-edgedata to stltopology edgedata // put stlgeom-edgedata to stltopology edgedata
/* /*
int i; int i;
for (i = 1; i <= GetNTE(); i++) for (i = 1; i <= GetNTE(); i++)
{ {
const STLTopEdge & topedge = GetTopEdge (i); const STLTopEdge & topedge = GetTopEdge (i);
int ednum = edgedata->GetEdgeNum (topedge.PNum(1), int ednum = edgedata->GetEdgeNum (topedge.PNum(1),
topedge.PNum(2)); topedge.PNum(2));
topedges.Elem(i).SetStatus (edgedata->Get (ednum).status); topedges.Elem(i).SetStatus (edgedata->Get (ednum).status);
} }
*/ */
} }
@ -2424,7 +2424,7 @@ void STLGeometry :: CalcEdgeData()
{ {
PushStatus("Calc Edge Data"); PushStatus("Calc Edge Data");
int np1, np2; STLPointId np1, np2;
int ecnt = 0; int ecnt = 0;
edgedata->SetSize(GetNT()/2*3); edgedata->SetSize(GetNT()/2*3);
@ -2678,7 +2678,7 @@ void STLGeometry :: AddFaceEdges()
} }
int changed = 0; int changed = 0;
int ap1, ap2; STLPointId ap1, ap2;
for (int i = 1; i <= GetNOFaces(); i++) for (int i = 1; i <= GetNOFaces(); i++)
{ {
if (!edgecnt.Get(i)) if (!edgecnt.Get(i))
@ -3008,7 +3008,7 @@ void STLGeometry :: CalcFaceNums()
markedtrigs1++; markedtrigs1++;
GetTriangle(starttrig).SetFaceNum(facecnt); GetTriangle(starttrig).SetFaceNum(facecnt);
todolist.Append(starttrig); todolist.Append(starttrig);
int ap1, ap2; STLPointId ap1, ap2;
while(todolist.Size()) while(todolist.Size())
{ {
@ -3089,7 +3089,7 @@ void STLGeometry :: BuildSmoothEdges ()
ng2 = GetTriangle(nbt).GeomNormal(points); ng2 = GetTriangle(nbt).GeomNormal(points);
ng2 /= (ng2.Length() + 1e-24); ng2 /= (ng2.Length() + 1e-24);
int pi1, pi2; STLPointId pi1, pi2;
trig.GetNeighbourPoints(GetTriangle(nbt), pi1, pi2); trig.GetNeighbourPoints(GetTriangle(nbt), pi1, pi2);
if (!IsEdge(pi1,pi2)) if (!IsEdge(pi1,pi2))
@ -3141,24 +3141,24 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
PrintFnStart("AddConeAndSpiralEdges"); PrintFnStart("AddConeAndSpiralEdges");
int i,j,k,n; // int i,j,k,n;
// int changed = 0; // int changed = 0;
//check edges, where inner chart and no outer chart come together without an edge //check edges, where inner chart and no outer chart come together without an edge
int np1, np2, nt; STLPointId np1, np2;
int cnt = 0; int cnt = 0;
for (i = 1; i <= GetNOCharts(); i++) for (ChartId i = 1; i <= GetNOCharts(); i++)
{ {
STLChart& chart = GetChart(i); STLChart& chart = GetChart(i);
for (j = 1; j <= chart.GetNChartT(); j++) for (int j = 1; j <= chart.GetNChartT(); j++)
{ {
STLTrigId t = chart.GetChartTrig1(j); STLTrigId t = chart.GetChartTrig1(j);
const STLTriangle& tt = GetTriangle(t); const STLTriangle& tt = GetTriangle(t);
for (k = 1; k <= 3; k++) for (int k = 1; k <= 3; k++)
{ {
nt = NeighbourTrig(t,k); STLTrigId nt = NeighbourTrig(t,k);
if (GetChartNr(nt) != i && !TrigIsInOC(nt,i)) if (GetChartNr(nt) != i && !TrigIsInOC(nt,i))
{ {
tt.GetNeighbourPoints(GetTriangle(nt),np1,np2); tt.GetNeighbourPoints(GetTriangle(nt),np1,np2);
@ -3171,8 +3171,8 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
AddEdgePP(np1,edgenum); AddEdgePP(np1,edgenum);
AddEdgePP(np2,edgenum); AddEdgePP(np2,edgenum);
//changed = 1; //changed = 1;
PrintWarning("Found a spiral like structure: chart=", i, PrintWarning("Found a spiral like structure: chart=", int(i),
", trig=", int(t), ", p1=", np1, ", p2=", np2); ", trig=", int(t), ", p1=", int(np1), ", p2=", int(np2));
cnt++; cnt++;
} }
} }
@ -3187,17 +3187,14 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
cnt = 0; cnt = 0;
int edgecnt = 0; int edgecnt = 0;
NgArray<int> trigsaroundp; Array<STLTrigId> trigsaroundp;
NgArray<int> chartpointchecked; //gets number of chart, if in this chart already checked NgArray<int> chartpointchecked(GetNP()); //gets number of chart, if in this chart already checked
chartpointchecked.SetSize(GetNP()); chartpointchecked = 0;
for (i = 1; i <= GetNP(); i++)
{
chartpointchecked.Elem(i) = 0;
}
int onoc, notonoc, tpp, pn; int onoc, notonoc, tpp, pn;
int ap1, ap2, tn1, tn2, l, problem; STLPointId ap1, ap2;
int tn1, tn2, l, problem;
if (!stldoctor.conecheck) {PrintWarning("++++++++++++ \ncone checking deactivated by user!!!!!\n+++++++++++++++"); return ;} if (!stldoctor.conecheck) {PrintWarning("++++++++++++ \ncone checking deactivated by user!!!!!\n+++++++++++++++"); return ;}
@ -3205,26 +3202,26 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
int addedges = 0; int addedges = 0;
for (i = 1; i <= GetNOCharts(); i++) for (ChartId i = 1; i <= GetNOCharts(); i++)
{ {
SetThreadPercent((double)i/(double)GetNOCharts()*100.); SetThreadPercent((double)i/(double)GetNOCharts()*100.);
if (multithread.terminate) if (multithread.terminate)
{PopStatus();return;} {PopStatus();return;}
STLChart& chart = GetChart(i); STLChart& chart = GetChart(i);
for (j = 1; j <= chart.GetNChartT(); j++) for (int j = 1; j <= chart.GetNChartT(); j++)
{ {
STLTrigId t = chart.GetChartTrig1(j); STLTrigId t = chart.GetChartTrig1(j);
const STLTriangle& tt = GetTriangle(t); const STLTriangle& tt = GetTriangle(t);
for (k = 1; k <= 3; k++) for (int k = 1; k <= 3; k++)
{ {
pn = tt.PNum(k); pn = tt.PNum(k);
if (chartpointchecked.Get(pn) == i) if (chartpointchecked.Get(pn) == i)
{continue;} {continue;}
int checkpoint = 0; int checkpoint = 0;
for (n = 1; n <= trigsperpoint.EntrySize(pn); n++) for (int n = 1; n <= trigsperpoint.EntrySize(pn); n++)
{ {
if (trigsperpoint.Get(pn,n) != t && if (trigsperpoint.Get(pn,n) != t &&
GetChartNr(trigsperpoint.Get(pn,n)) != i && GetChartNr(trigsperpoint.Get(pn,n)) != i &&
@ -3240,10 +3237,10 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
trigsaroundp.Append(t); trigsaroundp.Append(t);
problem = 0; problem = 0;
for (l = 2; l <= trigsaroundp.Size()-1; l++) for (int l = 2; l <= trigsaroundp.Size()-1; l++)
{ {
tn1 = trigsaroundp.Get(l-1); tn1 = trigsaroundp[l-2];
tn2 = trigsaroundp.Get(l); tn2 = trigsaroundp[l-1];
const STLTriangle& t1 = GetTriangle(tn1); const STLTriangle& t1 = GetTriangle(tn1);
const STLTriangle& t2 = GetTriangle(tn2); const STLTriangle& t2 = GetTriangle(tn2);
t1.GetNeighbourPoints(t2, ap1, ap2); t1.GetNeighbourPoints(t2, ap1, ap2);
@ -3254,10 +3251,10 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
if (problem) if (problem)
{ {
for (l = 2; l <= trigsaroundp.Size()-1; l++) for (int l = 2; l <= trigsaroundp.Size()-1; l++)
{ {
tn1 = trigsaroundp.Get(l-1); tn1 = trigsaroundp[l-2];
tn2 = trigsaroundp.Get(l); tn2 = trigsaroundp[l-1];
const STLTriangle& t1 = GetTriangle(tn1); const STLTriangle& t1 = GetTriangle(tn1);
const STLTriangle& t2 = GetTriangle(tn2); const STLTriangle& t2 = GetTriangle(tn2);
t1.GetNeighbourPoints(t2, ap1, ap2); t1.GetNeighbourPoints(t2, ap1, ap2);
@ -3287,10 +3284,10 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
} }
//backwards: //backwards:
problem = 0; problem = 0;
for (l = trigsaroundp.Size()-1; l >= 2; l--) for (int l = trigsaroundp.Size()-1; l >= 2; l--)
{ {
tn1 = trigsaroundp.Get(l+1); tn1 = trigsaroundp[l];
tn2 = trigsaroundp.Get(l); tn2 = trigsaroundp[l-1];
const STLTriangle& t1 = GetTriangle(tn1); const STLTriangle& t1 = GetTriangle(tn1);
const STLTriangle& t2 = GetTriangle(tn2); const STLTriangle& t2 = GetTriangle(tn2);
t1.GetNeighbourPoints(t2, ap1, ap2); t1.GetNeighbourPoints(t2, ap1, ap2);
@ -3299,10 +3296,10 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
if (GetChartNr(tn2) != i && !TrigIsInOC(tn2,i)) {problem = 1;} if (GetChartNr(tn2) != i && !TrigIsInOC(tn2,i)) {problem = 1;}
} }
if (problem) if (problem)
for (l = trigsaroundp.Size()-1; l >= 2; l--) for (int l = trigsaroundp.Size()-1; l >= 2; l--)
{ {
tn1 = trigsaroundp.Get(l+1); tn1 = trigsaroundp[l];
tn2 = trigsaroundp.Get(l); tn2 = trigsaroundp[l-1];
const STLTriangle& t1 = GetTriangle(tn1); const STLTriangle& t1 = GetTriangle(tn1);
const STLTriangle& t2 = GetTriangle(tn2); const STLTriangle& t2 = GetTriangle(tn2);
t1.GetNeighbourPoints(t2, ap1, ap2); t1.GetNeighbourPoints(t2, ap1, ap2);
@ -3358,22 +3355,22 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
//search points where inner chart and outer chart and "no chart" trig come together at edge-point //search points where inner chart and outer chart and "no chart" trig come together at edge-point
PrintMessage(7,"search for special chart points"); PrintMessage(7,"search for special chart points");
for (i = 1; i <= GetNOCharts(); i++) for (ChartId i = 1; i <= GetNOCharts(); i++)
{ {
STLChart& chart = GetChart(i); STLChart& chart = GetChart(i);
for (j = 1; j <= chart.GetNChartT(); j++) for (int j = 1; j <= chart.GetNChartT(); j++)
{ {
STLTrigId t = chart.GetChartTrig1(j); STLTrigId t = chart.GetChartTrig1(j);
const STLTriangle& tt = GetTriangle(t); const STLTriangle& tt = GetTriangle(t);
for (k = 1; k <= 3; k++) for (int k = 1; k <= 3; k++)
{ {
pn = tt.PNum(k); pn = tt.PNum(k);
if (GetNEPP(pn) == 2) if (GetNEPP(pn) == 2)
{ {
onoc = 0; onoc = 0;
notonoc = 0; notonoc = 0;
for (n = 1; n <= trigsperpoint.EntrySize(pn); n++) for (int n = 1; n <= trigsperpoint.EntrySize(pn); n++)
{ {
tpp = trigsperpoint.Get(pn,n); tpp = trigsperpoint.Get(pn,n);
if (tpp != t && GetChartNr(tpp) != i) if (tpp != t && GetChartNr(tpp) != i)
@ -3390,11 +3387,11 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
int thereNotOC = 0; int thereNotOC = 0;
for (l = 2; l <= trigsaroundp.Size(); l++) for (l = 2; l <= trigsaroundp.Size(); l++)
{ {
GetTriangle(trigsaroundp.Get(l-1)). GetTriangle(trigsaroundp[l-2]).
GetNeighbourPoints(GetTriangle(trigsaroundp.Get(l)), ap1, ap2); GetNeighbourPoints(GetTriangle(trigsaroundp[l-1]), ap1, ap2);
if (IsEdge(ap1,ap2)) {here = (here+1)%2;} if (IsEdge(ap1,ap2)) {here = (here+1)%2;}
if (!here && TrigIsInOC(trigsaroundp.Get(l),i)) {thereOC = 1;} if (!here && TrigIsInOC(trigsaroundp[l-1],i)) {thereOC = 1;}
if (!here && !TrigIsInOC(trigsaroundp.Get(l),i)) {thereNotOC = 1;} if (!here && !TrigIsInOC(trigsaroundp[l-1],i)) {thereNotOC = 1;}
} }
if (thereOC && thereNotOC) if (thereOC && thereNotOC)
{ {
@ -3411,31 +3408,31 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
} }
//get trigs at a point, started with starttrig, then every left //get trigs at a point, started with starttrig, then every left
void STLGeometry :: GetSortedTrianglesAroundPoint(int p, int starttrig, NgArray<int>& trigs) void STLGeometry :: GetSortedTrianglesAroundPoint(STLPointId p, STLTrigId starttrig, Array<STLTrigId>& trigs)
{ {
int acttrig = starttrig; STLTrigId acttrig = starttrig;
trigs.SetAllocSize(trigsperpoint.EntrySize(p)); trigs.SetAllocSize(trigsperpoint.EntrySize(p));
trigs.SetSize(0); trigs.SetSize(0);
trigs.Append(acttrig); trigs.Append(acttrig);
int i, j, t, ap1, ap2, locindex1(0), locindex2(0); int locindex1(0), locindex2(0);
//(*mycout) << "trigs around point " << p << endl; //(*mycout) << "trigs around point " << p << endl;
int end = 0; int end = 0;
while (!end) while (!end)
{ {
const STLTriangle& at = GetTriangle(acttrig); const STLTriangle& at = GetTriangle(acttrig);
for (i = 1; i <= trigsperpoint.EntrySize(p); i++) for (int i = 1; i <= trigsperpoint.EntrySize(p); i++)
{ {
t = trigsperpoint.Get(p,i); STLTrigId t = trigsperpoint.Get(p,i);
const STLTriangle& nt = GetTriangle(t); const STLTriangle& nt = GetTriangle(t);
if (at.IsNeighbourFrom(nt)) if (at.IsNeighbourFrom(nt))
{ {
STLPointId ap1, ap2;
at.GetNeighbourPoints(nt, ap1, ap2); at.GetNeighbourPoints(nt, ap1, ap2);
if (ap2 == p) {Swap(ap1,ap2);} if (ap2 == p) {Swap(ap1,ap2);}
if (ap1 != p) {PrintSysError("In GetSortedTrianglesAroundPoint!!!");} if (ap1 != p) {PrintSysError("In GetSortedTrianglesAroundPoint!!!");}
for (j = 1; j <= 3; j++) for (int j = 1; j <= 3; j++)
{ {
if (at.PNum(j) == ap1) {locindex1 = j;}; if (at.PNum(j) == ap1) {locindex1 = j;};
if (at.PNum(j) == ap2) {locindex2 = j;}; if (at.PNum(j) == ap2) {locindex2 = j;};

View File

@ -119,7 +119,7 @@ namespace netgen
int undoexternaledges; int undoexternaledges;
NgArray<twoint> storedexternaledges; NgArray<twoint> storedexternaledges;
STLEdgeDataList * edgedata; unique_ptr<STLEdgeDataList> edgedata;
// STLEdgeDataList edgedata_store; // STLEdgeDataList edgedata_store;
int calcedgedataanglesnew; int calcedgedataanglesnew;
@ -375,7 +375,7 @@ namespace netgen
void SetSpiralPoint(int pn) {spiralpoints.Elem(pn) = 1;}; void SetSpiralPoint(int pn) {spiralpoints.Elem(pn) = 1;};
int GetSpiralPoint(int pn) const {return spiralpoints.Get(pn);}; int GetSpiralPoint(int pn) const {return spiralpoints.Get(pn);};
void GetSortedTrianglesAroundPoint(int p, int starttrig, NgArray<int>& trigs); void GetSortedTrianglesAroundPoint(STLPointId p, STLTrigId starttrig, Array<STLTrigId>& trigs);
// smooth edges: sharp geometric edges not declared as edges // smooth edges: sharp geometric edges not declared as edges
void BuildSmoothEdges (); void BuildSmoothEdges ();

View File

@ -199,7 +199,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
{ {
int nt = NeighbourTrig(i,j); int nt = NeighbourTrig(i,j);
// *testout << "check trig " << nt << endl; // *testout << "check trig " << nt << endl;
int np1, np2; STLPointId np1, np2;
GetTriangle(i).GetNeighbourPoints(GetTriangle(nt),np1,np2); GetTriangle(i).GetNeighbourPoints(GetTriangle(nt),np1,np2);
if (GetMarker(nt) == 0 && !IsEdge(np1,np2)) if (GetMarker(nt) == 0 && !IsEdge(np1,np2))
{ {
@ -242,7 +242,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
int nnt = NeighbourTrig(nt,k); int nnt = NeighbourTrig(nt,k);
if (GetMarker(nnt) != chartnum) if (GetMarker(nnt) != chartnum)
{ {
int nnp1, nnp2; STLPointId nnp1, nnp2;
GetTriangle(nt).GetNeighbourPoints(GetTriangle(nnt),nnp1,nnp2); GetTriangle(nt).GetNeighbourPoints(GetTriangle(nnt),nnp1,nnp2);
accepted = chartbound.TestSeg(GetPoint(nnp1), accepted = chartbound.TestSeg(GetPoint(nnp1),
@ -326,7 +326,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
if (outermark[nt] == chartnum) continue; if (outermark[nt] == chartnum) continue;
const STLTriangle & ntrig = GetTriangle(nt); const STLTriangle & ntrig = GetTriangle(nt);
int np1, np2; STLPointId np1, np2;
GetTriangle(i).GetNeighbourPoints(GetTriangle(nt),np1,np2); GetTriangle(i).GetNeighbourPoints(GetTriangle(nt),np1,np2);
if (IsEdge (np1, np2)) continue; if (IsEdge (np1, np2)) continue;
@ -368,7 +368,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
if (outermark[nnt] != chartnum) if (outermark[nnt] != chartnum)
{ {
// NgProfiler::StartTimer (timer4c); // NgProfiler::StartTimer (timer4c);
int nnp1, nnp2; STLPointId nnp1, nnp2;
GetTriangle(nt).GetNeighbourPoints(GetTriangle(nnt),nnp1,nnp2); GetTriangle(nt).GetNeighbourPoints(GetTriangle(nnt),nnp1,nnp2);
// NgProfiler::StopTimer (timer4c); // NgProfiler::StopTimer (timer4c);
@ -654,7 +654,7 @@ int AddIfNotExists(NgArray<int>& list, int x)
void STLGeometry :: GetInnerChartLimes(NgArray<twoint>& limes, ChartId chartnum) void STLGeometry :: GetInnerChartLimes(NgArray<twoint>& limes, ChartId chartnum)
{ {
int np1, np2; STLPointId np1, np2;
limes.SetSize(0); limes.SetSize(0);
@ -730,7 +730,7 @@ void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
STLTrigId nt = NeighbourTrig(t,k); STLTrigId nt = NeighbourTrig(t,k);
if (GetChartNr(nt) != chartnum && outercharttrigs[nt] != chartnum) if (GetChartNr(nt) != chartnum && outercharttrigs[nt] != chartnum)
{ {
int np1, np2; STLPointId np1, np2;
tt.GetNeighbourPoints(GetTriangle(nt),np1,np2); tt.GetNeighbourPoints(GetTriangle(nt),np1,np2);
if (!IsEdge(np1,np2)) if (!IsEdge(np1,np2))
{ {
@ -743,8 +743,8 @@ void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
} }
cnt = 0; cnt = 0;
int ap1, ap2, tn1, tn2, l, problem, pn; STLPointId ap1, ap2, pn;
NgArray<int> trigsaroundp; Array<STLTrigId> trigsaroundp;
for (int j = chart.GetNChartT(); j >= 1; j--) for (int j = chart.GetNChartT(); j >= 1; j--)
{ {
@ -771,31 +771,31 @@ void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
GetSortedTrianglesAroundPoint(pn,t,trigsaroundp); GetSortedTrianglesAroundPoint(pn,t,trigsaroundp);
trigsaroundp.Append(t); //ring trigsaroundp.Append(t); //ring
problem = 0; bool problem = false;
//forward: //forward:
for (l = 2; l <= trigsaroundp.Size()-1; l++) for (int l = 2; l <= trigsaroundp.Size()-1; l++)
{ {
tn1 = trigsaroundp.Get(l-1); STLTrigId tn1 = trigsaroundp[l-2];
tn2 = trigsaroundp.Get(l); STLTrigId tn2 = trigsaroundp[l-1];
const STLTriangle& t1 = GetTriangle(tn1); const STLTriangle& t1 = GetTriangle(tn1);
const STLTriangle& t2 = GetTriangle(tn2); const STLTriangle& t2 = GetTriangle(tn2);
t1.GetNeighbourPoints(t2, ap1, ap2); t1.GetNeighbourPoints(t2, ap1, ap2);
if (IsEdge(ap1,ap2)) break; if (IsEdge(ap1,ap2)) break;
if (GetChartNr(tn2) != chartnum && outercharttrigs[tn2] != chartnum) {problem = 1;} if (GetChartNr(tn2) != chartnum && outercharttrigs[tn2] != chartnum) {problem = true;}
} }
//backwards: //backwards:
for (l = trigsaroundp.Size()-1; l >= 2; l--) for (int l = trigsaroundp.Size()-1; l >= 2; l--)
{ {
tn1 = trigsaroundp.Get(l+1); STLTrigId tn1 = trigsaroundp[l];
tn2 = trigsaroundp.Get(l); STLTrigId tn2 = trigsaroundp[l-1];
const STLTriangle& t1 = GetTriangle(tn1); const STLTriangle& t1 = GetTriangle(tn1);
const STLTriangle& t2 = GetTriangle(tn2); const STLTriangle& t2 = GetTriangle(tn2);
t1.GetNeighbourPoints(t2, ap1, ap2); t1.GetNeighbourPoints(t2, ap1, ap2);
if (IsEdge(ap1,ap2)) break; if (IsEdge(ap1,ap2)) break;
if (GetChartNr(tn2) != chartnum && outercharttrigs[tn2] != chartnum) {problem = 1;} if (GetChartNr(tn2) != chartnum && outercharttrigs[tn2] != chartnum) {problem = true;}
} }
// if (problem && !IsInArray(j,dirtytrigs)) // if (problem && !IsInArray(j,dirtytrigs))
if (problem && !dirtytrigs.Contains(j)) if (problem && !dirtytrigs.Contains(j))

View File

@ -713,7 +713,7 @@ void STLGeometry :: RestrictLocalHCurv(class Mesh & mesh, double gh, const STLPa
//die Meshsize auf ein bestimmtes Mass limitieren //die Meshsize auf ein bestimmtes Mass limitieren
int i,j; int i,j;
int ap1,ap2,p3,p4; STLPointId ap1,ap2,p3,p4;
Point<3> p1p, p2p, p3p, p4p; Point<3> p1p, p2p, p3p, p4p;
Vec<3> n, ntn; Vec<3> n, ntn;
double rzyl, localh; double rzyl, localh;
@ -817,7 +817,7 @@ void STLGeometry :: RestrictLocalH(class Mesh & mesh, double gh, const STLParame
//die Meshsize auf ein bestimmtes Mass limitieren //die Meshsize auf ein bestimmtes Mass limitieren
int i,j; int i,j;
int ap1,ap2,p3,p4; STLPointId ap1,ap2,p3,p4;
Point3d p1p, p2p, p3p, p4p; Point3d p1p, p2p, p3p, p4p;
Vec3d n, ntn; Vec3d n, ntn;
double rzyl, localh; double rzyl, localh;
@ -1145,7 +1145,7 @@ void STLGeometry :: RestrictHChartDistOneChart(ChartId chartnum, NgArray<int>& a
int divisions = 10; int divisions = 10;
int np1, np2; STLPointId np1, np2;
// Point3d p3p1, p3p2; // Point3d p3p1, p3p2;
STLTriangle tt; STLTriangle tt;

View File

@ -318,7 +318,7 @@ int STLTriangle :: IsWrongNeighbourFrom(const STLTriangle& t) const
return 0; return 0;
} }
void STLTriangle :: GetNeighbourPoints(const STLTriangle& t, int& p1, int& p2) const void STLTriangle :: GetNeighbourPoints(const STLTriangle& t, STLPointId & p1, STLPointId & p2) const
{ {
for(int i = 1; i <= 3; i++) for(int i = 1; i <= 3; i++)
for(int j = 1; j <= 3; j++) for(int j = 1; j <= 3; j++)
@ -333,7 +333,8 @@ void STLTriangle :: GetNeighbourPoints(const STLTriangle& t, int& p1, int& p2) c
PrintSysError("Get neighbourpoints failed!"); PrintSysError("Get neighbourpoints failed!");
} }
int STLTriangle :: GetNeighbourPointsAndOpposite(const STLTriangle& t, int& p1, int& p2, int& po) const int STLTriangle :: GetNeighbourPointsAndOpposite(const STLTriangle& t, STLPointId & p1,
STLPointId & p2, STLPointId & po) const
{ {
for(int i = 1; i <= 3; i++) for(int i = 1; i <= 3; i++)
for(int j = 1; j <= 3; j++) for(int j = 1; j <= 3; j++)

View File

@ -947,10 +947,10 @@ int STLTopology :: GetRightTrig(int p1, int p2) const
int STLTopology :: NeighbourTrigSorted(int trig, int edgenum) const int STLTopology :: NeighbourTrigSorted(int trig, int edgenum) const
{ {
int i, p1, p2; STLPointId p1, p2;
int psearch = GetTriangle(trig).PNum(edgenum); STLPointId psearch = GetTriangle(trig).PNum(edgenum);
for (i = 1; i <= 3; i++) for (int i = 1; i <= 3; i++)
{ {
GetTriangle(trig).GetNeighbourPoints(GetTriangle(NeighbourTrig(trig,i)),p1,p2); GetTriangle(trig).GetNeighbourPoints(GetTriangle(NeighbourTrig(trig,i)),p1,p2);
if (p1 == psearch) {return NeighbourTrig(trig,i);} if (p1 == psearch) {return NeighbourTrig(trig,i);}

View File

@ -164,8 +164,8 @@ public:
int IsWrongNeighbourFrom(const STLTriangle& t) const; int IsWrongNeighbourFrom(const STLTriangle& t) const;
///Get the two points of neighbour-Triangles in orientation of this-Triangle ///Get the two points of neighbour-Triangles in orientation of this-Triangle
void GetNeighbourPoints(const STLTriangle& t, int& p1, int& p2) const; void GetNeighbourPoints(const STLTriangle& t, STLPointId & p1, STLPointId & p2) const;
int GetNeighbourPointsAndOpposite(const STLTriangle& t, int& p1, int& p2, int& po) const; int GetNeighbourPointsAndOpposite(const STLTriangle& t, STLPointId & p1, STLPointId & p2, STLPointId & po) const;