]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_FieldStepPrs.cpp
Salome HOME
updated copyright message
[modules/shaper.git] / src / PartSet / PartSet_FieldStepPrs.cpp
index a73f4779840e9cc9c809512a845be71924ff69e9..3fb0a1fc672bba0da7d1acbdc6b012e6dc2e419a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2022  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -38,7 +38,7 @@
 #include <TopoDS_Vertex.hxx>
 #include <TopExp_Explorer.hxx>
 #include <Graphic3d_Text.hxx>
-
+#include <Graphic3d_AspectText3d.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape);
 
@@ -318,14 +318,12 @@ bool PartSet_FieldStepPrs::computeMassCenter(const TopoDS_Shape& theShape, gp_Pn
     if (!triangulation.IsNull() && triangulation->HasUVNodes()) {
       gp_XY C(0, 0);
       double A = 0;
-      const TColgp_Array1OfPnt2d& uvArray = triangulation->UVNodes();
-      const Poly_Array1OfTriangle&  trias = triangulation->Triangles();
       int n1, n2, n3;
-      for (int iT = trias.Lower(); iT <= trias.Upper(); ++iT) {
-        trias(iT).Get(n1, n2, n3);
-        const gp_Pnt2d& uv1 = uvArray(n1);
-        const gp_Pnt2d& uv2 = uvArray(n2);
-        const gp_Pnt2d& uv3 = uvArray(n3);
+      for (int iT = 1; iT <= triangulation->NbTriangles(); ++iT) {
+        triangulation->Triangle(iT).Get(n1, n2, n3);
+        const gp_Pnt2d& uv1 = triangulation->UVNode(n1);
+        const gp_Pnt2d& uv2 = triangulation->UVNode(n2);
+        const gp_Pnt2d& uv3 = triangulation->UVNode(n3);
         double a = 0.5 * sqrt((uv1.X() - uv3.X()) * (uv2.Y() - uv1.Y()) -
           (uv1.X() - uv2.X()) * (uv3.Y() - uv1.Y()));
         C += (uv1.XY() + uv2.XY() + uv3.XY()) / 3. * a;