fixes for OCCT 7.6.0-dev

This commit is contained in:
Joachim Schoeberl 2021-08-31 00:37:41 +02:00
parent 8c8d7420ed
commit 08993ae5e2
3 changed files with 29 additions and 24 deletions

View File

@ -1236,9 +1236,13 @@ namespace netgen
for (int k = 1; k <=3; k++) for (int k = 1; k <=3; k++)
{ {
int n = triangulation->Triangles()(j)(k); // int n = triangulation->Triangles()(j)(k);
p[k-1] = triangulation->Nodes()(n).Transformed(loc); // p[k-1] = triangulation->Nodes()(n).Transformed(loc);
par[k-1] = triangulation->UVNodes()(n); // par[k-1] = triangulation->UVNodes()(n);
// fix for OCC7.6.0-dev
int n = triangulation->Triangle(j)(k);
p[k-1] = triangulation->Node(n).Transformed(loc);
par[k-1] = triangulation->UVNode(n);
} }
//double maxside = 0; //double maxside = 0;

View File

@ -104,14 +104,14 @@ void ExtractEdgeData( const TopoDS_Edge & edge, int index, std::vector<double> *
int nbnodes = poly -> NbNodes(); int nbnodes = poly -> NbNodes();
for (int j = 1; j < nbnodes; j++) for (int j = 1; j < nbnodes; j++)
{ {
auto p0 = occ2ng((T -> Nodes())(poly->Nodes()(j)).Transformed(loc)); auto p0 = occ2ng((T -> Node(poly->Node(j))).Transformed(loc));
auto p1 = occ2ng((T -> Nodes())(poly->Nodes()(j+1)).Transformed(loc)); auto p1 = occ2ng((T -> Node(poly->Node(j+1))).Transformed(loc));
for(auto k : Range(3)) for(auto k : Range(3))
{ {
p[0].push_back(p0[k]); p[0].push_back(p0[k]);
p[1].push_back(p1[k]); p[1].push_back(p1[k]);
} }
p[0].push_back(index); p[0].push_back(index);
p[1].push_back(index); p[1].push_back(index);
box.Add(p0); box.Add(p0);
@ -138,15 +138,15 @@ void ExtractFaceData( const TopoDS_Face & face, int index, std::vector<double> *
int ntriangles = triangulation -> NbTriangles(); int ntriangles = triangulation -> NbTriangles();
for (int j = 1; j <= ntriangles; j++) for (int j = 1; j <= ntriangles; j++)
{ {
Poly_Triangle triangle = (triangulation -> Triangles())(j); Poly_Triangle triangle = triangulation -> Triangle(j);
std::array<Point<3>,3> pts; std::array<Point<3>,3> pts;
std::array<Vec<3>,3> normals; std::array<Vec<3>,3> normals;
for (int k = 0; k < 3; k++) for (int k = 0; k < 3; k++)
pts[k] = occ2ng( (triangulation -> Nodes())(triangle(k+1)).Transformed(loc) ); pts[k] = occ2ng( (triangulation -> Node(triangle(k+1))).Transformed(loc) );
for (int k = 0; k < 3; k++) for (int k = 0; k < 3; k++)
{ {
auto uv = (triangulation -> UVNodes())(triangle(k+1)); auto uv = triangulation -> UVNode(triangle(k+1));
prop.SetParameters (uv.X(), uv.Y()); prop.SetParameters (uv.X(), uv.Y());
if (!prop.IsNormalDefined()) if (!prop.IsNormalDefined())
throw Exception("No normal defined on face"); throw Exception("No normal defined on face");
@ -1011,11 +1011,10 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
Array< std::array<Point<3>,3> > triangles; Array< std::array<Point<3>,3> > triangles;
for (int j = 1; j <= ntriangles; j++) for (int j = 1; j <= ntriangles; j++)
{ {
Poly_Triangle triangle = (triangulation -> Triangles())(j); Poly_Triangle triangle = triangulation -> Triangle(j);
std::array<Point<3>,3> pts; std::array<Point<3>,3> pts;
for (int k = 0; k < 3; k++) for (int k = 0; k < 3; k++)
pts[k] = occ2ng( (triangulation -> Nodes())(triangle(k+1)).Transformed(loc) ); pts[k] = occ2ng( (triangulation -> Node(triangle(k+1))).Transformed(loc) );
triangles.Append ( pts ); triangles.Append ( pts );
} }

View File

@ -463,8 +463,9 @@ namespace netgen
glBegin (GL_LINE_STRIP); glBegin (GL_LINE_STRIP);
for (int j = 1; j <= nbnodes; j++) for (int j = 1; j <= nbnodes; j++)
{ {
gp_Pnt p = (T -> Nodes())(aEdgePoly->Nodes()(j)).Transformed(aEdgeLoc); // gp_Pnt p = (T -> Nodes())(aEdgePoly->Nodes()(j)).Transformed(aEdgeLoc);
glVertex3f (p.X(), p.Y(), p.Z()); gp_Pnt p = (T -> Node(aEdgePoly->Nodes()(j))).Transformed(aEdgeLoc);
glVertex3f (p.X(), p.Y(), p.Z());
} }
glEnd (); glEnd ();
} }
@ -509,10 +510,11 @@ namespace netgen
int nbnodes = aEdgePoly -> NbNodes(); int nbnodes = aEdgePoly -> NbNodes();
glBegin (GL_LINE_STRIP); glBegin (GL_LINE_STRIP);
for (int j = 1; j <= nbnodes; j++) for (int j = 1; j <= nbnodes; j++)
{ {
gp_Pnt p = (T -> Nodes())(aEdgePoly->Nodes()(j)).Transformed(aEdgeLoc); // gp_Pnt p = (T -> Nodes())(aEdgePoly->Nodes()(j)).Transformed(aEdgeLoc);
glVertex3f (p.X(), p.Y(), p.Z()); gp_Pnt p = (T -> Node(aEdgePoly->Node(j))).Transformed(aEdgeLoc);
} glVertex3f (p.X(), p.Y(), p.Z());
}
glEnd (); glEnd ();
} }
@ -582,18 +584,18 @@ namespace netgen
gp_Vec n; gp_Vec n;
glBegin (GL_TRIANGLES); glBegin (GL_TRIANGLES);
int ntriangles = triangulation -> NbTriangles(); int ntriangles = triangulation -> NbTriangles();
for (int j = 1; j <= ntriangles; j++) for (int j = 1; j <= ntriangles; j++)
{ {
Poly_Triangle triangle = (triangulation -> Triangles())(j); Poly_Triangle triangle = (triangulation -> Triangle(j));
gp_Pnt p[3]; gp_Pnt p[3];
for (int k = 1; k <= 3; k++) for (int k = 1; k <= 3; k++)
p[k-1] = (triangulation -> Nodes())(triangle(k)).Transformed(loc); p[k-1] = (triangulation -> Node(triangle(k))).Transformed(loc);
for (int k = 1; k <= 3; k++) for (int k = 1; k <= 3; k++)
{ {
uv = (triangulation -> UVNodes())(triangle(k)); // uv = (triangulation -> UVNodes())(triangle(k));
uv = triangulation -> UVNode(triangle(k));
prop.SetParameters (uv.X(), uv.Y()); prop.SetParameters (uv.X(), uv.Y());
// surf->D0 (uv.X(), uv.Y(), pnt); // surf->D0 (uv.X(), uv.Y(), pnt);