mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
use Point/Trig/Chart-Id in stl-meshing, more to come
This commit is contained in:
parent
8381ce58ba
commit
61c9e669c3
@ -759,6 +759,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
for (int i = 1; i <= chartboundpoints.Size(); i++)
|
for (int i = 1; i <= chartboundpoints.Size(); i++)
|
||||||
{
|
{
|
||||||
|
pindex.Append(-1);
|
||||||
plainpoints.Append (chartboundpoints.Get(i));
|
plainpoints.Append (chartboundpoints.Get(i));
|
||||||
locpoints.Append (chartboundpoints3d.Get(i));
|
locpoints.Append (chartboundpoints3d.Get(i));
|
||||||
legalpoints.Append (0);
|
legalpoints.Append (0);
|
||||||
@ -1986,6 +1987,20 @@ namespace netgen
|
|||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
void glrender (int wait)
|
void glrender (int wait)
|
||||||
{ ; }
|
{ ;
|
||||||
|
/*
|
||||||
|
if (multithread.drawing)
|
||||||
|
{
|
||||||
|
// vssurfacemeshing.Render();
|
||||||
|
// Render ();
|
||||||
|
|
||||||
|
if (wait || multithread.testmode)
|
||||||
|
{
|
||||||
|
multithread.pause = 1;
|
||||||
|
}
|
||||||
|
while (multithread.pause);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -175,7 +175,7 @@ namespace netgen
|
|||||||
constexpr operator int () const { return i; }
|
constexpr operator int () const { return i; }
|
||||||
PointIndex operator++ (int) { PointIndex hi(*this); i++; return hi; }
|
PointIndex operator++ (int) { PointIndex hi(*this); i++; return hi; }
|
||||||
PointIndex operator-- (int) { PointIndex hi(*this); i--; return hi; }
|
PointIndex operator-- (int) { PointIndex hi(*this); i--; return hi; }
|
||||||
PointIndex operator++ () { i++; return *this; }
|
PointIndex & operator++ () { i++; return *this; }
|
||||||
PointIndex operator-- () { i--; return *this; }
|
PointIndex operator-- () { i--; return *this; }
|
||||||
void Invalidate() { i = PointIndex::BASE-1; }
|
void Invalidate() { i = PointIndex::BASE-1; }
|
||||||
bool IsValid() const { return i != PointIndex::BASE-1; }
|
bool IsValid() const { return i != PointIndex::BASE-1; }
|
||||||
|
@ -64,7 +64,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;
|
||||||
}
|
}
|
||||||
@ -1389,7 +1389,7 @@ void STLGeometry :: DestroyDirtyTrigs()
|
|||||||
{
|
{
|
||||||
for (k = i+1; k <= GetNT(); k++)
|
for (k = i+1; k <= GetNT(); k++)
|
||||||
{
|
{
|
||||||
trias.Elem(k-1) = trias.Get(k);
|
trias[k-1] = trias[k];
|
||||||
// readtrias: not longer permanent, JS
|
// readtrias: not longer permanent, JS
|
||||||
// readtrias.Elem(k-1) = readtrias.Get(k);
|
// readtrias.Elem(k-1) = readtrias.Get(k);
|
||||||
}
|
}
|
||||||
@ -1495,8 +1495,8 @@ void STLGeometry :: PrintSelectInfo()
|
|||||||
//int p = GetTriangle(trig).PNum(GetNodeOfSelTrig());
|
//int p = GetTriangle(trig).PNum(GetNodeOfSelTrig());
|
||||||
|
|
||||||
PrintMessage(1,"touch triangle ", GetSelectTrig()
|
PrintMessage(1,"touch triangle ", GetSelectTrig()
|
||||||
, ", local node ", GetNodeOfSelTrig()
|
, ", local node ", GetNodeOfSelTrig()
|
||||||
, " (=", GetTriangle(GetSelectTrig()).PNum(GetNodeOfSelTrig()), ")");
|
, " (=", int(GetTriangle(GetSelectTrig()).PNum(GetNodeOfSelTrig())), ")");
|
||||||
if (AtlasMade() && GetSelectTrig() >= 1 && GetSelectTrig() <= GetNT())
|
if (AtlasMade() && GetSelectTrig() >= 1 && GetSelectTrig() <= GetNT())
|
||||||
{
|
{
|
||||||
PrintMessage(1," chartnum=",GetChartNr(GetSelectTrig()));
|
PrintMessage(1," chartnum=",GetChartNr(GetSelectTrig()));
|
||||||
@ -1533,11 +1533,11 @@ void STLGeometry :: ShowSelectedTrigCoords()
|
|||||||
if (st >= 1 && st <= GetNT())
|
if (st >= 1 && st <= GetNT())
|
||||||
{
|
{
|
||||||
PrintMessage(1, "coordinates of selected trig ", st, ":");
|
PrintMessage(1, "coordinates of selected trig ", st, ":");
|
||||||
PrintMessage(1, " p1 = ", GetTriangle(st).PNum(1), " = ",
|
PrintMessage(1, " p1 = ", int(GetTriangle(st).PNum(1)), " = ",
|
||||||
Point3d (GetPoint(GetTriangle(st).PNum(1))));
|
Point3d (GetPoint(GetTriangle(st).PNum(1))));
|
||||||
PrintMessage(1, " p2 = ", GetTriangle(st).PNum(2), " = ",
|
PrintMessage(1, " p2 = ", int(GetTriangle(st).PNum(2)), " = ",
|
||||||
Point3d (GetPoint(GetTriangle(st).PNum(2))));
|
Point3d (GetPoint(GetTriangle(st).PNum(2))));
|
||||||
PrintMessage(1, " p3 = ", GetTriangle(st).PNum(3), " = ",
|
PrintMessage(1, " p3 = ", int(GetTriangle(st).PNum(3)), " = ",
|
||||||
Point3d (GetPoint(GetTriangle(st).PNum(3))));
|
Point3d (GetPoint(GetTriangle(st).PNum(3))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3111,10 +3111,10 @@ void STLGeometry :: BuildSmoothEdges ()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int STLGeometry :: IsSmoothEdge (int pi1, int pi2) const
|
bool STLGeometry :: IsSmoothEdge (int pi1, int pi2) const
|
||||||
{
|
{
|
||||||
if (!smoothedges)
|
if (!smoothedges)
|
||||||
return 0;
|
return false;
|
||||||
INDEX_2 i2(pi1, pi2);
|
INDEX_2 i2(pi1, pi2);
|
||||||
i2.Sort();
|
i2.Sort();
|
||||||
return smoothedges->Used (i2);
|
return smoothedges->Used (i2);
|
||||||
|
@ -23,6 +23,11 @@
|
|||||||
|
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
|
|
||||||
|
#include "stltopology.hpp"
|
||||||
|
#include "stltool.hpp"
|
||||||
|
#include "stlline.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
@ -44,10 +49,6 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "stltopology.hpp"
|
|
||||||
#include "stltool.hpp"
|
|
||||||
#include "stlline.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -138,9 +139,9 @@ namespace netgen
|
|||||||
//spiralpoints:
|
//spiralpoints:
|
||||||
NgArray<int> spiralpoints;
|
NgArray<int> spiralpoints;
|
||||||
//
|
//
|
||||||
NgArray<STLChart*> atlas;
|
Array<unique_ptr<STLChart>, ChartId> atlas;
|
||||||
//marks all already charted trigs with chartnumber
|
//marks all already charted trigs with chartnumber
|
||||||
NgArray<int> chartmark;
|
NgArray<ChartId> chartmark;
|
||||||
//outerchartspertrig, ascending sorted
|
//outerchartspertrig, ascending sorted
|
||||||
TABLE<int> outerchartspertrig;
|
TABLE<int> outerchartspertrig;
|
||||||
|
|
||||||
@ -367,8 +368,8 @@ namespace netgen
|
|||||||
void AddConeAndSpiralEdges(const STLParameters& stlparam);
|
void AddConeAndSpiralEdges(const STLParameters& stlparam);
|
||||||
void AddFaceEdges(); //each face should have at least one starting edge (outherwise it won't be meshed)
|
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<int>& outercharttrigs,
|
void GetDirtyChartTrigs(int chartnum, STLChart& chart, const NgArray<ChartId>& outercharttrigs,
|
||||||
NgArray<int>& chartpointchecked, NgArray<int>& dirtytrigs);
|
NgArray<ChartId>& chartpointchecked, NgArray<int>& dirtytrigs);
|
||||||
|
|
||||||
void ClearSpiralPoints();
|
void ClearSpiralPoints();
|
||||||
void SetSpiralPoint(int pn) {spiralpoints.Elem(pn) = 1;};
|
void SetSpiralPoint(int pn) {spiralpoints.Elem(pn) = 1;};
|
||||||
@ -378,7 +379,7 @@ namespace netgen
|
|||||||
|
|
||||||
// smooth edges: sharp geometric edges not declared as edges
|
// smooth edges: sharp geometric edges not declared as edges
|
||||||
void BuildSmoothEdges ();
|
void BuildSmoothEdges ();
|
||||||
int IsSmoothEdge (int pi1, int pi2) const;
|
bool IsSmoothEdge (int pi1, int pi2) const;
|
||||||
|
|
||||||
|
|
||||||
//make charts with regions of a max. angle
|
//make charts with regions of a max. angle
|
||||||
@ -394,16 +395,16 @@ namespace netgen
|
|||||||
|
|
||||||
//get chart number of a trig or 0 if unmarked
|
//get chart number of a trig or 0 if unmarked
|
||||||
int GetChartNr(int i) const;
|
int GetChartNr(int i) const;
|
||||||
int GetMarker(int i) const
|
ChartId GetMarker(int i) const
|
||||||
{ return chartmark.Get(i); }
|
{ return chartmark.Get(i); }
|
||||||
void SetMarker(int nr, int m);
|
void SetMarker(int nr, ChartId m);
|
||||||
int GetNOCharts() const;
|
int GetNOCharts() const { return atlas.Size(); }
|
||||||
//get a chart from atlas
|
//get a chart from atlas
|
||||||
const STLChart& GetChart(int nr) const;
|
const STLChart& GetChart(ChartId nr) const { return *atlas[nr];};
|
||||||
STLChart& GetChart(int nr) {return *(atlas.Get(nr));};
|
STLChart & GetChart(ChartId nr) { return *atlas[nr];};
|
||||||
int AtlasMade() const;
|
int AtlasMade() const;
|
||||||
|
|
||||||
void GetInnerChartLimes(NgArray<twoint>& limes, int chartnum);
|
void GetInnerChartLimes(NgArray<twoint>& limes, ChartId chartnum);
|
||||||
|
|
||||||
//FOR MESHING
|
//FOR MESHING
|
||||||
int GetMeshChartNr () { return meshchart; }
|
int GetMeshChartNr () { return meshchart; }
|
||||||
@ -452,7 +453,7 @@ namespace netgen
|
|||||||
|
|
||||||
DLL_HEADER void RestrictLocalH(class Mesh & mesh, double gh, const STLParameters& stlparam);
|
DLL_HEADER void RestrictLocalH(class Mesh & mesh, double gh, const STLParameters& stlparam);
|
||||||
void RestrictLocalHCurv(class Mesh & mesh, double gh, const STLParameters& stlparam);
|
void RestrictLocalHCurv(class Mesh & mesh, double gh, const STLParameters& stlparam);
|
||||||
void RestrictHChartDistOneChart(int chartnum, NgArray<int>& acttrigs, class Mesh & mesh,
|
void RestrictHChartDistOneChart(ChartId chartnum, NgArray<int>& acttrigs, class Mesh & mesh,
|
||||||
double gh, double fact, double minh, const STLParameters& stlparam);
|
double gh, double fact, double minh, const STLParameters& stlparam);
|
||||||
|
|
||||||
friend class MeshingSTLSurface;
|
friend class MeshingSTLSurface;
|
||||||
|
@ -69,10 +69,10 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
double sinchartangle = sin(chartangle);
|
double sinchartangle = sin(chartangle);
|
||||||
double sinouterchartangle = sin(outerchartangle);
|
double sinouterchartangle = sin(outerchartangle);
|
||||||
|
|
||||||
NgArray<int> outermark(GetNT()); //marks all trigs form actual outer region
|
NgArray<ChartId> outermark(GetNT()); //marks all trigs form actual outer region
|
||||||
NgArray<int> outertested(GetNT()); //marks tested trigs for outer region
|
NgArray<ChartId> outertested(GetNT()); //marks tested trigs for outer region
|
||||||
NgArray<int> pointstochart(GetNP()); //point in chart becomes chartnum
|
NgArray<ChartId> pointstochart(GetNP()); //point in chart becomes chartnum
|
||||||
NgArray<int> innerpointstochart(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> chartpoints; //point in chart becomes chartnum
|
||||||
NgArray<int> innerchartpoints;
|
NgArray<int> innerchartpoints;
|
||||||
NgArray<Point<3>> innerchartpts;
|
NgArray<Point<3>> innerchartpts;
|
||||||
@ -86,38 +86,32 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
//int chartboundarydivisions = 10;
|
//int chartboundarydivisions = 10;
|
||||||
markedsegs.SetSize(0); //for testing!!!
|
markedsegs.SetSize(0); //for testing!!!
|
||||||
|
|
||||||
NgArray<int> chartpointchecked(GetNP()); //for dirty-chart-trigs
|
NgArray<ChartId> chartpointchecked(GetNP()); //for dirty-chart-trigs
|
||||||
|
|
||||||
pointstochart.SetSize(GetNP());
|
|
||||||
innerpointstochart.SetSize(GetNP());
|
|
||||||
chartmark.SetSize(GetNT());
|
chartmark.SetSize(GetNT());
|
||||||
|
|
||||||
for (int i = 1; i <= GetNP(); i++)
|
innerpointstochart = ChartId::INVALID;
|
||||||
{
|
pointstochart = ChartId::INVALID;
|
||||||
innerpointstochart.Elem(i) = 0;
|
chartpointchecked = ChartId::INVALID;
|
||||||
pointstochart.Elem(i) = 0;
|
|
||||||
chartpointchecked.Elem(i) = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
double eps = 1e-12 * Dist (boundingbox.PMin(), boundingbox.PMax());
|
double eps = 1e-12 * Dist (boundingbox.PMin(), boundingbox.PMax());
|
||||||
|
|
||||||
int spiralcheckon = stldoctor.spiralcheck;
|
int spiralcheckon = stldoctor.spiralcheck;
|
||||||
if (!spiralcheckon) {PrintWarning("++++++++++++\nspiral deactivated by user!!!!\n+++++++++++++++"); }
|
if (!spiralcheckon) {PrintWarning("++++++++++++\nspiral deactivated by user!!!!\n+++++++++++++++"); }
|
||||||
|
|
||||||
chartmark = 0;
|
chartmark = ChartId::INVALID;
|
||||||
outermark = 0;
|
outermark = ChartId::INVALID;
|
||||||
outertested = 0;
|
outertested = ChartId::INVALID;
|
||||||
|
|
||||||
double atlasarea = Area();
|
double atlasarea = Area();
|
||||||
double workedarea = 0;
|
double workedarea = 0;
|
||||||
double showinc = 100.*5000./(double)GetNT();
|
double showinc = 100.*5000./(double)GetNT();
|
||||||
double nextshow = 0;
|
double nextshow = 0;
|
||||||
// Point<3> startp;
|
|
||||||
int lastunmarked = 1;
|
int lastunmarked = 1;
|
||||||
|
|
||||||
PrintMessage(5,"one dot per 5000 triangles: ");
|
PrintMessage(5,"one dot per 5000 triangles: ");
|
||||||
|
|
||||||
int markedtrigcnt = 0;
|
size_t markedtrigcnt = 0;
|
||||||
while (markedtrigcnt < GetNT())
|
while (markedtrigcnt < GetNT())
|
||||||
{
|
{
|
||||||
if (multithread.terminate) { PopStatus(); return; }
|
if (multithread.terminate) { PopStatus(); return; }
|
||||||
@ -128,10 +122,8 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
|
|
||||||
SetThreadPercent(100.0 * workedarea / atlasarea);
|
SetThreadPercent(100.0 * workedarea / atlasarea);
|
||||||
|
|
||||||
STLChart * chart = new STLChart(this, stlparam);
|
atlas.Append (make_unique<STLChart> (this, stlparam));
|
||||||
atlas.Append(chart);
|
STLChart & chart = *atlas.Last();
|
||||||
|
|
||||||
// *testout << "Chart " << atlas.Size() << endl;
|
|
||||||
|
|
||||||
//find unmarked trig
|
//find unmarked trig
|
||||||
int prelastunmarked = lastunmarked;
|
int prelastunmarked = lastunmarked;
|
||||||
@ -149,29 +141,29 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
innerchartpoints.SetSize(0);
|
innerchartpoints.SetSize(0);
|
||||||
innerchartpts.SetSize(0);
|
innerchartpts.SetSize(0);
|
||||||
chartbound.Clear();
|
chartbound.Clear();
|
||||||
chartbound.SetChart(chart);
|
chartbound.SetChart(&chart);
|
||||||
|
|
||||||
chartbound.BuildSearchTree(); // different !!!
|
chartbound.BuildSearchTree(); // different !!!
|
||||||
|
|
||||||
if (!found) { PrintSysError("Make Atlas, no starttrig found"); return; }
|
if (!found) { throw Exception("Make Atlas, no starttrig found"); }
|
||||||
|
|
||||||
//find surrounding trigs
|
//find surrounding trigs
|
||||||
// int starttrig = j;
|
// int starttrig = j;
|
||||||
int starttrig = lastunmarked;
|
int starttrig = lastunmarked;
|
||||||
|
|
||||||
Point<3> startp = GetPoint(GetTriangle(starttrig).PNum(1));
|
Point<3> startp = GetPoint(GetTriangle(starttrig)[0]);
|
||||||
|
|
||||||
int accepted;
|
bool accepted;
|
||||||
int chartnum = GetNOCharts();
|
ChartId chartnum = GetNOCharts();
|
||||||
|
|
||||||
Vec<3> sn = GetTriangle(starttrig).Normal();
|
Vec<3> sn = GetTriangle(starttrig).Normal();
|
||||||
chart->SetNormal (startp, sn);
|
chart.SetNormal (startp, sn);
|
||||||
|
|
||||||
// *testout << "first trig " << starttrig << ", n = " << sn << endl;
|
// *testout << "first trig " << starttrig << ", n = " << sn << endl;
|
||||||
|
|
||||||
SetMarker(starttrig, chartnum);
|
SetMarker(starttrig, chartnum);
|
||||||
markedtrigcnt++;
|
markedtrigcnt++;
|
||||||
chart->AddChartTrig(starttrig);
|
chart.AddChartTrig(starttrig);
|
||||||
chartbound.AddTriangle(GetTriangle(starttrig));
|
chartbound.AddTriangle(GetTriangle(starttrig));
|
||||||
|
|
||||||
workedarea += GetTriangle(starttrig).Area(points);
|
workedarea += GetTriangle(starttrig).Area(points);
|
||||||
@ -195,11 +187,11 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
{
|
{
|
||||||
changed = false;
|
changed = false;
|
||||||
oldstartic2 = oldstartic;
|
oldstartic2 = oldstartic;
|
||||||
oldstartic = chart->GetNT();
|
oldstartic = chart.GetNT();
|
||||||
// for (ic = oldstartic2; ic <= chart->GetNT(); ic++)
|
// for (ic = oldstartic2; ic <= chart->GetNT(); ic++)
|
||||||
for (int ic = oldstartic2; ic <= oldstartic; ic++)
|
for (int ic = oldstartic2; ic <= oldstartic; ic++)
|
||||||
{
|
{
|
||||||
int i = chart->GetTrig(ic);
|
int i = chart.GetTrig(ic);
|
||||||
if (GetMarker(i) == chartnum)
|
if (GetMarker(i) == chartnum)
|
||||||
{
|
{
|
||||||
for (int j = 1; j <= NONeighbourTrigs(i); j++)
|
for (int j = 1; j <= NONeighbourTrigs(i); j++)
|
||||||
@ -215,7 +207,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
if ( (n2 * sn) >= coschartangle )
|
if ( (n2 * sn) >= coschartangle )
|
||||||
{
|
{
|
||||||
// *testout << "good angle " << endl;
|
// *testout << "good angle " << endl;
|
||||||
accepted = 1;
|
accepted = true;
|
||||||
/*
|
/*
|
||||||
//alter spiralentest, schnell, aber ungenau
|
//alter spiralentest, schnell, aber ungenau
|
||||||
for (k = 1; k <= 3; k++)
|
for (k = 1; k <= 3; k++)
|
||||||
@ -261,7 +253,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
Vec<3> n3 = GetTriangle(nnt).Normal();
|
Vec<3> n3 = GetTriangle(nnt).Normal();
|
||||||
if ( (n3 * sn) >= coschartangle &&
|
if ( (n3 * sn) >= coschartangle &&
|
||||||
IsSmoothEdge (nnp1, nnp2) )
|
IsSmoothEdge (nnp1, nnp2) )
|
||||||
accepted = 1;
|
accepted = true;
|
||||||
}
|
}
|
||||||
if (!accepted)
|
if (!accepted)
|
||||||
break;
|
break;
|
||||||
@ -275,7 +267,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
changed = true;
|
changed = true;
|
||||||
markedtrigcnt++;
|
markedtrigcnt++;
|
||||||
workedarea += GetTriangle(nt).Area(points);
|
workedarea += GetTriangle(nt).Area(points);
|
||||||
chart->AddChartTrig(nt);
|
chart.AddChartTrig(nt);
|
||||||
|
|
||||||
chartbound.AddTriangle(GetTriangle(nt));
|
chartbound.AddTriangle(GetTriangle(nt));
|
||||||
|
|
||||||
@ -320,11 +312,11 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
{
|
{
|
||||||
changed = false;
|
changed = false;
|
||||||
oldstartic2 = oldstartic;
|
oldstartic2 = oldstartic;
|
||||||
oldstartic = chart->GetNT();
|
oldstartic = chart.GetNT();
|
||||||
|
|
||||||
for (int ic = oldstartic2; ic <= oldstartic; ic++)
|
for (int ic = oldstartic2; ic <= oldstartic; ic++)
|
||||||
{
|
{
|
||||||
int i = chart->GetTrig(ic);
|
int i = chart.GetTrig(ic);
|
||||||
if (outermark.Get(i) != chartnum) continue;
|
if (outermark.Get(i) != chartnum) continue;
|
||||||
|
|
||||||
for (int j = 1; j <= NONeighbourTrigs(i); j++)
|
for (int j = 1; j <= NONeighbourTrigs(i); j++)
|
||||||
@ -350,7 +342,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
//abfragen, ob noch im tolerierten Winkel
|
//abfragen, ob noch im tolerierten Winkel
|
||||||
if ( (n2 * sn) >= cosouterchartangle )
|
if ( (n2 * sn) >= cosouterchartangle )
|
||||||
{
|
{
|
||||||
accepted = 1;
|
accepted = true;
|
||||||
|
|
||||||
// NgProfiler::StartTimer (timer4);
|
// NgProfiler::StartTimer (timer4);
|
||||||
bool isdirtytrig = false;
|
bool isdirtytrig = false;
|
||||||
@ -392,7 +384,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
Vec<3> n3 = GetTriangle(nnt).Normal();
|
Vec<3> n3 = GetTriangle(nnt).Normal();
|
||||||
if ( (n3 * sn) >= cosouterchartangle &&
|
if ( (n3 * sn) >= cosouterchartangle &&
|
||||||
IsSmoothEdge (nnp1, nnp2) )
|
IsSmoothEdge (nnp1, nnp2) )
|
||||||
accepted = 1;
|
accepted = true;
|
||||||
// NgProfiler::StopTimer (timer4e);
|
// NgProfiler::StopTimer (timer4e);
|
||||||
}
|
}
|
||||||
// NgProfiler::StopTimer (timer4b);
|
// NgProfiler::StopTimer (timer4b);
|
||||||
@ -411,12 +403,12 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
if (accepted)
|
if (accepted)
|
||||||
{
|
{
|
||||||
// NgProfiler::StartTimer (timer5a);
|
// NgProfiler::StartTimer (timer5a);
|
||||||
accepted = 0;
|
accepted = false;
|
||||||
|
|
||||||
for (int k = 1; k <= 3; k++)
|
for (int k = 1; k <= 3; k++)
|
||||||
if (innerpointstochart.Get(ntrig.PNum(k)) == chartnum)
|
if (innerpointstochart.Get(ntrig.PNum(k)) == chartnum)
|
||||||
{
|
{
|
||||||
accepted = 1;
|
accepted = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +437,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
double tdist = Dist2(pt, innerchartpts[l]);
|
double tdist = Dist2(pt, innerchartpts[l]);
|
||||||
if (tdist < 4 * h2)
|
if (tdist < 4 * h2)
|
||||||
{
|
{
|
||||||
accepted = 1;
|
accepted = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,7 +456,7 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
if (GetMarker(nt) != chartnum)
|
if (GetMarker(nt) != chartnum)
|
||||||
{
|
{
|
||||||
chartbound.AddTriangle(GetTriangle(nt));
|
chartbound.AddTriangle(GetTriangle(nt));
|
||||||
chart->AddOuterTrig(nt);
|
chart.AddOuterTrig(nt);
|
||||||
for (int k = 1; k <= 3; k++)
|
for (int k = 1; k <= 3; k++)
|
||||||
{
|
{
|
||||||
if (pointstochart.Get(GetTriangle(nt).PNum(k))
|
if (pointstochart.Get(GetTriangle(nt).PNum(k))
|
||||||
@ -486,26 +478,26 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
// NgProfiler::StartTimer (timere);
|
// NgProfiler::StartTimer (timere);
|
||||||
// NgProfiler::StartTimer (timere1);
|
// NgProfiler::StartTimer (timere1);
|
||||||
//end of while loop for outer chart
|
//end of while loop for outer chart
|
||||||
GetDirtyChartTrigs(chartnum, *chart, outermark, chartpointchecked, dirtycharttrigs);
|
GetDirtyChartTrigs(chartnum, chart, outermark, chartpointchecked, dirtycharttrigs);
|
||||||
//dirtycharttrigs are local (chart) point numbers!!!!!!!!!!!!!!!!
|
//dirtycharttrigs are local (chart) point numbers!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
if (dirtycharttrigs.Size() != 0 &&
|
if (dirtycharttrigs.Size() != 0 &&
|
||||||
(dirtycharttrigs.Size() != chart->GetNChartT() || dirtycharttrigs.Size() != 1))
|
(dirtycharttrigs.Size() != chart.GetNChartT() || dirtycharttrigs.Size() != 1))
|
||||||
{
|
{
|
||||||
if (dirtycharttrigs.Size() == chart->GetNChartT() && dirtycharttrigs.Size() != 1)
|
if (dirtycharttrigs.Size() == chart.GetNChartT() && dirtycharttrigs.Size() != 1)
|
||||||
{
|
{
|
||||||
//if all trigs would be eliminated -> leave 1 trig!
|
//if all trigs would be eliminated -> leave 1 trig!
|
||||||
dirtycharttrigs.SetSize(dirtycharttrigs.Size() - 1);
|
dirtycharttrigs.SetSize(dirtycharttrigs.Size() - 1);
|
||||||
}
|
}
|
||||||
for (int k = 1; k <= dirtycharttrigs.Size(); k++)
|
for (int k = 1; k <= dirtycharttrigs.Size(); k++)
|
||||||
{
|
{
|
||||||
int tn = chart->GetChartTrig(dirtycharttrigs.Get(k));
|
int tn = chart.GetChartTrig(dirtycharttrigs.Get(k));
|
||||||
outermark.Elem(tn) = 0; //not necessary, for later use
|
outermark.Elem(tn) = 0; //not necessary, for later use
|
||||||
SetMarker(tn, 0);
|
SetMarker(tn, 0);
|
||||||
markedtrigcnt--;
|
markedtrigcnt--;
|
||||||
workedarea -= GetTriangle(tn).Area(points);
|
workedarea -= GetTriangle(tn).Area(points);
|
||||||
}
|
}
|
||||||
chart->MoveToOuterChart(dirtycharttrigs);
|
chart.MoveToOuterChart(dirtycharttrigs);
|
||||||
lastunmarked = 1;
|
lastunmarked = 1;
|
||||||
lastunmarked = prelastunmarked;
|
lastunmarked = prelastunmarked;
|
||||||
}
|
}
|
||||||
@ -537,7 +529,8 @@ void STLGeometry :: MakeAtlas(Mesh & mesh, const MeshingParameters& mparam, cons
|
|||||||
|
|
||||||
int cnttrias = 0;
|
int cnttrias = 0;
|
||||||
outerchartspertrig.SetSize(GetNT());
|
outerchartspertrig.SetSize(GetNT());
|
||||||
for (int i = 1; i <= atlas.Size(); i++)
|
// for (int i = 1; i <= atlas.Size(); i++)
|
||||||
|
for (ChartId i : atlas.Range())
|
||||||
{
|
{
|
||||||
for (int j = 1; j <= GetChart(i).GetNT(); j++)
|
for (int j = 1; j <= GetChart(i).GetNT(); j++)
|
||||||
{
|
{
|
||||||
@ -633,23 +626,10 @@ int STLGeometry :: GetMarker(int i) const
|
|||||||
return chartmark.Get(i);
|
return chartmark.Get(i);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
void STLGeometry :: SetMarker(int nr, int m)
|
void STLGeometry :: SetMarker(int nr, ChartId m)
|
||||||
{
|
{
|
||||||
chartmark.Elem(nr) = m;
|
chartmark.Elem(nr) = m;
|
||||||
}
|
}
|
||||||
int STLGeometry :: GetNOCharts() const
|
|
||||||
{
|
|
||||||
return atlas.Size();
|
|
||||||
}
|
|
||||||
const STLChart& STLGeometry :: GetChart(int nr) const
|
|
||||||
{
|
|
||||||
if (nr > atlas.Size())
|
|
||||||
{
|
|
||||||
PrintSysError("GetChart(", nr, ") not possible!!!");
|
|
||||||
nr = 1;
|
|
||||||
}
|
|
||||||
return *(atlas.Get(nr));
|
|
||||||
}
|
|
||||||
|
|
||||||
int STLGeometry :: AtlasMade() const
|
int STLGeometry :: AtlasMade() const
|
||||||
{
|
{
|
||||||
@ -671,7 +651,7 @@ int AddIfNotExists(NgArray<int>& list, int x)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void STLGeometry :: GetInnerChartLimes(NgArray<twoint>& limes, int chartnum)
|
void STLGeometry :: GetInnerChartLimes(NgArray<twoint>& limes, ChartId chartnum)
|
||||||
{
|
{
|
||||||
int j, k;
|
int j, k;
|
||||||
|
|
||||||
@ -732,8 +712,8 @@ void STLGeometry :: GetInnerChartLimes(NgArray<twoint>& limes, int chartnum)
|
|||||||
|
|
||||||
|
|
||||||
void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
|
void STLGeometry :: GetDirtyChartTrigs(int chartnum, STLChart& chart,
|
||||||
const NgArray<int>& outercharttrigs,
|
const NgArray<ChartId>& outercharttrigs,
|
||||||
NgArray<int>& chartpointchecked,
|
NgArray<ChartId>& chartpointchecked,
|
||||||
NgArray<int>& dirtytrigs)
|
NgArray<int>& dirtytrigs)
|
||||||
{
|
{
|
||||||
dirtytrigs.SetSize(0);
|
dirtytrigs.SetSize(0);
|
||||||
|
@ -1116,7 +1116,7 @@ void STLGeometry :: RestrictLocalH(class Mesh & mesh, double gh, const STLParame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void STLGeometry :: RestrictHChartDistOneChart(int chartnum, NgArray<int>& acttrigs,
|
void STLGeometry :: RestrictHChartDistOneChart(ChartId chartnum, NgArray<int>& acttrigs,
|
||||||
class Mesh & mesh, double gh, double fact, double minh,
|
class Mesh & mesh, double gh, double fact, double minh,
|
||||||
const STLParameters& stlparam)
|
const STLParameters& stlparam)
|
||||||
{
|
{
|
||||||
|
@ -581,59 +581,57 @@ int STLLine :: GetRightTrig(int nr) const
|
|||||||
return righttrigs.Get(nr);
|
return righttrigs.Get(nr);
|
||||||
};
|
};
|
||||||
|
|
||||||
double STLLine :: GetSegLen(const NgArray<Point<3> >& ap, int nr) const
|
double STLLine :: GetSegLen(const Array<Point<3>,STLPointId>& ap, int nr) const
|
||||||
{
|
{
|
||||||
return Dist(ap.Get(PNum(nr)),ap.Get(PNum(nr+1)));
|
return Dist(ap[PNum(nr)],ap[PNum(nr+1)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
double STLLine :: GetLength(const NgArray<Point<3> >& ap) const
|
double STLLine :: GetLength(const Array<Point<3>,STLPointId>& ap) const
|
||||||
{
|
{
|
||||||
double len = 0;
|
double len = 0;
|
||||||
for (int i = 2; i <= pts.Size(); i++)
|
for (int i = 2; i <= pts.Size(); i++)
|
||||||
{
|
len += (ap[pts.Get(i)] - ap[pts.Get(i-1)]).Length();
|
||||||
len += (ap.Get(pts.Get(i)) - ap.Get(pts.Get(i-1))).Length();
|
|
||||||
}
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STLLine :: GetBoundingBox (const NgArray<Point<3> > & ap, Box<3> & box) const
|
void STLLine :: GetBoundingBox (const Array<Point<3>,STLPointId> & ap, Box<3> & box) const
|
||||||
{
|
{
|
||||||
box.Set (ap.Get (pts[0]));
|
box.Set (ap[pts[0]]);
|
||||||
for (int i = 1; i < pts.Size(); i++)
|
for (int i = 1; i < pts.Size(); i++)
|
||||||
box.Add (ap.Get(pts[i]));
|
box.Add (ap[pts[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Point<3> STLLine ::
|
Point<3> STLLine ::
|
||||||
GetPointInDist(const NgArray<Point<3> >& ap, double dist, int& index) const
|
GetPointInDist(const Array<Point<3>,STLPointId>& ap, double dist, int& index) const
|
||||||
{
|
{
|
||||||
if (dist <= 0)
|
if (dist <= 0)
|
||||||
{
|
{
|
||||||
index = 1;
|
index = 1;
|
||||||
return ap.Get(StartP());
|
return ap[StartP()];
|
||||||
}
|
}
|
||||||
|
|
||||||
double len = 0;
|
double len = 0;
|
||||||
int i;
|
int i;
|
||||||
for (i = 1; i < pts.Size(); i++)
|
for (i = 1; i < pts.Size(); i++)
|
||||||
{
|
{
|
||||||
double seglen = Dist (ap.Get(pts.Get(i)),
|
double seglen = Dist (ap[pts.Get(i)],
|
||||||
ap.Get(pts.Get(i+1)));
|
ap[pts.Get(i+1)]);
|
||||||
|
|
||||||
if (len + seglen > dist)
|
if (len + seglen > dist)
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
double relval = (dist - len) / (seglen + 1e-16);
|
double relval = (dist - len) / (seglen + 1e-16);
|
||||||
Vec3d v (ap.Get(pts.Get(i)), ap.Get(pts.Get(i+1)));
|
Vec3d v (ap[pts.Get(i)], ap[pts.Get(i+1)]);
|
||||||
return ap.Get(pts.Get(i)) + relval * v;
|
return ap[pts.Get(i)] + relval * v;
|
||||||
}
|
}
|
||||||
|
|
||||||
len += seglen;
|
len += seglen;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = pts.Size() - 1;
|
index = pts.Size() - 1;
|
||||||
return ap.Get(EndP());
|
return ap[EndP()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -644,7 +642,7 @@ double GetH(const Point3d& p, double x)
|
|||||||
return stlgh;//+0.5)*(x+0.5);
|
return stlgh;//+0.5)*(x+0.5);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
STLLine* STLLine :: Mesh(const NgArray<Point<3> >& ap,
|
STLLine* STLLine :: Mesh(const Array<Point<3>,STLPointId>& ap,
|
||||||
NgArray<Point3d>& mp, double ghi,
|
NgArray<Point3d>& mp, double ghi,
|
||||||
class Mesh& mesh) const
|
class Mesh& mesh) const
|
||||||
{
|
{
|
||||||
@ -720,7 +718,7 @@ STLLine* STLLine :: Mesh(const NgArray<Point<3> >& ap,
|
|||||||
int j = 1;
|
int j = 1;
|
||||||
|
|
||||||
|
|
||||||
p = ap.Get(StartP());
|
p = ap[StartP()];
|
||||||
int pn = AddPointIfNotExists(mp, p, 1e-10*diam);
|
int pn = AddPointIfNotExists(mp, p, 1e-10*diam);
|
||||||
|
|
||||||
int segn = 1;
|
int segn = 1;
|
||||||
@ -773,7 +771,7 @@ STLLine* STLLine :: Mesh(const NgArray<Point<3> >& ap,
|
|||||||
NgProfiler::StartTimer (timer3);
|
NgProfiler::StartTimer (timer3);
|
||||||
|
|
||||||
|
|
||||||
p = ap.Get(EndP());
|
p = ap[EndP()];
|
||||||
pn = AddPointIfNotExists(mp, p, 1e-10*diam);
|
pn = AddPointIfNotExists(mp, p, 1e-10*diam);
|
||||||
segn = GetNS();
|
segn = GetNS();
|
||||||
line->AddPoint(pn);
|
line->AddPoint(pn);
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
/* Date: 20. Nov. 99 */
|
/* Date: 20. Nov. 99 */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
|
namespace netgen {
|
||||||
|
|
||||||
class STLGeometry;
|
class STLGeometry;
|
||||||
class STLTopology;
|
class STLTopology;
|
||||||
|
|
||||||
@ -158,11 +160,11 @@ public:
|
|||||||
int NP() const {return pts.Size();}
|
int NP() const {return pts.Size();}
|
||||||
int GetNS() const;
|
int GetNS() const;
|
||||||
void GetSeg(int nr, int& p1, int& p2) const;
|
void GetSeg(int nr, int& p1, int& p2) const;
|
||||||
double GetSegLen(const NgArray<Point<3> >& ap, int nr) const;
|
double GetSegLen(const Array<Point<3>,STLPointId>& ap, int nr) const;
|
||||||
int GetLeftTrig(int nr) const;
|
int GetLeftTrig(int nr) const;
|
||||||
int GetRightTrig(int nr) const;
|
int GetRightTrig(int nr) const;
|
||||||
double GetDist(int nr) const { return dists.Get(nr);};
|
double GetDist(int nr) const { return dists.Get(nr);};
|
||||||
void GetBoundingBox (const NgArray<Point<3> > & ap, Box<3> & box) const;
|
void GetBoundingBox (const Array<Point<3>,STLPointId> & ap, Box<3> & box) const;
|
||||||
|
|
||||||
void AddLeftTrig(int nr) {lefttrigs.Append(nr);}
|
void AddLeftTrig(int nr) {lefttrigs.Append(nr);}
|
||||||
void AddRightTrig(int nr) {righttrigs.Append(nr);}
|
void AddRightTrig(int nr) {righttrigs.Append(nr);}
|
||||||
@ -170,14 +172,14 @@ public:
|
|||||||
int StartP() const {return pts.Get(1);}
|
int StartP() const {return pts.Get(1);}
|
||||||
int EndP() const {return pts.Get(pts.Size());}
|
int EndP() const {return pts.Get(pts.Size());}
|
||||||
|
|
||||||
double GetLength(const NgArray<Point<3> >& ap) const;
|
double GetLength(const Array<Point<3>,STLPointId>& ap) const;
|
||||||
|
|
||||||
//suche punkt in entfernung (in linienkoordinaten) dist
|
//suche punkt in entfernung (in linienkoordinaten) dist
|
||||||
//in index ist letzter punkt VOR dist (d.h. max pts.Size()-1)
|
//in index ist letzter punkt VOR dist (d.h. max pts.Size()-1)
|
||||||
Point<3> GetPointInDist(const NgArray<Point<3> >& ap, double dist, int& index) const;
|
Point<3> GetPointInDist(const Array<Point<3>,STLPointId>& ap, double dist, int& index) const;
|
||||||
|
|
||||||
//return a meshed polyline
|
//return a meshed polyline
|
||||||
STLLine* Mesh(const NgArray<Point<3> >& ap,
|
STLLine* Mesh(const Array<Point<3>,STLPointId>& ap,
|
||||||
NgArray<Point3d>& mp, double ghi,
|
NgArray<Point3d>& mp, double ghi,
|
||||||
class Mesh& mesh) const;
|
class Mesh& mesh) const;
|
||||||
|
|
||||||
@ -185,4 +187,7 @@ public:
|
|||||||
int ShouldSplit() const {return split;}
|
int ShouldSplit() const {return split;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace netgen
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -282,7 +282,7 @@ STLReadTriangle :: STLReadTriangle (const Point<3> * apts,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
STLTriangle :: STLTriangle(const int * apts)
|
STLTriangle :: STLTriangle(const STLPointId * apts)
|
||||||
{
|
{
|
||||||
pts[0] = apts[0];
|
pts[0] = apts[0];
|
||||||
pts[1] = apts[1];
|
pts[1] = apts[1];
|
||||||
@ -349,11 +349,11 @@ int STLTriangle :: GetNeighbourPointsAndOpposite(const STLTriangle& t, int& p1,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec<3> STLTriangle :: GeomNormal(const NgArray<Point<3> >& ap) const
|
Vec<3> STLTriangle :: GeomNormal(const Array<Point<3>,STLPointId>& ap) const
|
||||||
{
|
{
|
||||||
const Point<3> & p1 = ap.Get(PNum(1));
|
const Point<3> & p1 = ap[PNum(1)];
|
||||||
const Point<3> & p2 = ap.Get(PNum(2));
|
const Point<3> & p2 = ap[PNum(2)];
|
||||||
const Point<3> & p3 = ap.Get(PNum(3));
|
const Point<3> & p3 = ap[PNum(3)];
|
||||||
|
|
||||||
return Cross(p2-p1, p3-p1);
|
return Cross(p2-p1, p3-p1);
|
||||||
}
|
}
|
||||||
@ -382,13 +382,13 @@ void STLTriangle :: ChangeOrientation()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
double STLTriangle :: Area(const NgArray<Point<3> >& ap) const
|
double STLTriangle :: Area(const Array<Point<3>,STLPointId>& ap) const
|
||||||
{
|
{
|
||||||
return 0.5 * Cross(ap.Get(PNum(2))-ap.Get(PNum(1)),
|
return 0.5 * Cross(ap[PNum(2)]-ap[PNum(1)],
|
||||||
ap.Get(PNum(3))-ap.Get(PNum(1))).Length();
|
ap[PNum(3)]-ap[PNum(1)]).Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
double STLTriangle :: MinHeight(const NgArray<Point<3> >& ap) const
|
double STLTriangle :: MinHeight(const Array<Point<3>,STLPointId>& ap) const
|
||||||
{
|
{
|
||||||
double ml = MaxLength(ap);
|
double ml = MaxLength(ap);
|
||||||
if (ml != 0) {return 2.*Area(ap)/ml;}
|
if (ml != 0) {return 2.*Area(ap)/ml;}
|
||||||
@ -396,19 +396,19 @@ double STLTriangle :: MinHeight(const NgArray<Point<3> >& ap) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double STLTriangle :: MaxLength(const NgArray<Point<3> >& ap) const
|
double STLTriangle :: MaxLength(const Array<Point<3>,STLPointId>& ap) const
|
||||||
{
|
{
|
||||||
return max3(Dist(ap.Get(PNum(1)),ap.Get(PNum(2))),
|
return max3(Dist(ap[PNum(1)],ap[PNum(2)]),
|
||||||
Dist(ap.Get(PNum(2)),ap.Get(PNum(3))),
|
Dist(ap[PNum(2)],ap[PNum(3)]),
|
||||||
Dist(ap.Get(PNum(3)),ap.Get(PNum(1))));
|
Dist(ap[PNum(3)],ap[PNum(1)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void STLTriangle :: ProjectInPlain(const NgArray<Point<3> >& ap,
|
void STLTriangle :: ProjectInPlain(const Array<Point<3>,STLPointId>& ap,
|
||||||
const Vec<3> & n, Point<3> & pp) const
|
const Vec<3> & n, Point<3> & pp) const
|
||||||
{
|
{
|
||||||
const Point<3> & p1 = ap.Get(PNum(1));
|
const Point<3> & p1 = ap[PNum(1)];
|
||||||
const Point<3> & p2 = ap.Get(PNum(2));
|
const Point<3> & p2 = ap[PNum(2)];
|
||||||
const Point<3> & p3 = ap.Get(PNum(3));
|
const Point<3> & p3 = ap[PNum(3)];
|
||||||
|
|
||||||
Vec<3> v1 = p2 - p1;
|
Vec<3> v1 = p2 - p1;
|
||||||
Vec<3> v2 = p3 - p1;
|
Vec<3> v2 = p3 - p1;
|
||||||
@ -430,13 +430,13 @@ void STLTriangle :: ProjectInPlain(const NgArray<Point<3> >& ap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int STLTriangle :: ProjectInPlain (const NgArray<Point<3> >& ap,
|
int STLTriangle :: ProjectInPlain (const Array<Point<3>,STLPointId>& ap,
|
||||||
const Vec<3> & nproj,
|
const Vec<3> & nproj,
|
||||||
Point<3> & pp, Vec<3> & lam) const
|
Point<3> & pp, Vec<3> & lam) const
|
||||||
{
|
{
|
||||||
const Point<3> & p1 = ap.Get(PNum(1));
|
const Point<3> & p1 = ap[PNum(1)];
|
||||||
const Point<3> & p2 = ap.Get(PNum(2));
|
const Point<3> & p2 = ap[PNum(2)];
|
||||||
const Point<3> & p3 = ap.Get(PNum(3));
|
const Point<3> & p3 = ap[PNum(3)];
|
||||||
|
|
||||||
Vec<3> v1 = p2-p1;
|
Vec<3> v1 = p2-p1;
|
||||||
Vec<3> v2 = p3-p1;
|
Vec<3> v2 = p3-p1;
|
||||||
@ -468,12 +468,12 @@ int STLTriangle :: ProjectInPlain (const NgArray<Point<3> >& ap,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void STLTriangle :: ProjectInPlain(const NgArray<Point<3> >& ap,
|
void STLTriangle :: ProjectInPlain(const Array<Point<3>,STLPointId>& ap,
|
||||||
Point<3> & pp) const
|
Point<3> & pp) const
|
||||||
{
|
{
|
||||||
const Point<3> & p1 = ap.Get(PNum(1));
|
const Point<3> & p1 = ap[PNum(1)];
|
||||||
const Point<3> & p2 = ap.Get(PNum(2));
|
const Point<3> & p2 = ap[PNum(2)];
|
||||||
const Point<3> & p3 = ap.Get(PNum(3));
|
const Point<3> & p3 = ap[PNum(3)];
|
||||||
|
|
||||||
Vec<3> v1 = p2 - p1;
|
Vec<3> v1 = p2 - p1;
|
||||||
Vec<3> v2 = p3 - p1;
|
Vec<3> v2 = p3 - p1;
|
||||||
@ -488,12 +488,12 @@ void STLTriangle :: ProjectInPlain(const NgArray<Point<3> >& ap,
|
|||||||
pp = pp + (nfact) * nt;
|
pp = pp + (nfact) * nt;
|
||||||
}
|
}
|
||||||
|
|
||||||
int STLTriangle :: PointInside(const NgArray<Point<3> > & ap,
|
int STLTriangle :: PointInside(const Array<Point<3>,STLPointId> & ap,
|
||||||
const Point<3> & pp) const
|
const Point<3> & pp) const
|
||||||
{
|
{
|
||||||
const Point<3> & p1 = ap.Get(PNum(1));
|
const Point<3> & p1 = ap[PNum(1)];
|
||||||
const Point<3> & p2 = ap.Get(PNum(2));
|
const Point<3> & p2 = ap[PNum(2)];
|
||||||
const Point<3> & p3 = ap.Get(PNum(3));
|
const Point<3> & p3 = ap[PNum(3)];
|
||||||
|
|
||||||
Vec<3> v1 = p2 - p1;
|
Vec<3> v1 = p2 - p1;
|
||||||
Vec<3> v2 = p3 - p1;
|
Vec<3> v2 = p3 - p1;
|
||||||
@ -532,7 +532,7 @@ int STLTriangle :: PointInside(const NgArray<Point<3> > & ap,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double STLTriangle :: GetNearestPoint(const NgArray<Point<3> >& ap,
|
double STLTriangle :: GetNearestPoint(const Array<Point<3>,STLPointId>& ap,
|
||||||
Point<3> & p3d) const
|
Point<3> & p3d) const
|
||||||
{
|
{
|
||||||
Point<3> p = p3d;
|
Point<3> p = p3d;
|
||||||
@ -548,7 +548,7 @@ double STLTriangle :: GetNearestPoint(const NgArray<Point<3> >& ap,
|
|||||||
for (int j = 1; j <= 3; j++)
|
for (int j = 1; j <= 3; j++)
|
||||||
{
|
{
|
||||||
p = p3d;
|
p = p3d;
|
||||||
dist = GetDistFromLine(ap.Get(PNum(j)), ap.Get(PNumMod(j+1)), p);
|
dist = GetDistFromLine(ap[PNum(j)], ap[PNumMod(j+1)], p);
|
||||||
if (dist < nearest)
|
if (dist < nearest)
|
||||||
{
|
{
|
||||||
nearest = dist;
|
nearest = dist;
|
||||||
@ -690,15 +690,15 @@ void STLChart :: AddOuterTrig(int i)
|
|||||||
{searchtree->Insert (pmin, pmax, i);}
|
{searchtree->Insert (pmin, pmax, i);}
|
||||||
}
|
}
|
||||||
|
|
||||||
int STLChart :: IsInWholeChart(int nr) const
|
bool STLChart :: IsInWholeChart(int nr) const
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= charttrigs.Size(); i++)
|
for (int i = 1; i <= charttrigs.Size(); i++)
|
||||||
if (charttrigs.Get(i) == nr) return 1;
|
if (charttrigs.Get(i) == nr) return true;
|
||||||
|
|
||||||
for (int i = 1; i <= outertrigs.Size(); i++)
|
for (int i = 1; i <= outertrigs.Size(); i++)
|
||||||
if (outertrigs.Get(i) == nr) return 1;
|
if (outertrigs.Get(i) == nr) return true;
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STLChart :: GetTrianglesInBox (const Point3d & pmin,
|
void STLChart :: GetTrianglesInBox (const Point3d & pmin,
|
||||||
@ -1040,8 +1040,8 @@ void STLBoundary ::AddTriangle(const STLTriangle & t)
|
|||||||
// NgProfiler::StopTimer (timer_new);
|
// NgProfiler::StopTimer (timer_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
int STLBoundary :: TestSeg(const Point<3>& p1, const Point<3> & p2, const Vec<3> & sn,
|
bool STLBoundary :: TestSeg(const Point<3>& p1, const Point<3> & p2, const Vec<3> & sn,
|
||||||
double sinchartangle, int divisions, NgArray<Point<3> >& points, double eps)
|
double sinchartangle, int divisions, Array<Point<3>,STLPointId>& points, double eps)
|
||||||
{
|
{
|
||||||
if (usechartnormal)
|
if (usechartnormal)
|
||||||
return TestSegChartNV (p1, p2, sn);
|
return TestSegChartNV (p1, p2, sn);
|
||||||
@ -1276,7 +1276,7 @@ void STLBoundary :: DeleteSearchTree()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checks, whether 2d projection intersects
|
// checks, whether 2d projection intersects
|
||||||
int STLBoundary :: TestSegChartNV(const Point3d & p1, const Point3d& p2,
|
bool STLBoundary :: TestSegChartNV(const Point3d & p1, const Point3d& p2,
|
||||||
const Vec3d& sn)
|
const Vec3d& sn)
|
||||||
{
|
{
|
||||||
// static int timerquick = NgProfiler::CreateTimer ("TestSegChartNV-searchtree");
|
// static int timerquick = NgProfiler::CreateTimer ("TestSegChartNV-searchtree");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef FILE_STLTOOL
|
#ifndef FILE_STLTOOL
|
||||||
#define FILE_STLTOOL
|
#define FILE_STLTOOL
|
||||||
|
|
||||||
|
|
||||||
//#include "gprim/gprim.hh"
|
//#include "gprim/gprim.hh"
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
@ -11,7 +10,7 @@
|
|||||||
/* Date: 20. Nov. 99 */
|
/* Date: 20. Nov. 99 */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
|
namespace netgen {
|
||||||
|
|
||||||
// use one normal vector for whole chart
|
// use one normal vector for whole chart
|
||||||
extern int usechartnormal;
|
extern int usechartnormal;
|
||||||
@ -40,6 +39,32 @@ typedef NgArray <int> * ArrayINTPTR;
|
|||||||
class STLGeometry;
|
class STLGeometry;
|
||||||
class STLParameters;
|
class STLParameters;
|
||||||
|
|
||||||
|
// typedef int ChartId
|
||||||
|
class ChartId
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
public:
|
||||||
|
class t_invalid { public: constexpr t_invalid() = default; };
|
||||||
|
static constexpr t_invalid INVALID{};
|
||||||
|
|
||||||
|
ChartId() { }
|
||||||
|
constexpr ChartId(t_invalid inv) : i(0) { ; }
|
||||||
|
constexpr ChartId(int ai) : i(ai) { }
|
||||||
|
operator int() const { return i; }
|
||||||
|
ChartId operator++ (int) { ChartId hi(*this); i++; return hi; }
|
||||||
|
ChartId & operator++ () { i++; return *this; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ngcore
|
||||||
|
{
|
||||||
|
template<>
|
||||||
|
constexpr netgen::ChartId IndexBASE<netgen::ChartId> () { return netgen::ChartId(1); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace netgen {
|
||||||
|
|
||||||
class STLChart
|
class STLChart
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -60,7 +85,7 @@ public:
|
|||||||
void AddChartTrig(int i);
|
void AddChartTrig(int i);
|
||||||
void AddOuterTrig(int i);
|
void AddOuterTrig(int i);
|
||||||
|
|
||||||
int IsInWholeChart(int nr) const;
|
bool IsInWholeChart(int nr) const;
|
||||||
|
|
||||||
int GetChartTrig(int i) const {return charttrigs.Get(i);}
|
int GetChartTrig(int i) const {return charttrigs.Get(i);}
|
||||||
int GetOuterTrig(int i) const {return outertrigs.Get(i);}
|
int GetOuterTrig(int i) const {return outertrigs.Get(i);}
|
||||||
@ -118,13 +143,13 @@ class STLBoundarySeg
|
|||||||
// Point<2> p2dmin, p2dmax;
|
// Point<2> p2dmin, p2dmax;
|
||||||
|
|
||||||
double rad;
|
double rad;
|
||||||
int i1, i2;
|
STLPointId i1, i2;
|
||||||
int smoothedge;
|
int smoothedge;
|
||||||
public:
|
public:
|
||||||
STLBoundarySeg () { ; }
|
STLBoundarySeg () { ; }
|
||||||
STLBoundarySeg (int ai1, int ai2, const NgArray<Point<3> > & points,
|
STLBoundarySeg (STLPointId ai1, STLPointId ai2, const Array<Point<3>,STLPointId> & points,
|
||||||
const STLChart * chart)
|
const STLChart * chart)
|
||||||
: p1(points.Get(ai1)), p2(points.Get(ai2)),
|
: p1(points[ai1]), p2(points[ai2]),
|
||||||
i1(ai1), i2(ai2)
|
i1(ai1), i2(ai2)
|
||||||
{
|
{
|
||||||
center = ::netgen::Center (p1, p2);
|
center = ::netgen::Center (p1, p2);
|
||||||
@ -182,11 +207,11 @@ public:
|
|||||||
|
|
||||||
void BuildSearchTree();
|
void BuildSearchTree();
|
||||||
void DeleteSearchTree();
|
void DeleteSearchTree();
|
||||||
int TestSeg(const Point<3> & p1, const Point<3> & p2, const Vec<3> & sn,
|
bool TestSeg(const Point<3> & p1, const Point<3> & p2, const Vec<3> & sn,
|
||||||
double sinchartangle, int divisions, NgArray<Point<3> >& points,
|
double sinchartangle, int divisions, Array<Point<3>,STLPointId>& points,
|
||||||
double eps);
|
double eps);
|
||||||
|
|
||||||
int TestSegChartNV(const Point3d& p1, const Point3d& p2, const Vec3d& sn);
|
bool TestSegChartNV(const Point3d& p1, const Point3d& p2, const Vec3d& sn);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -292,6 +317,6 @@ void STLSurfaceOptimization (STLGeometry & geom,
|
|||||||
const MeshingParameters & mparam);
|
const MeshingParameters & mparam);
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace netgen
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -515,9 +515,9 @@ void STLTopology :: InitSTLGeometry(const NgArray<STLReadTriangle> & readtrigs)
|
|||||||
foundpos = AddPoint(p);
|
foundpos = AddPoint(p);
|
||||||
pointtree->Insert (p, foundpos);
|
pointtree->Insert (p, foundpos);
|
||||||
}
|
}
|
||||||
if (Dist(p, points.Get(foundpos)) > 1e-10)
|
if (Dist(p, points[foundpos]) > 1e-10)
|
||||||
cout << "identify close points: " << p << " " << points.Get(foundpos)
|
cout << "identify close points: " << p << " " << points[foundpos]
|
||||||
<< ", dist = " << Dist(p, points.Get(foundpos))
|
<< ", dist = " << Dist(p, points[foundpos])
|
||||||
<< endl;
|
<< endl;
|
||||||
st[k] = foundpos;
|
st[k] = foundpos;
|
||||||
}
|
}
|
||||||
@ -711,14 +711,14 @@ void STLTopology :: FindNeighbourTrigs()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (STLTrigIndex ti = 0; ti < GetNT(); ti++)
|
for (STLTrigId ti = 0; ti < GetNT(); ti++)
|
||||||
{
|
{
|
||||||
STLTriangle & trig = trias[ti];
|
STLTriangle & trig = trias[ti];
|
||||||
for (int k = 0; k < 3; k++)
|
for (int k = 0; k < 3; k++)
|
||||||
{
|
{
|
||||||
STLPointIndex pi = trig[k] - STLBASE;
|
STLPointId pi = trig[k]; // - STLBASE;
|
||||||
STLPointIndex pi2 = trig[(k+1)%3] - STLBASE;
|
STLPointId pi2 = trig[(k+1)%3]; // - STLBASE;
|
||||||
STLPointIndex pi3 = trig[(k+2)%3] - STLBASE;
|
STLPointId pi3 = trig[(k+2)%3]; // - STLBASE;
|
||||||
|
|
||||||
// vector along edge
|
// vector along edge
|
||||||
Vec<3> ve = points[pi2] - points[pi];
|
Vec<3> ve = points[pi2] - points[pi];
|
||||||
@ -736,24 +736,24 @@ void STLTopology :: FindNeighbourTrigs()
|
|||||||
|
|
||||||
for (int j = 0; j < trigsperpoint[pi].Size(); j++)
|
for (int j = 0; j < trigsperpoint[pi].Size(); j++)
|
||||||
{
|
{
|
||||||
STLTrigIndex ti2 = trigsperpoint[pi][j] - STLBASE;
|
STLTrigId ti2 = trigsperpoint[pi][j]; // - STLBASE;
|
||||||
const STLTriangle & trig2 = trias[ti2];
|
const STLTriangle & trig2 = trias[ti2];
|
||||||
|
|
||||||
if (ti == ti2) continue;
|
if (ti == ti2) continue;
|
||||||
|
|
||||||
bool hasboth = 0;
|
bool hasboth = 0;
|
||||||
for (int l = 0; l < 3; l++)
|
for (int l = 0; l < 3; l++)
|
||||||
if (trig2[l] - STLBASE == pi2)
|
if (trig2[l] /* - STLBASE */ == pi2)
|
||||||
{
|
{
|
||||||
hasboth = 1;
|
hasboth = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!hasboth) continue;
|
if (!hasboth) continue;
|
||||||
|
|
||||||
STLPointIndex pi4(0);
|
STLPointId pi4(0);
|
||||||
for (int l = 0; l < 3; l++)
|
for (int l = 0; l < 3; l++)
|
||||||
if (trig2[l] - STLBASE != pi && trig2[l] - STLBASE != pi2)
|
if (trig2[l] /* - STLBASE */ != pi && trig2[l] /* - STLBASE */ != pi2)
|
||||||
pi4 = trig2[l] - STLBASE;
|
pi4 = trig2[l] /* - STLBASE */;
|
||||||
|
|
||||||
Vec<3> vt2 = points[pi4] - points[pi];
|
Vec<3> vt2 = points[pi4] - points[pi];
|
||||||
|
|
||||||
@ -763,12 +763,12 @@ void STLTopology :: FindNeighbourTrigs()
|
|||||||
if (phi < phimin)
|
if (phi < phimin)
|
||||||
{
|
{
|
||||||
phimin = phi;
|
phimin = phi;
|
||||||
trig.NBTrig (0, (k+2)%3) = ti2 + STLBASE;
|
trig.NBTrig (0, (k+2)%3) = ti2; // + STLBASE;
|
||||||
}
|
}
|
||||||
if (phi > phimax)
|
if (phi > phimax)
|
||||||
{
|
{
|
||||||
phimax = phi;
|
phimax = phi;
|
||||||
trig.NBTrig (1, (k+2)%3) = ti2 + STLBASE;
|
trig.NBTrig (1, (k+2)%3) = ti2; // + STLBASE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,41 +14,58 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
namespace netgen {
|
||||||
|
|
||||||
class STLGeometry;
|
class STLGeometry;
|
||||||
|
|
||||||
#define STLBASE 1
|
// #define STLBASE 1
|
||||||
|
|
||||||
class STLPointIndex
|
class STLPointId
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
public:
|
public:
|
||||||
STLPointIndex () { ; }
|
STLPointId () { ; }
|
||||||
STLPointIndex (int ai) : i(ai) { ; }
|
constexpr STLPointId (int ai) : i(ai) { ; }
|
||||||
STLPointIndex & operator= (const STLPointIndex & ai) { i = ai.i; return *this; }
|
STLPointId & operator= (const STLPointId & ai) { i = ai.i; return *this; }
|
||||||
STLPointIndex & operator= (int ai) { i = ai; return *this; }
|
STLPointId & operator= (int ai) { i = ai; return *this; }
|
||||||
operator int () const { return i; }
|
operator int () const { return i; }
|
||||||
STLPointIndex operator++ (int) { return i++; }
|
STLPointId operator++ (int) { return i++; }
|
||||||
STLPointIndex operator-- (int) { return i--; }
|
STLPointId operator-- (int) { return i--; }
|
||||||
|
|
||||||
|
void DoArchive(Archive& ar) { ar & i; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class STLTrigIndex
|
class STLTrigId
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
public:
|
public:
|
||||||
STLTrigIndex () { ; }
|
STLTrigId () { ; }
|
||||||
STLTrigIndex (int ai) : i(ai) { ; }
|
constexpr STLTrigId (int ai) : i(ai) { ; }
|
||||||
STLTrigIndex & operator= (const STLTrigIndex & ai) { i = ai.i; return *this; }
|
STLTrigId & operator= (const STLTrigId & ai) { i = ai.i; return *this; }
|
||||||
STLTrigIndex & operator= (int ai) { i = ai; return *this; }
|
STLTrigId & operator= (int ai) { i = ai; return *this; }
|
||||||
operator int () const { return i; }
|
operator int () const { return i; }
|
||||||
STLTrigIndex operator++ (int) { return i++; }
|
STLTrigId operator++ (int) { return i++; }
|
||||||
STLTrigIndex operator-- (int) { return i--; }
|
STLTrigId operator-- (int) { return i--; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace ngcore
|
||||||
|
{
|
||||||
|
template<>
|
||||||
|
constexpr netgen::STLPointId IndexBASE<netgen::STLPointId> () { return netgen::STLPointId(1); }
|
||||||
|
template<>
|
||||||
|
constexpr netgen::STLTrigId IndexBASE<netgen::STLTrigId> () { return netgen::STLTrigId(1); }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace netgen {
|
||||||
|
|
||||||
|
|
||||||
// triangle structure for loading stl files
|
// triangle structure for loading stl files
|
||||||
class STLReadTriangle
|
class STLReadTriangle
|
||||||
@ -73,7 +90,7 @@ class STLTriangle
|
|||||||
// normalized stored normal vector ??
|
// normalized stored normal vector ??
|
||||||
Vec<3> normal;
|
Vec<3> normal;
|
||||||
// point numbers of triangle
|
// point numbers of triangle
|
||||||
int pts[3];
|
STLPointId pts[3];
|
||||||
// front-side and back-side domains
|
// front-side and back-side domains
|
||||||
int domains[2];
|
int domains[2];
|
||||||
|
|
||||||
@ -93,22 +110,23 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
STLTriangle (const int * apts);
|
STLTriangle (const STLPointId * apts);
|
||||||
STLTriangle () {pts[0]=0;pts[1]=0;pts[2]=0;}
|
STLTriangle () {pts[0]=0;pts[1]=0;pts[2]=0;}
|
||||||
|
|
||||||
void DoArchive(Archive& ar)
|
void DoArchive(Archive& ar)
|
||||||
{
|
{
|
||||||
ar.Do(&topedges[0],3);
|
ar.Do(&topedges[0],3);
|
||||||
ar.Do(&nbtrigs[0][0], 6);
|
ar.Do(&nbtrigs[0][0], 6);
|
||||||
ar.Do(&pts[0],3);
|
// ar.Do(&pts[0],3);
|
||||||
|
ar & pts[0] & pts[1] & pts[2];
|
||||||
ar.Do(&domains[0],2);
|
ar.Do(&domains[0],2);
|
||||||
size_t i = flags.toperror;
|
size_t i = flags.toperror;
|
||||||
ar & normal & box & center & rad & facenum & i;
|
ar & normal & box & center & rad & facenum & i;
|
||||||
flags.toperror = i;
|
flags.toperror = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int operator[] (int i) const { return pts[i]; }
|
STLPointId operator[] (int i) const { return pts[i]; }
|
||||||
int & operator[] (int i) { return pts[i]; }
|
STLPointId & operator[] (int i) { return pts[i]; }
|
||||||
|
|
||||||
int EdgeNum(int i) const { return topedges[(i-1)]; }
|
int EdgeNum(int i) const { return topedges[(i-1)]; }
|
||||||
int & EdgeNum(int i) { return topedges[(i-1)]; }
|
int & EdgeNum(int i) { return topedges[(i-1)]; }
|
||||||
@ -123,10 +141,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// obsolete:
|
// obsolete:
|
||||||
int PNum(int i) const { return pts[(i-1)]; }
|
STLPointId PNum(int i) const { return pts[(i-1)]; }
|
||||||
int & PNum(int i) { return pts[(i-1)]; }
|
STLPointId & PNum(int i) { return pts[(i-1)]; }
|
||||||
int PNumMod(int i) const { return pts[(i-1)%3]; }
|
STLPointId PNumMod(int i) const { return pts[(i-1)%3]; }
|
||||||
int & PNumMod(int i) { return pts[(i-1)%3]; }
|
STLPointId & PNumMod(int i) { return pts[(i-1)%3]; }
|
||||||
|
|
||||||
int EdgeNumMod(int i) const { return topedges[(i-1)%3]; }
|
int EdgeNumMod(int i) const { return topedges[(i-1)%3]; }
|
||||||
int & EdgeNumMod(int i) { return topedges[(i-1)%3]; }
|
int & EdgeNumMod(int i) { return topedges[(i-1)%3]; }
|
||||||
@ -149,7 +167,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// NON-normalized geometry - normal vector
|
// NON-normalized geometry - normal vector
|
||||||
Vec<3> GeomNormal(const NgArray<Point<3> >& ap) const;
|
Vec<3> GeomNormal(const Array<Point<3>,STLPointId>& ap) const;
|
||||||
|
|
||||||
// Stored normal vector, normalized
|
// Stored normal vector, normalized
|
||||||
void SetNormal (const Vec<3> & n);
|
void SetNormal (const Vec<3> & n);
|
||||||
@ -159,10 +177,10 @@ public:
|
|||||||
void ChangeOrientation();
|
void ChangeOrientation();
|
||||||
|
|
||||||
//project with a certain normal vector in plane
|
//project with a certain normal vector in plane
|
||||||
void ProjectInPlain(const NgArray<Point<3> >& ap,
|
void ProjectInPlain(const Array<Point<3>, STLPointId>& ap,
|
||||||
const Vec<3> & n, Point<3> & pp) const;
|
const Vec<3> & n, Point<3> & pp) const;
|
||||||
//project with the triangle's normal vector in plane
|
//project with the triangle's normal vector in plane
|
||||||
void ProjectInPlain(const NgArray<Point<3> > & ap, Point<3> & pp) const;
|
void ProjectInPlain(const Array<Point<3>, STLPointId> & ap, Point<3> & pp) const;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -177,20 +195,20 @@ public:
|
|||||||
|
|
||||||
pp(output) = P1 + lam1 v1 + lam2 v2
|
pp(output) = P1 + lam1 v1 + lam2 v2
|
||||||
*/
|
*/
|
||||||
int ProjectInPlain (const NgArray<Point<3> >& ap,
|
int ProjectInPlain (const Array<Point<3>,STLPointId>& ap,
|
||||||
const Vec<3> & nproj,
|
const Vec<3> & nproj,
|
||||||
Point<3> & pp, Vec<3> & lam) const;
|
Point<3> & pp, Vec<3> & lam) const;
|
||||||
|
|
||||||
int PointInside(const NgArray<Point<3> >& ap, const Point<3> & pp) const;
|
int PointInside(const Array<Point<3>,STLPointId>& ap, const Point<3> & pp) const;
|
||||||
|
|
||||||
//get nearest point on triangle and distance to it
|
//get nearest point on triangle and distance to it
|
||||||
double GetNearestPoint(const NgArray<Point<3> >& ap,
|
double GetNearestPoint(const Array<Point<3>,STLPointId>& ap,
|
||||||
Point<3> & p3d) const;
|
Point<3> & p3d) const;
|
||||||
|
|
||||||
double Area(const NgArray<Point<3> >& ap) const;
|
double Area(const Array<Point<3>,STLPointId>& ap) const;
|
||||||
|
|
||||||
double MinHeight(const NgArray<Point<3> >& ap) const;
|
double MinHeight(const Array<Point<3>,STLPointId>& ap) const;
|
||||||
double MaxLength(const NgArray<Point<3> >& ap) const;
|
double MaxLength(const Array<Point<3>,STLPointId>& ap) const;
|
||||||
//max length of a side of triangle
|
//max length of a side of triangle
|
||||||
|
|
||||||
int GetFaceNum() {return facenum;}
|
int GetFaceNum() {return facenum;}
|
||||||
@ -250,9 +268,9 @@ ostream& operator<<(ostream& os, const STLTriangle& t);
|
|||||||
class STLTopology
|
class STLTopology
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
NgArray<STLTriangle> trias;
|
Array<STLTriangle, STLTrigId> trias;
|
||||||
NgArray<STLTopEdge> topedges;
|
NgArray<STLTopEdge> topedges;
|
||||||
NgArray<Point<3> > points;
|
Array<Point<3>, STLPointId> points;
|
||||||
|
|
||||||
// mapping of sorted pair of points to topedge
|
// mapping of sorted pair of points to topedge
|
||||||
INDEX_2_HASHTABLE<int> * ht_topedges;
|
INDEX_2_HASHTABLE<int> * ht_topedges;
|
||||||
@ -312,24 +330,24 @@ 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.Get(nr); }
|
const Point<3> & GetPoint(int 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.Elem(nr) = p; }
|
void SetPoint(int nr, const Point<3> & p) { points[nr] = p; } // { points.Elem(nr) = p; }
|
||||||
const NgArray<Point<3> >& GetPoints() const { return points; }
|
auto & GetPoints() const { return points; }
|
||||||
|
|
||||||
const Point<3> & operator[] (STLPointIndex i) const { return points[i]; }
|
const Point<3> & operator[] (STLPointId i) const { return points[i]; }
|
||||||
Point<3> & operator[] (STLPointIndex i) { return points[i]; }
|
Point<3> & operator[] (STLPointId i) { return points[i]; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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.Get(nr); }
|
const STLTriangle & GetTriangle (int nr) const { return trias[nr]; } // .Get(nr); }
|
||||||
STLTriangle & GetTriangle (int nr) { return trias.Elem(nr); }
|
STLTriangle & GetTriangle (int nr) { return trias[nr]; } // .Elem(nr); }
|
||||||
|
|
||||||
const STLTriangle & operator[] (STLTrigIndex i) const { return trias[i]; }
|
const STLTriangle & operator[] (STLTrigId i) const { return trias[i]; }
|
||||||
STLTriangle & operator[] (STLTrigIndex i) { return trias[i]; }
|
STLTriangle & operator[] (STLTrigId i) { return trias[i]; }
|
||||||
|
|
||||||
|
|
||||||
int GetNTE() const { return topedges.Size(); }
|
int GetNTE() const { return topedges.Size(); }
|
||||||
@ -376,5 +394,6 @@ public:
|
|||||||
const Box<3> & GetBoundingBox () const { return boundingbox; }
|
const Box<3> & GetBoundingBox () const { return boundingbox; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace netgen
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user