]> OCCT Git - occt.git/commitdiff
0030398: Modeling Algorithms - thrusection produces twisted solid
authormgerus <mgerus@opencascade.com>
Wed, 29 Jun 2022 06:27:09 +0000 (09:27 +0300)
committersmoskvin <smoskvin@opencascade.com>
Thu, 30 Jun 2022 16:33:35 +0000 (19:33 +0300)
Change FirstBary to PrevBary to correct Offset calculation relative prev wire instead of first wire

src/BRepFill/BRepFill_CompatibleWires.cxx
tests/bugs/modalg_7/bug30398 [new file with mode: 0644]

index 13212c52a1752ee1aa5b8eb5771dcdd70c55f168..ebb01adf79752e7c04e8fd0502b99b677da72c09 100644 (file)
@@ -1585,7 +1585,7 @@ void BRepFill_CompatibleWires::ComputeOrigin(const  Standard_Boolean /*polar*/ )
     NbSamples = 4;
   gp_Pln FirstPlane;
   PlaneOfWire(TopoDS::Wire(myWork(ideb)), FirstPlane);
-  gp_Pnt FirstBary = FirstPlane.Location();
+  gp_Pnt PrevBary = FirstPlane.Location();
   gp_Vec NormalOfFirstPlane = FirstPlane.Axis().Direction();
   for (i = ideb+1; i <= ifin; i++)
     {
@@ -1596,10 +1596,10 @@ void BRepFill_CompatibleWires::ComputeOrigin(const  Standard_Boolean /*polar*/ )
       gp_Pln CurPlane;
       PlaneOfWire(aWire, CurPlane);
       gp_Pnt CurBary = CurPlane.Location();
-      gp_Vec aVec(FirstBary, CurBary);
+      gp_Vec aVec(PrevBary, CurBary);
       gp_Vec anOffsetProj = (aVec * NormalOfFirstPlane) * NormalOfFirstPlane;
       CurBary.Translate(-anOffsetProj); //projected current bary center
-      gp_Vec Offset(CurBary, FirstBary);
+      gp_Vec Offset(CurBary, PrevBary);
       
       TopoDS_Wire newwire;
       BRep_Builder BB;
@@ -1804,6 +1804,8 @@ void BRepFill_CompatibleWires::ComputeOrigin(const  Standard_Boolean /*polar*/ )
       newwire.Closed( Standard_True );
       newwire.Orientation( TopAbs_FORWARD );
       myWork(i) = newwire;
+
+      PrevBary = CurBary;
     }
 #ifdef OCCT_DEBUG_EFV
 
diff --git a/tests/bugs/modalg_7/bug30398 b/tests/bugs/modalg_7/bug30398
new file mode 100644 (file)
index 0000000..9f4804d
--- /dev/null
@@ -0,0 +1,14 @@
+puts "================================================="
+puts "0030398: Modeling Algorithms - thrusection produces twisted solid"
+puts "================================================="
+puts ""
+
+restore [locate_data_file bug30398.brep] a
+eval thrusections r 1 1 [explode a w]
+
+checkshape r
+checknbshapes r -shell 1 -face 630 -wire 630 -edge 1260
+
+smallview
+fit
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file