mirror of
https://github.com/NGSolve/netgen.git
synced 2025-04-08 22:37:28 +05:00
changed starting edge for smooth faces (for proteins)
This commit is contained in:
parent
a446812c6a
commit
58cfeebca8
@ -2361,11 +2361,8 @@ void STLGeometry :: BuildEdges()
|
|||||||
|
|
||||||
void STLGeometry :: UseExternalEdges()
|
void STLGeometry :: UseExternalEdges()
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 1; i <= NOExternalEdges(); i++)
|
||||||
for (i = 1; i <= NOExternalEdges(); i++)
|
AddEdge(GetExternalEdge(i).i1,GetExternalEdge(i).i2);
|
||||||
{
|
|
||||||
AddEdge(GetExternalEdge(i).i1,GetExternalEdge(i).i2);
|
|
||||||
}
|
|
||||||
//BuildEdgesPerPointy();
|
//BuildEdgesPerPointy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2493,8 +2490,7 @@ void STLGeometry :: FindEdgesFromAngles()
|
|||||||
|
|
||||||
if (calcedgedataanglesnew) {CalcEdgeDataAngles(); calcedgedataanglesnew = 0;}
|
if (calcedgedataanglesnew) {CalcEdgeDataAngles(); calcedgedataanglesnew = 0;}
|
||||||
|
|
||||||
int i;
|
for (int i = 1; i <= edgedata->Size(); i++)
|
||||||
for (i = 1; i <= edgedata->Size(); i++)
|
|
||||||
{
|
{
|
||||||
STLTopEdge & sed = edgedata->Elem(i);
|
STLTopEdge & sed = edgedata->Elem(i);
|
||||||
if (sed.GetStatus() == ED_CANDIDATE ||
|
if (sed.GetStatus() == ED_CANDIDATE ||
|
||||||
@ -2520,7 +2516,7 @@ void STLGeometry :: FindEdgesFromAngles()
|
|||||||
its++;
|
its++;
|
||||||
//(*mycout) << "." << flush;
|
//(*mycout) << "." << flush;
|
||||||
changed = 0;
|
changed = 0;
|
||||||
for (i = 1; i <= edgedata->Size(); i++)
|
for (int i = 1; i <= edgedata->Size(); i++)
|
||||||
{
|
{
|
||||||
STLTopEdge & sed = edgedata->Elem(i);
|
STLTopEdge & sed = edgedata->Elem(i);
|
||||||
if (sed.CosAngle() <= cos_cont_min_edge_angle
|
if (sed.CosAngle() <= cos_cont_min_edge_angle
|
||||||
@ -2541,7 +2537,7 @@ void STLGeometry :: FindEdgesFromAngles()
|
|||||||
confcand = 1;
|
confcand = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i <= edgedata->Size(); i++)
|
for (int i = 1; i <= edgedata->Size(); i++)
|
||||||
{
|
{
|
||||||
STLTopEdge & sed = edgedata->Elem(i);
|
STLTopEdge & sed = edgedata->Elem(i);
|
||||||
if (sed.GetStatus() == ED_CONFIRMED ||
|
if (sed.GetStatus() == ED_CONFIRMED ||
|
||||||
@ -2625,8 +2621,7 @@ void STLGeometry :: BuildEdgesPerPoint()
|
|||||||
edgesperpoint.SetSize(GetNP());
|
edgesperpoint.SetSize(GetNP());
|
||||||
|
|
||||||
//add edges to points
|
//add edges to points
|
||||||
int i;
|
for (int i = 1; i <= GetNE(); i++)
|
||||||
for (i = 1; i <= GetNE(); i++)
|
|
||||||
{
|
{
|
||||||
//(*mycout) << "EDGE " << GetEdge(i).PNum(1) << " - " << GetEdge(i).PNum(2) << endl;
|
//(*mycout) << "EDGE " << GetEdge(i).PNum(1) << " - " << GetEdge(i).PNum(2) << endl;
|
||||||
for (int j = 1; j <= 2; j++)
|
for (int j = 1; j <= 2; j++)
|
||||||
@ -2648,49 +2643,60 @@ void STLGeometry :: AddFaceEdges()
|
|||||||
edgecnt.SetSize(GetNOFaces());
|
edgecnt.SetSize(GetNOFaces());
|
||||||
chartindex.SetSize(GetNOFaces());
|
chartindex.SetSize(GetNOFaces());
|
||||||
|
|
||||||
int i,j;
|
for (int i = 1; i <= GetNOFaces(); i++)
|
||||||
for (i = 1; i <= GetNOFaces(); i++)
|
|
||||||
{
|
{
|
||||||
edgecnt.Elem(i) = 0;
|
edgecnt.Elem(i) = 0;
|
||||||
chartindex.Elem(i) = 0;
|
chartindex.Elem(i) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i <= GetNT(); i++)
|
for (int i = 1; i <= GetNT(); i++)
|
||||||
{
|
{
|
||||||
int fn = GetTriangle(i).GetFaceNum();
|
int fn = GetTriangle(i).GetFaceNum();
|
||||||
if (!chartindex.Get(fn)) {chartindex.Elem(fn) = GetChartNr(i);}
|
if (!chartindex.Get(fn)) {chartindex.Elem(fn) = GetChartNr(i);}
|
||||||
for (j = 1; j <= 3; j++)
|
for (int j = 1; j <= 3; j++)
|
||||||
{
|
{
|
||||||
edgecnt.Elem(fn) += GetNEPP(GetTriangle(i).PNum(j));
|
edgecnt.Elem(fn) += GetNEPP(GetTriangle(i).PNum(j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i <= GetNOFaces(); i++)
|
for (int i = 1; i <= GetNOFaces(); i++)
|
||||||
{
|
{
|
||||||
if (!edgecnt.Get(i)) {PrintMessage(5,"Face", i, " has no edge!");}
|
if (!edgecnt.Get(i)) {PrintMessage(5,"Face", i, " has no edge!");}
|
||||||
}
|
}
|
||||||
|
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
int k, ap1, ap2;
|
int ap1, ap2;
|
||||||
for (i = 1; i <= GetNOFaces(); i++)
|
for (int i = 1; i <= GetNOFaces(); i++)
|
||||||
{
|
{
|
||||||
if (!edgecnt.Get(i))
|
if (!edgecnt.Get(i))
|
||||||
{
|
{
|
||||||
const STLChart& c = GetChart(chartindex.Get(i));
|
const STLChart& c = GetChart(chartindex.Get(i));
|
||||||
for (j = 1; j <= c.GetNChartT(); j++)
|
// bool foundone = false;
|
||||||
|
int longest_ap1, longest_ap2 = -1;
|
||||||
|
double maxlen = -1;
|
||||||
|
for (int j = 1; j <= c.GetNChartT(); j++)
|
||||||
{
|
{
|
||||||
const STLTriangle& t1 = GetTriangle(c.GetChartTrig(j));
|
const STLTriangle& t1 = GetTriangle(c.GetChartTrig(j));
|
||||||
for (k = 1; k <= 3; k++)
|
for (int k = 1; k <= 3; k++)
|
||||||
{
|
{
|
||||||
int nt = NeighbourTrig(c.GetChartTrig(j),k);
|
int nt = NeighbourTrig(c.GetChartTrig(j),k);
|
||||||
if (GetChartNr(nt) != chartindex.Get(i))
|
if (GetChartNr(nt) != chartindex.Get(i))
|
||||||
{
|
{
|
||||||
t1.GetNeighbourPoints(GetTriangle(nt),ap1,ap2);
|
t1.GetNeighbourPoints(GetTriangle(nt),ap1,ap2);
|
||||||
AddEdge(ap1,ap2);
|
// AddEdge(ap1,ap2);
|
||||||
|
double len = Dist(GetPoint(ap1), GetPoint(ap2));
|
||||||
|
if (len > maxlen)
|
||||||
|
{
|
||||||
|
maxlen = len;
|
||||||
|
longest_ap1 = ap1;
|
||||||
|
longest_ap2 = ap2;
|
||||||
|
}
|
||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (maxlen > 0)
|
||||||
|
AddEdge(longest_ap1,longest_ap2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ void STLTopology :: InitSTLGeometry(const Array<STLReadTriangle> & readtrigs)
|
|||||||
pointtree->GetIntersecting (pmin, pmax, pintersect);
|
pointtree->GetIntersecting (pmin, pmax, pintersect);
|
||||||
|
|
||||||
if (pintersect.Size() > 1)
|
if (pintersect.Size() > 1)
|
||||||
PrintError("too many close points");
|
PrintError("too many close points");
|
||||||
int foundpos = -1;
|
int foundpos = -1;
|
||||||
if (pintersect.Size())
|
if (pintersect.Size())
|
||||||
foundpos = pintersect[0];
|
foundpos = pintersect[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user