0024573: Wrong result of 2d-offset algorithm on customer's shape
authorjgv <jgv@opencascade.com>
Thu, 30 Jan 2014 12:07:12 +0000 (16:07 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 30 Jan 2014 12:08:20 +0000 (16:08 +0400)
Test cases for issue CR24573

src/Bisector/Bisector_BisecAna.cxx
src/GccAna/GccAna_CircPnt2dBisec.cdl
src/GccAna/GccAna_CircPnt2dBisec.cxx
tests/bugs/modalg_5/bug24573 [new file with mode: 0755]
tests/offset/wire_closed_inside_0_005/B4 [changed mode: 0644->0755]
tests/offset/wire_closed_inside_0_025/B4 [changed mode: 0644->0755]
tests/offset/wire_closed_inside_0_075/B4 [changed mode: 0644->0755]

index 6220427..0dbb8f1 100644 (file)
@@ -808,7 +808,7 @@ void Bisector_BisecAna::Perform(const Handle(Geom2d_Curve)& afirstcurve  ,
 //                       Bissectrice point - circle.                          +
 //=============================================================================
     case 1 : {
-      GccAna_CircPnt2dBisec Bisector(circle,asecondpoint->Pnt2d());
+      GccAna_CircPnt2dBisec Bisector(circle, asecondpoint->Pnt2d(), tolerance);
       Standard_Real distancemini = Precision::Infinite();
       if (Bisector.IsDone()) {
        Standard_Integer nbsolution = Bisector.NbSolutions();
index ddbb3ac..e51f318 100644 (file)
@@ -46,6 +46,18 @@ Create(Circle1  : Circ2d from gp;
 
        ---Purpose: Constructs bisecting curves between the circle Circle1 and the point Point2.
     
+Create(Circle1  : Circ2d from gp;
+       Point2   : Pnt2d  from gp;
+       Tolerance : Real from Standard) returns CircPnt2dBisec;
+
+       ---Purpose: Constructs bisecting curves between the circle Circle1 and the point Point2.
+       --          Tolerance is used.
+    
+DefineSolutions(me: in out)
+is private;
+       ---Purpose: Defines the number and the type of solutions
+       --          depending on input data
+    
 IsDone(me) returns Boolean from Standard
 is static;
        ---Purpose: Returns true (this construction algorithm never fails).
@@ -84,4 +96,6 @@ fields
        --          theposition = 0 when the point is on the circle.
        --          theposition = -1 when the point is inside the circle.
 
+    myTolerance : Real from Standard;
+
 end CircPnt2dBisec;
index 1492efb..b4c9f31 100644 (file)
 
 GccAna_CircPnt2dBisec::
    GccAna_CircPnt2dBisec (const gp_Circ2d& Circle ,
-                         const gp_Pnt2d&  Point  ):
-
-   circle(Circle),
-   point(Point)  {
+                         const gp_Pnt2d&  Point  )
+{
+  circle = Circle;
+  point = Point;
+  myTolerance = 1.e-10;
+  DefineSolutions();
+}
 
-//=========================================================================
-//  Initialization of fields :                                            +
-//            - circle   ( first argument.)                               +
-//            - line     ( second argument.)                              +
-//            - theposition (Integer showing the position of Point        +
-//                           correspondingly to Circle.)                  +
-//            - NbrSol   (Integer showing the number of solutions.)       +
-//            - WellDone (Booleen showing the success or failure of the algorithm). +
-//=========================================================================
+GccAna_CircPnt2dBisec::
+   GccAna_CircPnt2dBisec (const gp_Circ2d& Circle ,
+                         const gp_Pnt2d&  Point,
+                          const Standard_Real Tolerance)
+{
+  circle = Circle;
+  point = Point;
+  myTolerance = 1.e-10;
+  if (myTolerance < Tolerance)
+    myTolerance = Tolerance;
+  
+  DefineSolutions();
+}
 
-   Standard_Real dist = Circle.Radius()-Point.Distance(Circle.Location());
-//   if (Abs(dist) < gp::Resolution())
-   if (Abs(dist) < 1.E-10)
-     {
-       theposition = 0;
-       NbrSol = 1;
-     }
-   else if (dist > 0.0)
-     {
-       theposition = -1;
-       NbrSol = 1;
-     }
-   else {
-     theposition = 1;
-     NbrSol = 2;
-   }
-   WellDone = Standard_True;
- }
+void GccAna_CircPnt2dBisec::DefineSolutions()
+{
+  Standard_Real dist = circle.Radius() - point.Distance(circle.Location());
+  
+  if (Abs(dist) < myTolerance)
+  {
+    theposition = 0;
+    NbrSol = 1;
+  }
+  else if (dist > 0.0)
+  {
+    theposition = -1;
+    NbrSol = 1;
+  }
+  else {
+    theposition = 1;
+    NbrSol = 2;
+  }
+  
+  WellDone = Standard_True;
+}
 
 //=========================================================================
 //  Processing.                                                           +
@@ -99,8 +109,8 @@ Handle(GccInt_Bisec) GccAna_CircPnt2dBisec::
   Standard_Real ycencir = circle.Location().Y();
   Standard_Real R1 = circle.Radius();
   Standard_Real dist = point.Distance(circle.Location());
-  //       if (dist < gp::Resolution())
-  if (dist < 1.E-10)
+
+  if (dist < myTolerance)
     {
       gp_Circ2d biscirpnt1(gp_Ax2d(point,gp_Dir2d(1.0,0.0)),R1/2.);
       bissol = new GccInt_BCirc(biscirpnt1);
diff --git a/tests/bugs/modalg_5/bug24573 b/tests/bugs/modalg_5/bug24573
new file mode 100755 (executable)
index 0000000..5a9b19a
--- /dev/null
@@ -0,0 +1,32 @@
+puts "============"
+puts "OCC24573"
+puts "============"
+puts ""
+#######################################################################
+# Wrong result of 2d-offset algorithm on customer's shape
+#######################################################################
+
+set BugNumber OCC24573
+
+puts "Load shape ..."
+restore [locate_data_file bug24573_Wire.brep] ww
+
+if [catch { mkoffset resoffset ww 1 12.5 } ] {
+  puts "Faulty ${BugNumber} : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 178.54
+
+  set nb_v_good 10
+  set nb_e_good 10
+  set nb_w_good 1
+  set nb_f_good 0
+  set nb_sh_good 0
+  set nb_sol_good 0
+  set nb_compsol_good 0
+  set nb_compound_good 0
+  set nb_shape_good 21
+}
+
+set 2dviewer 1
old mode 100644 (file)
new mode 100755 (executable)
index ae910a6..7c5f61a
@@ -1,5 +1,10 @@
-puts "TODO OCC23068 ALL: Error : big tolerance of shape result"
-puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2"
+puts "TODO ?OCC23068 ALL: Error : big tolerance of shape result"
+puts "TODO ?OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_"
+
+puts "TODO OCC23068 ALL: Standard_Failure: BRepFill_OffsetWire::FixHoles"
+puts "TODO OCC23068 ALL: Error: Offset is not done"
+puts "TODO OCC23068 ALL: Error : The offset cannot be built"
+
 restore [locate_data_file offset_wire_018.brep] s
 
 set length 24.8301
old mode 100644 (file)
new mode 100755 (executable)
index a0090fe..6d63b09
@@ -1,5 +1,9 @@
-puts "TODO OCC23068 ALL: Error : big tolerance of shape result"
-puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_3"
+puts "TODO ?OCC23068 ALL: Error : big tolerance of shape result"
+puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO OCC23068 ALL: Error : result_1 is NOT a closed wire"
+puts "TODO OCC23068 ALL: Error : The length of the resulting shape is"
+puts "TODO OCC23068 ALL: Error : The resulting shape is WRONG because it must contain"
+
 restore [locate_data_file offset_wire_018.brep] s
 
 set length 23.8673
old mode 100644 (file)
new mode 100755 (executable)
index c9265df..377a08c
@@ -3,6 +3,10 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
 puts "TODO ?OCC23068 ALL: An exception was caught"
 puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
 puts "TODO ?OCC23748 ALL: Error: Offset is not done."
+puts "TODO ?OCC23748 ALL: Error : result is NOT a closed wire"
+puts "TODO ?OCC23748 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "TODO ?OCC23748 ALL: Error : The length of the resulting shape is"
+puts "TODO ?OCC23748 ALL: Error : The resulting shape is WRONG"
 
 restore [locate_data_file offset_wire_018.brep] s