]> OCCT Git - occt.git/commitdiff
0033449: Modeling Algorithm - Crash in BRepTools_GTrsfModification::NewTriangulation... IR-2023-09-01
authorakaftasev <akaftasev@opencascade.com>
Tue, 29 Aug 2023 12:18:39 +0000 (13:18 +0100)
committerakaftasev <akaftasev@opencascade.com>
Tue, 29 Aug 2023 12:18:39 +0000 (13:18 +0100)
Changed iteration limits from theTriangulation->NbTriangles() to theTriangulation->NbNodes()
Provided modification of the normals only with rotation (gp_GTrsf::Form() == gp_Other  leads to crash)

src/BRepTools/BRepTools_GTrsfModification.cxx

index 7f2d9731d601243afa604526dc43c7863ae1888c..89001ee10c234cdbcd181ab0d0a29cb45d4a3674 100644 (file)
@@ -308,10 +308,15 @@ Standard_Boolean BRepTools_GTrsfModification::NewTriangulation(const TopoDS_Face
   // modify normals
   if (theTriangulation->HasNormals())
   {
-    for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
+    for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
     {
       gp_Dir aNormal = theTriangulation->Normal(anInd);
-      aNormal.Transform(aGTrsf.Trsf());
+      gp_Mat aMat = aGTrsf.VectorialPart();
+      aMat.SetDiagonal(1., 1., 1.);
+      gp_Trsf aTrsf;
+      aTrsf.SetForm(gp_Rotation);
+      (gp_Mat&)aTrsf.HVectorialPart() = aMat;
+      aNormal.Transform(aTrsf);
       theTriangulation->SetNormal(anInd, aNormal);
     }
   }