mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-13 14:40:35 +05:00
more STL*Id
This commit is contained in:
parent
4de79f4ce6
commit
c180b37ea8
@ -1609,7 +1609,7 @@ void STLGeometry :: NeighbourAnglesOfSelectedTrig()
|
|||||||
PrintMessage(1,"Angle to triangle ", st, ":");
|
PrintMessage(1,"Angle to triangle ", st, ":");
|
||||||
for (i = 1; i <= NONeighbourTrigs(st); i++)
|
for (i = 1; i <= NONeighbourTrigs(st); i++)
|
||||||
{
|
{
|
||||||
PrintMessage(1," triangle ", NeighbourTrig(st,i), ": angle = ",
|
PrintMessage(1," triangle ", int(NeighbourTrig(st,i)), ": angle = ",
|
||||||
180./M_PI*GetAngle(st, NeighbourTrig(st,i)), "°",
|
180./M_PI*GetAngle(st, NeighbourTrig(st,i)), "°",
|
||||||
", calculated = ", 180./M_PI*Angle(GetTriangle(st).GeomNormal(points),
|
", calculated = ", 180./M_PI*Angle(GetTriangle(st).GeomNormal(points),
|
||||||
GetTriangle(NeighbourTrig(st,i)).GeomNormal(points)), "°");
|
GetTriangle(NeighbourTrig(st,i)).GeomNormal(points)), "°");
|
||||||
|
@ -260,6 +260,32 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// new check 2019-09-22
|
||||||
|
if (accepted)
|
||||||
|
{
|
||||||
|
auto & trig = GetTriangle(nt);
|
||||||
|
Point<3> p0 = GetPoint(trig[0]);
|
||||||
|
Point<3> p1 = GetPoint(trig[1]);
|
||||||
|
Point<3> p2 = GetPoint(trig[2]);
|
||||||
|
Point<3> p01 = Center(p0,p1);
|
||||||
|
Point<3> p02 = Center(p0,p2);
|
||||||
|
Point<3> p12 = Center(p1,p2);
|
||||||
|
Point<3> p012 = Center(p0,p1,p2);
|
||||||
|
p01 += 1e-5 * (p012-p01);
|
||||||
|
p02 += 1e-5 * (p012-p02);
|
||||||
|
p12 += 1e-5 * (p012-p12);
|
||||||
|
bool test1 = chartbound.TestSegChartNV(p01,p012,sn);
|
||||||
|
bool test2 = chartbound.TestSegChartNV(p02,p012,sn);
|
||||||
|
bool test3 = chartbound.TestSegChartNV(p12,p012,sn);
|
||||||
|
if (!test1 || !test2 || !test3)
|
||||||
|
{
|
||||||
|
cout << "more stringent" << endl;
|
||||||
|
accepted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (accepted)
|
if (accepted)
|
||||||
{
|
{
|
||||||
@ -274,13 +300,13 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
|
|
||||||
for (int k = 1; k <= 3; k++)
|
for (int k = 1; k <= 3; k++)
|
||||||
{
|
{
|
||||||
if (innerpointstochart[GetTriangle(nt).PNum(k)]
|
STLPointId pi = GetTriangle(nt).PNum(k);
|
||||||
!= chartnum)
|
if (innerpointstochart[pi] != chartnum)
|
||||||
{
|
{
|
||||||
innerpointstochart[GetTriangle(nt).PNum(k)] = chartnum;
|
innerpointstochart[pi] = chartnum;
|
||||||
pointstochart[GetTriangle(nt).PNum(k)] = chartnum;
|
pointstochart[pi] = chartnum;
|
||||||
chartpoints.Append(GetTriangle(nt).PNum(k));
|
chartpoints.Append(pi);
|
||||||
innerchartpoints.Append(GetTriangle(nt).PNum(k));
|
innerchartpoints.Append(pi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,7 +541,7 @@ int STLGeometry :: Project(Point<3> & p3d) const
|
|||||||
{
|
{
|
||||||
Point<3> p, pf;
|
Point<3> p, pf;
|
||||||
|
|
||||||
int i, j;
|
int j;
|
||||||
int fi = 0;
|
int fi = 0;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int different = 0;
|
int different = 0;
|
||||||
@ -563,7 +563,7 @@ int STLGeometry :: Project(Point<3> & p3d) const
|
|||||||
|
|
||||||
for (j = 1; j <= nt; j++)
|
for (j = 1; j <= nt; j++)
|
||||||
{
|
{
|
||||||
i = chart.GetTrig1(j);
|
STLTrigId i = chart.GetTrig1(j);
|
||||||
|
|
||||||
const Point<3> & c = GetTriangle(i).center;
|
const Point<3> & c = GetTriangle(i).center;
|
||||||
/*
|
/*
|
||||||
|
@ -493,7 +493,8 @@ void STLEdgeDataList :: BuildClusterWithEdge(int ep1, int ep2, NgArray<twoint>&
|
|||||||
int j, i, k;
|
int j, i, k;
|
||||||
int oldend;
|
int oldend;
|
||||||
int newend = 1;
|
int newend = 1;
|
||||||
int pnew, ennew(0);
|
STLPointId pnew;
|
||||||
|
int ennew(0);
|
||||||
|
|
||||||
int changed = 1;
|
int changed = 1;
|
||||||
while (changed)
|
while (changed)
|
||||||
|
@ -165,8 +165,8 @@ public:
|
|||||||
int operator== (const STLBoundarySeg & s2) const
|
int operator== (const STLBoundarySeg & s2) const
|
||||||
{ return i1 == s2.i1 && i2 == s2.i2; }
|
{ return i1 == s2.i1 && i2 == s2.i2; }
|
||||||
void Swap ();
|
void Swap ();
|
||||||
int I1() const { return i1; }
|
STLPointId I1() const { return i1; }
|
||||||
int I2() const { return i2; }
|
STLPointId I2() const { return i2; }
|
||||||
const Point<3> & P1() const { return p1; }
|
const Point<3> & P1() const { return p1; }
|
||||||
const Point<3> & P2() const { return p2; }
|
const Point<3> & P2() const { return p2; }
|
||||||
const Point<2> & P2D1() const { return p2d1; }
|
const Point<2> & P2D1() const { return p2d1; }
|
||||||
|
@ -829,7 +829,7 @@ void STLTopology :: FindNeighbourTrigs()
|
|||||||
PrintError("TRIG ",i," has ",NONeighbourTrigs(i)," neighbours!!!!");
|
PrintError("TRIG ",i," has ",NONeighbourTrigs(i)," neighbours!!!!");
|
||||||
for (int kk=1; kk <= NONeighbourTrigs(i); kk++)
|
for (int kk=1; kk <= NONeighbourTrigs(i); kk++)
|
||||||
{
|
{
|
||||||
PrintMessage(5,"neighbour-trig",kk," = ",NeighbourTrig(i,kk));
|
PrintMessage(5,"neighbour-trig",kk," = ",int(NeighbourTrig(i,kk)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,10 @@ public:
|
|||||||
STLPointId & operator= (const STLPointId & ai) { i = ai.i; return *this; }
|
STLPointId & operator= (const STLPointId & ai) { i = ai.i; return *this; }
|
||||||
STLPointId & operator= (int ai) { i = ai; return *this; }
|
STLPointId & operator= (int ai) { i = ai; return *this; }
|
||||||
constexpr operator int () const { return i; }
|
constexpr operator int () const { return i; }
|
||||||
STLPointId operator++ (int) { return i++; }
|
STLPointId operator++ (int) { return STLPointId(i++); }
|
||||||
STLPointId operator-- (int) { return i--; }
|
STLPointId operator-- (int) { return STLPointId(i--); }
|
||||||
STLPointId & operator++ () { i++; return *this; }
|
STLPointId & operator++ () { ++i; return *this; }
|
||||||
|
STLPointId & operator-- () { --i; return *this; }
|
||||||
|
|
||||||
void DoArchive(Archive& ar) { ar & i; }
|
void DoArchive(Archive& ar) { ar & i; }
|
||||||
};
|
};
|
||||||
@ -47,10 +48,13 @@ public:
|
|||||||
STLTrigId & operator= (const STLTrigId & ai) { i = ai.i; return *this; }
|
STLTrigId & operator= (const STLTrigId & ai) { i = ai.i; return *this; }
|
||||||
STLTrigId & operator= (int ai) { i = ai; return *this; }
|
STLTrigId & operator= (int ai) { i = ai; return *this; }
|
||||||
constexpr operator int () const { return i; }
|
constexpr operator int () const { return i; }
|
||||||
STLTrigId operator++ (int) { return i++; }
|
|
||||||
STLTrigId operator-- (int) { return i--; }
|
|
||||||
STLTrigId & operator++ () { i++; return *this; }
|
|
||||||
|
|
||||||
|
STLTrigId operator++ (int) { return STLTrigId(i++); }
|
||||||
|
STLTrigId operator-- (int) { return STLTrigId(i--); }
|
||||||
|
STLTrigId & operator++ () { ++i; return *this; }
|
||||||
|
STLTrigId & operator-- () { --i; return *this; }
|
||||||
|
|
||||||
|
int operator- (STLTrigId i2) const { return i-i2.i; }
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void SetInvalid (STLTrigId & id) { id = 0; }
|
inline void SetInvalid (STLTrigId & id) { id = 0; }
|
||||||
@ -334,9 +338,9 @@ public:
|
|||||||
|
|
||||||
int GetNP() const { return points.Size(); }
|
int GetNP() const { return points.Size(); }
|
||||||
int AddPoint(const Point<3> & p) { points.Append(p); return points.Size(); }
|
int AddPoint(const Point<3> & p) { points.Append(p); return points.Size(); }
|
||||||
const Point<3> & GetPoint(int nr) const { return points[nr]; } // .Get(nr); }
|
const Point<3> & GetPoint(STLPointId nr) const { return points[nr]; } // .Get(nr); }
|
||||||
int GetPointNum (const Point<3> & p);
|
int GetPointNum (const Point<3> & p);
|
||||||
void SetPoint(int nr, const Point<3> & p) { points[nr] = p; } // { points.Elem(nr) = p; }
|
void SetPoint(STLPointId nr, const Point<3> & p) { points[nr] = p; } // { points.Elem(nr) = p; }
|
||||||
auto & GetPoints() const { return points; }
|
auto & GetPoints() const { return points; }
|
||||||
|
|
||||||
const Point<3> & operator[] (STLPointId i) const { return points[i]; }
|
const Point<3> & operator[] (STLPointId i) const { return points[i]; }
|
||||||
@ -347,8 +351,8 @@ public:
|
|||||||
|
|
||||||
int GetNT() const { return trias.Size(); }
|
int GetNT() const { return trias.Size(); }
|
||||||
void AddTriangle(const STLTriangle& t);
|
void AddTriangle(const STLTriangle& t);
|
||||||
const STLTriangle & GetTriangle (int nr) const { return trias[nr]; } // .Get(nr); }
|
const STLTriangle & GetTriangle (STLTrigId nr) const { return trias[nr]; } // .Get(nr); }
|
||||||
STLTriangle & GetTriangle (int nr) { return trias[nr]; } // .Elem(nr); }
|
STLTriangle & GetTriangle (STLTrigId nr) { return trias[nr]; } // .Elem(nr); }
|
||||||
|
|
||||||
const STLTriangle & operator[] (STLTrigId i) const { return trias[i]; }
|
const STLTriangle & operator[] (STLTrigId i) const { return trias[i]; }
|
||||||
STLTriangle & operator[] (STLTrigId i) { return trias[i]; }
|
STLTriangle & operator[] (STLTrigId i) { return trias[i]; }
|
||||||
@ -381,13 +385,13 @@ public:
|
|||||||
|
|
||||||
// Table will be constructed, if topology is not ok
|
// Table will be constructed, if topology is not ok
|
||||||
/// neighbourtrigs for surfacetrigs
|
/// neighbourtrigs for surfacetrigs
|
||||||
TABLE<int> neighbourtrigs;
|
TABLE<STLTrigId> neighbourtrigs;
|
||||||
|
|
||||||
/// get nr-th neighbour Triangle for triangle trig
|
/// get nr-th neighbour Triangle for triangle trig
|
||||||
int NONeighbourTrigs(int trig) const { return neighbourtrigs.EntrySize(trig); }
|
int NONeighbourTrigs(STLTrigId trig) const { return neighbourtrigs.EntrySize(int(trig)); }
|
||||||
int NeighbourTrig(int trig, int nr) const { return neighbourtrigs.Get(trig,nr); }
|
STLTrigId NeighbourTrig(STLTrigId trig, int nr) const { return neighbourtrigs.Get(int(trig),nr); }
|
||||||
int NeighbourTrigSorted(int trig, int nr) const;
|
int NeighbourTrigSorted(int trig, int nr) const;
|
||||||
void AddNeighbourTrig(int i, int nt) { neighbourtrigs.Add1(i, nt); }
|
void AddNeighbourTrig(STLTrigId i, STLTrigId nt) { neighbourtrigs.Add1(int(i), nt); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user