mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
more STLPointId ...
This commit is contained in:
parent
f22cb48832
commit
9b13bde72b
@ -1499,7 +1499,7 @@ void STLGeometry :: PrintSelectInfo()
|
||||
, " (=", int(GetTriangle(GetSelectTrig()).PNum(GetNodeOfSelTrig())), ")");
|
||||
if (AtlasMade() && GetSelectTrig() >= 1 && GetSelectTrig() <= GetNT())
|
||||
{
|
||||
PrintMessage(1," chartnum=",GetChartNr(GetSelectTrig()));
|
||||
PrintMessage(1," chartnum=", int(GetChartNr(GetSelectTrig())));
|
||||
/*
|
||||
PointBetween(Center(Center(GetPoint(GetTriangle(270).PNum(1)),
|
||||
GetPoint(GetTriangle(270).PNum(2))),
|
||||
@ -1517,7 +1517,7 @@ void STLGeometry :: ShowSelectedTrigChartnum()
|
||||
int st = GetSelectTrig();
|
||||
|
||||
if (st >= 1 && st <= GetNT() && AtlasMade())
|
||||
PrintMessage(1,"selected trig ", st, " has chartnumber ", GetChartNr(st));
|
||||
PrintMessage(1,"selected trig ", st, " has chartnumber ", int(GetChartNr(st)));
|
||||
}
|
||||
|
||||
void STLGeometry :: ShowSelectedTrigCoords()
|
||||
@ -2689,10 +2689,10 @@ void STLGeometry :: AddFaceEdges()
|
||||
double maxlen = -1;
|
||||
for (int j = 1; j <= c.GetNChartT(); j++)
|
||||
{
|
||||
const STLTriangle& t1 = GetTriangle(c.GetChartTrig(j));
|
||||
const STLTriangle& t1 = GetTriangle(c.GetChartTrig1(j));
|
||||
for (int k = 1; k <= 3; k++)
|
||||
{
|
||||
int nt = NeighbourTrig(c.GetChartTrig(j),k);
|
||||
int nt = NeighbourTrig(c.GetChartTrig1(j),k);
|
||||
if (GetChartNr(nt) != chartindex.Get(i))
|
||||
{
|
||||
t1.GetNeighbourPoints(GetTriangle(nt),ap1,ap2);
|
||||
@ -3153,7 +3153,7 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
|
||||
STLChart& chart = GetChart(i);
|
||||
for (j = 1; j <= chart.GetNChartT(); j++)
|
||||
{
|
||||
int t = chart.GetChartTrig(j);
|
||||
STLTrigId t = chart.GetChartTrig1(j);
|
||||
const STLTriangle& tt = GetTriangle(t);
|
||||
|
||||
for (k = 1; k <= 3; k++)
|
||||
@ -3172,7 +3172,7 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
|
||||
AddEdgePP(np2,edgenum);
|
||||
//changed = 1;
|
||||
PrintWarning("Found a spiral like structure: chart=", i,
|
||||
", trig=", t, ", p1=", np1, ", p2=", np2);
|
||||
", trig=", int(t), ", p1=", np1, ", p2=", np2);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
@ -3214,7 +3214,7 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
|
||||
STLChart& chart = GetChart(i);
|
||||
for (j = 1; j <= chart.GetNChartT(); j++)
|
||||
{
|
||||
int t = chart.GetChartTrig(j);
|
||||
STLTrigId t = chart.GetChartTrig1(j);
|
||||
const STLTriangle& tt = GetTriangle(t);
|
||||
|
||||
for (k = 1; k <= 3; k++)
|
||||
@ -3363,7 +3363,7 @@ void STLGeometry :: AddConeAndSpiralEdges(const STLParameters& stlparam)
|
||||
STLChart& chart = GetChart(i);
|
||||
for (j = 1; j <= chart.GetNChartT(); j++)
|
||||
{
|
||||
int t = chart.GetChartTrig(j);
|
||||
STLTrigId t = chart.GetChartTrig1(j);
|
||||
const STLTriangle& tt = GetTriangle(t);
|
||||
|
||||
for (k = 1; k <= 3; k++)
|
||||
|
@ -141,7 +141,7 @@ namespace netgen
|
||||
//
|
||||
Array<unique_ptr<STLChart>, ChartId> atlas;
|
||||
//marks all already charted trigs with chartnumber
|
||||
NgArray<ChartId> chartmark;
|
||||
Array<ChartId, STLTrigId> chartmark;
|
||||
//outerchartspertrig, ascending sorted
|
||||
TABLE<int> outerchartspertrig;
|
||||
|
||||
@ -368,7 +368,7 @@ namespace netgen
|
||||
void AddConeAndSpiralEdges(const STLParameters& stlparam);
|
||||
void AddFaceEdges(); //each face should have at least one starting edge (outherwise it won't be meshed)
|
||||
|
||||
void GetDirtyChartTrigs(int chartnum, STLChart& chart, const NgArray<ChartId>& outercharttrigs,
|
||||
void GetDirtyChartTrigs(int chartnum, STLChart& chart, const Array<ChartId, STLTrigId>& outercharttrigs,
|
||||
NgArray<ChartId>& chartpointchecked, NgArray<int>& dirtytrigs);
|
||||
|
||||
void ClearSpiralPoints();
|
||||
@ -394,11 +394,10 @@ namespace netgen
|
||||
int TrigIsInOC(int tn, int ocn) const;
|
||||
|
||||
//get chart number of a trig or 0 if unmarked
|
||||
int GetChartNr(int i) const;
|
||||
ChartId GetMarker(int i) const
|
||||
{ return chartmark.Get(i); }
|
||||
void SetMarker(int nr, ChartId m);
|
||||
int GetNOCharts() const { return atlas.Size(); }
|
||||
ChartId GetChartNr(STLTrigId i) const;
|
||||
ChartId GetMarker(STLTrigId i) const { return chartmark[i]; }
|
||||
void SetMarker(STLTrigId nr, ChartId m);
|
||||
size_t GetNOCharts() const { return atlas.Size(); }
|
||||
//get a chart from atlas
|
||||
const STLChart& GetChart(ChartId nr) const { return *atlas[nr];};
|
||||
STLChart & GetChart(ChartId nr) { return *atlas[nr];};
|
||||
|
@ -69,13 +69,13 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
double sinchartangle = sin(chartangle);
|
||||
double sinouterchartangle = sin(outerchartangle);
|
||||
|
||||
NgArray<ChartId> outermark(GetNT()); //marks all trigs form actual outer region
|
||||
NgArray<ChartId> outertested(GetNT()); //marks tested trigs for outer region
|
||||
NgArray<ChartId> pointstochart(GetNP()); //point in chart becomes chartnum
|
||||
NgArray<ChartId> innerpointstochart(GetNP()); //point in chart becomes chartnum
|
||||
NgArray<int> chartpoints; //point in chart becomes chartnum
|
||||
NgArray<int> innerchartpoints;
|
||||
NgArray<Point<3>> innerchartpts;
|
||||
Array<ChartId,STLTrigId> outermark(GetNT()); //marks all trigs form actual outer region
|
||||
Array<ChartId,STLTrigId> outertested(GetNT()); //marks tested trigs for outer region
|
||||
Array<ChartId,STLPointId> pointstochart(GetNP()); //point in chart becomes chartnum
|
||||
Array<ChartId,STLPointId> innerpointstochart(GetNP()); //point in chart becomes chartnum
|
||||
Array<STLPointId> chartpoints; //point in chart becomes chartnum
|
||||
Array<STLPointId> innerchartpoints;
|
||||
Array<Point<3>> innerchartpts;
|
||||
NgArray<int> dirtycharttrigs;
|
||||
|
||||
NgArray<int> chartdistacttrigs (GetNT()); //outercharttrigs
|
||||
@ -107,7 +107,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
double workedarea = 0;
|
||||
double showinc = 100.*5000./(double)GetNT();
|
||||
double nextshow = 0;
|
||||
int lastunmarked = 1;
|
||||
STLTrigId lastunmarked = 1;
|
||||
|
||||
PrintMessage(5,"one dot per 5000 triangles: ");
|
||||
|
||||
@ -126,10 +126,10 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
STLChart & chart = *atlas.Last();
|
||||
|
||||
//find unmarked trig
|
||||
int prelastunmarked = lastunmarked;
|
||||
STLTrigId prelastunmarked = lastunmarked;
|
||||
|
||||
bool found = false;
|
||||
for (int j = lastunmarked; j <= GetNT(); j++)
|
||||
for (STLTrigId j = lastunmarked; j <= GetNT(); j++)
|
||||
if (!GetMarker(j))
|
||||
{
|
||||
found = true;
|
||||
@ -145,11 +145,11 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
|
||||
chartbound.BuildSearchTree(); // different !!!
|
||||
|
||||
if (!found) { throw Exception("Make Atlas, no starttrig found"); }
|
||||
if (!found) throw Exception("Make Atlas, no starttrig found");
|
||||
|
||||
//find surrounding trigs
|
||||
// int starttrig = j;
|
||||
int starttrig = lastunmarked;
|
||||
STLTrigId starttrig = lastunmarked;
|
||||
|
||||
Point<3> startp = GetPoint(GetTriangle(starttrig)[0]);
|
||||
|
||||
@ -168,12 +168,13 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
|
||||
workedarea += GetTriangle(starttrig).Area(points);
|
||||
|
||||
for (int i = 1; i <= 3; i++)
|
||||
{
|
||||
innerpointstochart.Elem(GetTriangle(starttrig).PNum(i)) = chartnum;
|
||||
pointstochart.Elem(GetTriangle(starttrig).PNum(i)) = chartnum;
|
||||
chartpoints.Append(GetTriangle(starttrig).PNum(i));
|
||||
innerchartpoints.Append(GetTriangle(starttrig).PNum(i));
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
STLPointId pi = GetTriangle(starttrig)[i];
|
||||
innerpointstochart[pi] = chartnum;
|
||||
pointstochart[pi] = chartnum;
|
||||
chartpoints.Append(pi);
|
||||
innerchartpoints.Append(pi);
|
||||
}
|
||||
|
||||
bool changed = true;
|
||||
@ -191,7 +192,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
// for (ic = oldstartic2; ic <= chart->GetNT(); ic++)
|
||||
for (int ic = oldstartic2; ic <= oldstartic; ic++)
|
||||
{
|
||||
int i = chart.GetTrig(ic);
|
||||
STLTrigId i = chart.GetTrig1(ic);
|
||||
if (GetMarker(i) == chartnum)
|
||||
{
|
||||
for (int j = 1; j <= NONeighbourTrigs(i); j++)
|
||||
@ -273,11 +274,11 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
|
||||
for (int k = 1; k <= 3; k++)
|
||||
{
|
||||
if (innerpointstochart.Get(GetTriangle(nt).PNum(k))
|
||||
if (innerpointstochart[GetTriangle(nt).PNum(k)]
|
||||
!= chartnum)
|
||||
{
|
||||
innerpointstochart.Elem(GetTriangle(nt).PNum(k)) = chartnum;
|
||||
pointstochart.Elem(GetTriangle(nt).PNum(k)) = chartnum;
|
||||
innerpointstochart[GetTriangle(nt).PNum(k)] = chartnum;
|
||||
pointstochart[GetTriangle(nt).PNum(k)] = chartnum;
|
||||
chartpoints.Append(GetTriangle(nt).PNum(k));
|
||||
innerchartpoints.Append(GetTriangle(nt).PNum(k));
|
||||
}
|
||||
@ -304,7 +305,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
// warum, ic-bound auf edge macht Probleme js ???
|
||||
|
||||
|
||||
outermark.Elem(starttrig) = chartnum;
|
||||
outermark[starttrig] = chartnum;
|
||||
//chart->AddOuterTrig(starttrig);
|
||||
changed = true;
|
||||
oldstartic = 1;
|
||||
@ -316,13 +317,13 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
|
||||
for (int ic = oldstartic2; ic <= oldstartic; ic++)
|
||||
{
|
||||
int i = chart.GetTrig(ic);
|
||||
if (outermark.Get(i) != chartnum) continue;
|
||||
STLTrigId i = chart.GetTrig1(ic);
|
||||
if (outermark[i] != chartnum) continue;
|
||||
|
||||
for (int j = 1; j <= NONeighbourTrigs(i); j++)
|
||||
{
|
||||
int nt = NeighbourTrig(i,j);
|
||||
if (outermark.Get(nt) == chartnum) continue;
|
||||
STLTrigId nt = NeighbourTrig(i,j);
|
||||
if (outermark[nt] == chartnum) continue;
|
||||
|
||||
const STLTriangle & ntrig = GetTriangle(nt);
|
||||
int np1, np2;
|
||||
@ -335,7 +336,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
if (outertested.Get(nt) == chartnum)
|
||||
continue;
|
||||
*/
|
||||
outertested.Elem(nt) = chartnum;
|
||||
outertested[nt] = chartnum;
|
||||
|
||||
Vec<3> n2 = GetTriangle(nt).Normal();
|
||||
|
||||
@ -362,9 +363,9 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
for (int k = 1; k <= 3; k++)
|
||||
{
|
||||
// NgProfiler::StartTimer (timer4b);
|
||||
int nnt = NeighbourTrig(nt,k);
|
||||
STLTrigId nnt = NeighbourTrig(nt,k);
|
||||
|
||||
if (outermark.Elem(nnt) != chartnum)
|
||||
if (outermark[nnt] != chartnum)
|
||||
{
|
||||
// NgProfiler::StartTimer (timer4c);
|
||||
int nnp1, nnp2;
|
||||
@ -406,7 +407,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
accepted = false;
|
||||
|
||||
for (int k = 1; k <= 3; k++)
|
||||
if (innerpointstochart.Get(ntrig.PNum(k)) == chartnum)
|
||||
if (innerpointstochart[ntrig.PNum(k)] == chartnum)
|
||||
{
|
||||
accepted = true;
|
||||
break;
|
||||
@ -451,7 +452,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
if (accepted)
|
||||
{
|
||||
changed = true;
|
||||
outermark.Elem(nt) = chartnum;
|
||||
outermark[nt] = chartnum;
|
||||
|
||||
if (GetMarker(nt) != chartnum)
|
||||
{
|
||||
@ -459,10 +460,10 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
chart.AddOuterTrig(nt);
|
||||
for (int k = 1; k <= 3; k++)
|
||||
{
|
||||
if (pointstochart.Get(GetTriangle(nt).PNum(k))
|
||||
if (pointstochart[GetTriangle(nt).PNum(k)]
|
||||
!= chartnum)
|
||||
{
|
||||
pointstochart.Elem(GetTriangle(nt).PNum(k)) = chartnum;
|
||||
pointstochart[GetTriangle(nt).PNum(k)] = chartnum;
|
||||
chartpoints.Append(GetTriangle(nt).PNum(k));
|
||||
}
|
||||
}
|
||||
@ -491,8 +492,8 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
}
|
||||
for (int k = 1; k <= dirtycharttrigs.Size(); k++)
|
||||
{
|
||||
int tn = chart.GetChartTrig(dirtycharttrigs.Get(k));
|
||||
outermark.Elem(tn) = 0; //not necessary, for later use
|
||||
STLTrigId tn = chart.GetChartTrig1(dirtycharttrigs.Get(k));
|
||||
outermark[tn] = 0; //not necessary, for later use
|
||||
SetMarker(tn, 0);
|
||||
markedtrigcnt--;
|
||||
workedarea -= GetTriangle(tn).Area(points);
|
||||
@ -534,7 +535,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
||||
{
|
||||
for (int j = 1; j <= GetChart(i).GetNT(); j++)
|
||||
{
|
||||
int tn = GetChart(i).GetTrig(j);
|
||||
STLTrigId tn = GetChart(i).GetTrig1(j);
|
||||
AddOCPT(tn,i);
|
||||
}
|
||||
|
||||
@ -611,14 +612,14 @@ int STLGeometry::TrigIsInOC(int tn, int ocn) const
|
||||
return GetOCPT(tn, start) == ocn;
|
||||
}
|
||||
|
||||
int STLGeometry :: GetChartNr(int i) const
|
||||
ChartId STLGeometry :: GetChartNr(STLTrigId i) const
|
||||
{
|
||||
if (i > chartmark.Size())
|
||||
{
|
||||
PrintSysError("GetChartNr(", i, ") not possible!!!");
|
||||
PrintSysError("GetChartNr(", int(i), ") not possible!!!");
|
||||
i = 1;
|
||||
}
|
||||
return chartmark.Get(i);
|
||||
return chartmark[i];
|
||||
}
|
||||
/*
|
||||
int STLGeometry :: GetMarker(int i) const
|
||||
@ -626,9 +627,9 @@ int STLGeometry :: GetMarker(int i) const
|
||||
return chartmark.Get(i);
|
||||
}
|
||||
*/
|
||||
void STLGeometry :: SetMarker(int nr, ChartId m)
|
||||
void STLGeometry :: SetMarker(STLTrigId nr, ChartId m)
|
||||
{
|
||||
chartmark.Elem(nr) = m;
|
||||
chartmark[nr] = m;
|
||||
}
|
||||
|
||||
int STLGeometry :: AtlasMade() const
|
||||
@ -653,21 +654,19 @@ int AddIfNotExists(NgArray<int>& list, int x)
|
||||
|
||||
void STLGeometry :: GetInnerChartLimes(NgArray<twoint>& limes, ChartId chartnum)
|
||||
{
|
||||
int j, k;
|
||||
|
||||
int t, nt, np1, np2;
|
||||
int np1, np2;
|
||||
|
||||
limes.SetSize(0);
|
||||
|
||||
STLChart& chart = GetChart(chartnum);
|
||||
|
||||
for (j = 1; j <= chart.GetNChartT(); j++)
|
||||
for (int j = 1; j <= chart.GetNChartT(); j++)
|
||||
{
|
||||
t = chart.GetChartTrig(j);
|
||||
STLTrigId t = chart.GetChartTrig1(j);
|
||||
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) != chartnum)
|
||||
{
|
||||
tt.GetNeighbourPoints(GetTriangle(nt),np1,np2);
|
||||
@ -712,26 +711,26 @@ void STLGeometry :: GetInnerChartLimes(NgArray<twoint>& limes, ChartId chartnum)
|
||||
|
||||
|
||||
void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
|
||||
const NgArray<ChartId>& outercharttrigs,
|
||||
const Array<ChartId,STLTrigId>& outercharttrigs,
|
||||
NgArray<ChartId>& chartpointchecked,
|
||||
NgArray<int>& dirtytrigs)
|
||||
{
|
||||
dirtytrigs.SetSize(0);
|
||||
int j,k,n;
|
||||
|
||||
int np1, np2, nt;
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
for (j = 1; j <= chart.GetNChartT(); j++)
|
||||
for (int j = 1; j <= chart.GetNChartT(); j++)
|
||||
{
|
||||
int t = chart.GetChartTrig(j);
|
||||
STLTrigId t = chart.GetChartTrig1(j);
|
||||
const STLTriangle& tt = GetTriangle(t);
|
||||
|
||||
for (k = 1; k <= 3; k++)
|
||||
for (int k = 1; k <= 3; k++)
|
||||
{
|
||||
nt = NeighbourTrig(t,k);
|
||||
if (GetChartNr(nt) != chartnum && outercharttrigs.Get(nt) != chartnum)
|
||||
{
|
||||
STLTrigId nt = NeighbourTrig(t,k);
|
||||
if (GetChartNr(nt) != chartnum && outercharttrigs[nt] != chartnum)
|
||||
{
|
||||
int np1, np2;
|
||||
tt.GetNeighbourPoints(GetTriangle(nt),np1,np2);
|
||||
if (!IsEdge(np1,np2))
|
||||
{
|
||||
@ -747,23 +746,23 @@ void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
|
||||
int ap1, ap2, tn1, tn2, l, problem, pn;
|
||||
NgArray<int> trigsaroundp;
|
||||
|
||||
for (j = chart.GetNChartT(); j >= 1; j--)
|
||||
for (int j = chart.GetNChartT(); j >= 1; j--)
|
||||
{
|
||||
int t = chart.GetChartTrig(j);
|
||||
STLTrigId t = chart.GetChartTrig1(j);
|
||||
const STLTriangle& tt = GetTriangle(t);
|
||||
|
||||
for (k = 1; k <= 3; k++)
|
||||
for (int k = 1; k <= 3; k++)
|
||||
{
|
||||
pn = tt.PNum(k);
|
||||
//if (chartpointchecked.Get(pn) == chartnum)
|
||||
//{continue;}
|
||||
|
||||
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 && //ueberfluessig???
|
||||
GetChartNr(trigsperpoint.Get(pn,n)) != chartnum &&
|
||||
outercharttrigs.Get(trigsperpoint.Get(pn,n)) != chartnum) {checkpoint = 1;};
|
||||
outercharttrigs[trigsperpoint.Get(pn,n)] != chartnum) {checkpoint = 1;};
|
||||
}
|
||||
if (checkpoint)
|
||||
{
|
||||
@ -783,7 +782,7 @@ void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
|
||||
t1.GetNeighbourPoints(t2, ap1, ap2);
|
||||
if (IsEdge(ap1,ap2)) break;
|
||||
|
||||
if (GetChartNr(tn2) != chartnum && outercharttrigs.Get(tn2) != chartnum) {problem = 1;}
|
||||
if (GetChartNr(tn2) != chartnum && outercharttrigs[tn2] != chartnum) {problem = 1;}
|
||||
}
|
||||
|
||||
//backwards:
|
||||
@ -796,7 +795,7 @@ void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
|
||||
t1.GetNeighbourPoints(t2, ap1, ap2);
|
||||
if (IsEdge(ap1,ap2)) break;
|
||||
|
||||
if (GetChartNr(tn2) != chartnum && outercharttrigs.Get(tn2) != chartnum) {problem = 1;}
|
||||
if (GetChartNr(tn2) != chartnum && outercharttrigs[tn2] != chartnum) {problem = 1;}
|
||||
}
|
||||
// if (problem && !IsInArray(j,dirtytrigs))
|
||||
if (problem && !dirtytrigs.Contains(j))
|
||||
|
@ -462,7 +462,7 @@ void STLGeometry :: ToPlane (const Point<3> & locpoint, int * trigs,
|
||||
|
||||
else
|
||||
{
|
||||
NgArray<int> trigsinbox;
|
||||
NgArray<STLTrigId> trigsinbox;
|
||||
|
||||
if (!geomsearchtreeon)
|
||||
{
|
||||
@ -563,7 +563,7 @@ int STLGeometry :: Project(Point<3> & p3d) const
|
||||
|
||||
for (j = 1; j <= nt; j++)
|
||||
{
|
||||
i = chart.GetTrig(j);
|
||||
i = chart.GetTrig1(j);
|
||||
|
||||
const Point<3> & c = GetTriangle(i).center;
|
||||
/*
|
||||
@ -687,12 +687,12 @@ int STLGeometry :: ProjectNearest(Point<3> & p3d) const
|
||||
for (i = 1; i <= chart.GetNT(); i++)
|
||||
{
|
||||
p = p3d;
|
||||
dist = GetTriangle(chart.GetTrig(i)).GetNearestPoint(points, p);
|
||||
dist = GetTriangle(chart.GetTrig1(i)).GetNearestPoint(points, p);
|
||||
if (dist < nearest)
|
||||
{
|
||||
pf = p;
|
||||
nearest = dist;
|
||||
ft = chart.GetTrig(i);
|
||||
ft = chart.GetTrig1(i);
|
||||
}
|
||||
}
|
||||
p3d = pf;
|
||||
@ -1163,7 +1163,7 @@ void STLGeometry :: RestrictHChartDistOneChart(ChartId chartnum, NgArray<int>& a
|
||||
|
||||
for (int j = 1; j <= chart.GetNChartT(); j++)
|
||||
{
|
||||
int t = chart.GetChartTrig(j);
|
||||
int t = chart.GetChartTrig1(j);
|
||||
tt = GetTriangle(t);
|
||||
for (int k = 1; k <= 3; k++)
|
||||
{
|
||||
@ -1213,11 +1213,11 @@ void STLGeometry :: RestrictHChartDistOneChart(ChartId chartnum, NgArray<int>& a
|
||||
|
||||
NgProfiler::StartTimer (timer2);
|
||||
for (int j = 1; j <= chart.GetNT(); j++)
|
||||
acttrigs.Elem(chart.GetTrig(j)) = chartnum;
|
||||
acttrigs.Elem(chart.GetTrig1(j)) = chartnum;
|
||||
|
||||
for (int j = 1; j <= chart.GetNOuterT(); j++)
|
||||
{
|
||||
int t = chart.GetOuterTrig(j);
|
||||
int t = chart.GetOuterTrig1(j);
|
||||
tt = GetTriangle(t);
|
||||
for (int k = 1; k <= 3; k++)
|
||||
{
|
||||
|
@ -619,7 +619,7 @@ STLChart :: STLChart(STLGeometry * ageometry, const STLParameters& astlparam)
|
||||
{
|
||||
Box<3> box = geometry->GetBoundingBox();
|
||||
box.Increase (0.2*box.Diam()+1e-12);
|
||||
searchtree = new BoxTree<3> (box);
|
||||
searchtree = new BoxTree<3,STLTrigId> (box);
|
||||
/*
|
||||
searchtree = new BoxTree<3> (geometry->GetBoundingBox().PMin() - Vec3d(1,1,1),
|
||||
geometry->GetBoundingBox().PMax() + Vec3d(1,1,1));
|
||||
@ -634,7 +634,7 @@ STLChart :: ~STLChart()
|
||||
delete searchtree;
|
||||
}
|
||||
|
||||
void STLChart :: AddChartTrig(int i)
|
||||
void STLChart :: AddChartTrig(STLTrigId i)
|
||||
{
|
||||
// static int timer = NgProfiler::CreateTimer ("STLChart::AddChartTrig");
|
||||
// NgProfiler::RegionTimer reg(timer);
|
||||
@ -666,7 +666,7 @@ void STLChart :: AddChartTrig(int i)
|
||||
}
|
||||
}
|
||||
|
||||
void STLChart :: AddOuterTrig(int i)
|
||||
void STLChart :: AddOuterTrig(STLTrigId i)
|
||||
{
|
||||
// static int timer = NgProfiler::CreateTimer ("STLChart::AddOuterTrig");
|
||||
// NgProfiler::RegionTimer reg(timer);
|
||||
@ -690,18 +690,17 @@ void STLChart :: AddOuterTrig(int i)
|
||||
|
||||
bool STLChart :: IsInWholeChart(int nr) const
|
||||
{
|
||||
for (int i = 1; i <= charttrigs.Size(); i++)
|
||||
if (charttrigs.Get(i) == nr) return true;
|
||||
|
||||
for (int i = 1; i <= outertrigs.Size(); i++)
|
||||
if (outertrigs.Get(i) == nr) return true;
|
||||
|
||||
return false;
|
||||
// for (int i = 1; i <= charttrigs.Size(); i++)
|
||||
// if (charttrigs.Get(i) == nr) return true;
|
||||
// for (int i = 1; i <= outertrigs.Size(); i++)
|
||||
// if (outertrigs.Get(i) == nr) return true;
|
||||
// return false;
|
||||
return charttrigs.Contains(nr) || outertrigs.Contains(nr);
|
||||
}
|
||||
|
||||
void STLChart :: GetTrianglesInBox (const Point3d & pmin,
|
||||
const Point3d & pmax,
|
||||
NgArray<int> & trias) const
|
||||
NgArray<STLTrigId> & trias) const
|
||||
{
|
||||
if (geomsearchtreeon) {PrintMessage(5,"geomsearchtreeon is set!!!");}
|
||||
|
||||
@ -717,7 +716,7 @@ void STLChart :: GetTrianglesInBox (const Point3d & pmin,
|
||||
int nt = GetNT();
|
||||
for (int i = 1; i <= nt; i++)
|
||||
{
|
||||
int trignum = GetTrig(i);
|
||||
STLTrigId trignum = GetTrig1(i);
|
||||
const STLTriangle & trig = geometry->GetTriangle(trignum);
|
||||
Box<3> box2(geometry->GetPoint (trig.PNum(1)),
|
||||
geometry->GetPoint (trig.PNum(2)),
|
||||
@ -735,9 +734,9 @@ void STLChart :: MoveToOuterChart(const NgArray<int>& trigs)
|
||||
if (!trigs.Size()) return;
|
||||
for (int i = 1; i <= trigs.Size(); i++)
|
||||
{
|
||||
if (charttrigs.Get(trigs.Get(i)) != -1)
|
||||
{AddOuterTrig(charttrigs.Get(trigs.Get(i)));}
|
||||
charttrigs.Elem(trigs.Get(i)) = -1;
|
||||
if (charttrigs[trigs.Get(i)-1] != -1)
|
||||
AddOuterTrig(charttrigs[trigs.Get(i)-1]);
|
||||
charttrigs[trigs.Get(i)-1] = -1;
|
||||
}
|
||||
DelChartTrigs(trigs);
|
||||
}
|
||||
@ -748,15 +747,15 @@ void STLChart :: DelChartTrigs(const NgArray<int>& trigs)
|
||||
if (!trigs.Size()) return;
|
||||
|
||||
for (int i = 1; i <= trigs.Size(); i++)
|
||||
charttrigs.Elem(trigs.Get(i)) = -1;
|
||||
charttrigs[trigs.Get(i)-1] = -1;
|
||||
|
||||
int cnt = 0;
|
||||
for (int i = 1; i <= charttrigs.Size(); i++)
|
||||
{
|
||||
if (charttrigs.Elem(i) == -1)
|
||||
if (charttrigs[i-1] == -1)
|
||||
cnt++;
|
||||
if (cnt != 0 && i < charttrigs.Size())
|
||||
charttrigs.Elem(i-cnt+1) = charttrigs.Get(i+1);
|
||||
charttrigs[i-cnt] = charttrigs[i];
|
||||
}
|
||||
|
||||
int i = charttrigs.Size() - trigs.Size();
|
||||
@ -766,8 +765,8 @@ void STLChart :: DelChartTrigs(const NgArray<int>& trigs)
|
||||
{
|
||||
PrintMessage(7, "Warning: unsecure routine due to first use of searchtrees!!!");
|
||||
//bould new searchtree!!!
|
||||
searchtree = new BoxTree<3> (geometry->GetBoundingBox().PMin() - Vec3d(1,1,1),
|
||||
geometry->GetBoundingBox().PMax() + Vec3d(1,1,1));
|
||||
searchtree = new BoxTree<3,STLTrigId> (geometry->GetBoundingBox().PMin() - Vec3d(1,1,1),
|
||||
geometry->GetBoundingBox().PMax() + Vec3d(1,1,1));
|
||||
|
||||
for (int i = 1; i <= charttrigs.Size(); i++)
|
||||
{
|
||||
|
@ -69,9 +69,9 @@ class STLChart
|
||||
{
|
||||
private:
|
||||
STLGeometry * geometry;
|
||||
NgArray<int> charttrigs; // trigs which only belong to this chart
|
||||
NgArray<int> outertrigs; // trigs which belong to other charts
|
||||
BoxTree<3> * searchtree; // ADT containing outer trigs
|
||||
Array<STLTrigId> charttrigs; // trigs which only belong to this chart
|
||||
Array<STLTrigId> outertrigs; // trigs which belong to other charts
|
||||
BoxTree<3,STLTrigId> * searchtree; // ADT containing outer trigs
|
||||
|
||||
NgArray<twoint> olimit; //outer limit of outer chart
|
||||
NgArray<twoint> ilimit; //outer limit of inner chart
|
||||
@ -82,35 +82,35 @@ public:
|
||||
|
||||
STLChart(STLGeometry * ageometry, const STLParameters& astlparam);
|
||||
~STLChart();
|
||||
void AddChartTrig(int i);
|
||||
void AddOuterTrig(int i);
|
||||
void AddChartTrig(STLTrigId i);
|
||||
void AddOuterTrig(STLTrigId i);
|
||||
|
||||
bool IsInWholeChart(int nr) const;
|
||||
|
||||
int GetChartTrig(int i) const {return charttrigs.Get(i);}
|
||||
int GetOuterTrig(int i) const {return outertrigs.Get(i);}
|
||||
STLTrigId GetChartTrig1(int i) const {return charttrigs[i-1];}
|
||||
STLTrigId GetOuterTrig1(int i) const {return outertrigs[i-1];}
|
||||
//get all trigs:
|
||||
int GetTrig(int i) const
|
||||
STLTrigId GetTrig1(int i) const
|
||||
{
|
||||
if (i <= charttrigs.Size()) {return charttrigs.Get(i);}
|
||||
else {return outertrigs.Get(i-charttrigs.Size());}
|
||||
if (i <= charttrigs.Size()) {return charttrigs[i-1];}
|
||||
else {return outertrigs[i-charttrigs.Size()-1];}
|
||||
}
|
||||
|
||||
int GetNChartT() const {return charttrigs.Size();}
|
||||
int GetNOuterT() const {return outertrigs.Size();}
|
||||
int GetNT() const {return charttrigs.Size()+outertrigs.Size(); }
|
||||
size_t GetNChartT() const {return charttrigs.Size();}
|
||||
size_t GetNOuterT() const {return outertrigs.Size();}
|
||||
size_t GetNT() const {return charttrigs.Size()+outertrigs.Size(); }
|
||||
|
||||
void GetTrianglesInBox (const Point3d & pmin,
|
||||
const Point3d & pmax,
|
||||
NgArray<int> & trias) const;
|
||||
NgArray<STLTrigId> & trias) const;
|
||||
void AddOLimit(twoint l) {olimit.Append(l);}
|
||||
void AddILimit(twoint l) {ilimit.Append(l);}
|
||||
|
||||
void ClearOLimit() {olimit.SetSize(0);}
|
||||
void ClearILimit() {ilimit.SetSize(0);}
|
||||
|
||||
int GetNOLimit() const {return olimit.Size();}
|
||||
int GetNILimit() const {return ilimit.Size();}
|
||||
size_t GetNOLimit() const {return olimit.Size();}
|
||||
size_t GetNILimit() const {return ilimit.Size();}
|
||||
|
||||
twoint GetOLimit(int i) const {return olimit.Get(i);}
|
||||
twoint GetILimit(int i) const {return ilimit.Get(i);}
|
||||
|
@ -544,10 +544,10 @@ void VisualSceneSTLMeshing :: DrawScene ()
|
||||
else
|
||||
{glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_colbrown);}
|
||||
*/
|
||||
const STLTriangle& st = stlgeometry -> GetTriangle(chart.GetChartTrig(j));
|
||||
const STLTriangle& st = stlgeometry -> GetTriangle(chart.GetChartTrig1(j));
|
||||
|
||||
|
||||
const Vec3d & n = stlgeometry->GetTriangle(chart.GetChartTrig(j)).Normal();
|
||||
const Vec3d & n = stlgeometry->GetTriangle(chart.GetChartTrig1(j)).Normal();
|
||||
glNormal3f (n.X(), n.Y(), n.Z());
|
||||
/*
|
||||
const STLReadTriangle& tria = stlgeometry -> GetReadTriangle(chart.GetChartTrig(j));
|
||||
@ -567,9 +567,9 @@ void VisualSceneSTLMeshing :: DrawScene ()
|
||||
for (j = 1; j <= chart.GetNOuterT(); j++)
|
||||
{
|
||||
|
||||
const STLTriangle& st = stlgeometry -> GetTriangle(chart.GetOuterTrig(j));
|
||||
const STLTriangle& st = stlgeometry -> GetTriangle(chart.GetOuterTrig1(j));
|
||||
|
||||
const Vec3d & n = stlgeometry->GetTriangle(chart.GetOuterTrig(j)).Normal();
|
||||
const Vec3d & n = stlgeometry->GetTriangle(chart.GetOuterTrig1(j)).Normal();
|
||||
glNormal3f (n.X(), n.Y(), n.Z());
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user