0026736: Errors in BRepOffsetAPI_MakeOffset: overlapping arcs are processed incorrect...
[occt.git] / src / BRepFill / BRepFill_OffsetWire.cxx
index adeb395..06a2b5b 100644 (file)
@@ -938,7 +938,8 @@ void BRepFill_OffsetWire::PerformWithBiLo
     // Construction of vertices on edges parallel to the spine.
     //-----------------------------------------------------------
 
-    Trim.IntersectWith(E [0], E [1], myJoinType, Params);
+    Trim.IntersectWith(E[0], E[1], S[0], S[1], Ends[0], Ends[1],
+                       myJoinType, myIsOpenResult, Params);
 
     for (Standard_Integer s = 1; s <= Params.Length(); s++) {
       TopoDS_Vertex VC;
@@ -1291,69 +1292,76 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh
                                          const BRepFill_TrimEdgeTool&    Trim) const
 {
   Standard_Integer ii = 1;
-  Standard_Real    U1,U2;
-  TopoDS_Vertex    V1,V2;
 
-  Handle(Geom2d_Curve) Bis (Bisec.Value());
-
-  U1 = Bis->FirstParameter();
-  
-  if (SOnE) { 
-    // the first point of the bissectrice is on the offset
-    V1 = TopoDS::Vertex(Vertices.Value(ii));
-    ii++; 
-  }
-
-  while (ii <= Vertices.Length()) {
-    U2 = Params.Value(ii).X();
-    V2 = TopoDS::Vertex(Vertices.Value(ii));
-
-    gp_Pnt2d P = Bis->Value((U2 + U1)*0.5);
-    Standard_Boolean IsP_inside = Standard_True;
-    if ((myJoinType != GeomAbs_Intersection) || EOnE)
-      IsP_inside = Trim.IsInside(P);
-    if (!IsP_inside) {
-      if (!V1.IsNull()) {
-        Detromp(Shape1).Append(V1);
-        Detromp(Shape2).Append(V1);
-      }
-      Detromp(Shape1).Append(V2);
-      Detromp(Shape2).Append(V2);
-    }
-    U1 = U2;
-    V1 = V2;
-    ii ++;
-  }
-
-  // test medium point between the last parameter and the end of the bissectrice.
-  U2 = Bis->LastParameter();
-  if (!EOnE) {
-    if (!Precision::IsInfinite(U2)) {
-      gp_Pnt2d P = Bis->Value((U2 + U1)*0.5);  
-      Standard_Boolean IsP_inside = Standard_False;
-      if (myJoinType == GeomAbs_Arc)
-        IsP_inside = Trim.IsInside(P);
-      if (!IsP_inside) {
+  if (myJoinType == GeomAbs_Intersection)
+  {
+    for (; ii <= Vertices.Length(); ii++)
+    {
+      const TopoDS_Vertex& aVertex = TopoDS::Vertex(Vertices.Value(ii));
+      Detromp(Shape1).Append(aVertex);
+      Detromp(Shape2).Append(aVertex);
+    }
+  }
+  else //myJoinType == GeomAbs_Arc
+  {
+    Standard_Real    U1,U2;
+    TopoDS_Vertex    V1,V2;
+    
+    const Handle(Geom2d_Curve)& Bis = Bisec.Value();
+    
+    U1 = Bis->FirstParameter();
+    
+    if (SOnE) { 
+      // the first point of the bissectrice is on the offset
+      V1 = TopoDS::Vertex(Vertices.Value(ii));
+      ii++; 
+    }
+    
+    while (ii <= Vertices.Length()) {
+      U2 = Params.Value(ii).X();
+      V2 = TopoDS::Vertex(Vertices.Value(ii));
+      
+      gp_Pnt2d P = Bis->Value((U2 + U1)*0.5);
+      if (!Trim.IsInside(P)) {
         if (!V1.IsNull()) {
           Detromp(Shape1).Append(V1);
           Detromp(Shape2).Append(V1);
         }
+        Detromp(Shape1).Append(V2);
+        Detromp(Shape2).Append(V2);
       }
+      U1 = U2;
+      V1 = V2;
+      ii ++;
     }
-    else {
-      if (!V1.IsNull()) {
-        Detromp(Shape1).Append(V1);
-        Detromp(Shape2).Append(V1);
+    
+    // test medium point between the last parameter and the end of the bissectrice.
+    U2 = Bis->LastParameter();
+    if (!EOnE) {
+      if (!Precision::IsInfinite(U2)) {
+        gp_Pnt2d P = Bis->Value((U2 + U1)*0.5);
+        if (!Trim.IsInside(P)) {
+          if (!V1.IsNull()) {
+            Detromp(Shape1).Append(V1);
+            Detromp(Shape2).Append(V1);
+          }
+        }
       }
-    }
-  }    
-  //else if(myJoinType != GeomAbs_Arc)
-  //{
-  //  if (!V1.IsNull()) {
-  //    Detromp(Shape1).Append(V1);
-  //    Detromp(Shape2).Append(V1);
-  //  }
-  //}
+      else {
+        if (!V1.IsNull()) {
+          Detromp(Shape1).Append(V1);
+          Detromp(Shape2).Append(V1);
+        }
+      }
+    }    
+    //else if(myJoinType != GeomAbs_Arc)
+    //{
+    //  if (!V1.IsNull()) {
+    //    Detromp(Shape1).Append(V1);
+    //    Detromp(Shape2).Append(V1);
+    //  }
+    //}
+  } //end of else (myJoinType==GeomAbs_Arc)
 }
 
 //=======================================================================