0025298: New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corner...
authorjgv <jgv@opencascade.com>
Thu, 2 Oct 2014 09:36:12 +0000 (13:36 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 2 Oct 2014 09:36:53 +0000 (13:36 +0400)
Test cases for issue CR25298

28 files changed:
src/BRepFill/BRepFill_OffsetWire.cdl
src/BRepFill/BRepFill_OffsetWire.cxx
src/BRepMAT2d/BRepMAT2d.cdl
src/BRepMAT2d/BRepMAT2d_BisectingLocus.cdl
src/BRepMAT2d/BRepMAT2d_BisectingLocus.cxx
src/BRepTest/BRepTest_CurveCommands.cxx
src/BRepTest/BRepTest_MatCommands.cxx
src/MAT2d/MAT2d.cdl
src/MAT2d/MAT2d_Circuit.cdl
src/MAT2d/MAT2d_Circuit.cxx
src/MAT2d/MAT2d_Tool2d.cdl
src/MAT2d/MAT2d_Tool2d.cxx
tests/bugs/modalg_5/bug25298_01 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_02 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_03 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_04 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_05 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_06 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_07 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_08 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_09 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_10 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_11 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_12 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_13 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_14 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_15 [new file with mode: 0755]
tests/bugs/modalg_5/bug25298_16 [new file with mode: 0755]

index 00bd8e6..092db05 100644 (file)
@@ -25,10 +25,15 @@ uses
     Shape       from TopoDS,
     JoinType    from GeomAbs,
     ListOfShape from TopTools,
+    SequenceOfShape from TopTools,
+    SequenceOfPnt from TColgp,
     DataMapOfShapeShape               from TopTools,
     IndexedDataMapOfOrientedShapeListOfShape from BRepFill,  
+    DataMapOfOrientedShapeListOfShape from BRepFill,  
     BisectingLocus                    from BRepMAT2d, 
-    LinkTopoBilo                      from BRepMAT2d
+    LinkTopoBilo                      from BRepMAT2d,
+    Bisec from Bisector,
+    TrimEdgeTool from BRepFill
     
 raises
     ConstructionError from Standard,
@@ -116,6 +121,16 @@ is
        ---Purpose: Add the OffsetWire <Other> to <me> and update <myMap>
     is static private;
     
+    UpdateDetromp (me; Detromp : in out DataMapOfOrientedShapeListOfShape from BRepFill;
+                      Shape1, Shape2 : Shape from TopoDS;
+                      Vertices : SequenceOfShape from TopTools;
+                      Params   : SequenceOfPnt   from TColgp;
+                      Bisec    : Bisec from Bisector;
+                      SOnE     : Boolean from Standard;
+                      EOnE     : Boolean from Standard;
+                      Trim     : TrimEdgeTool from BRepFill)
+    is static private;
+    
     MakeWires (me : in  out)
        ---Purpose: Constructs the wires with the trimmed offset edges.
     is static private;
index 77e45e3..6d3af0e 100644 (file)
@@ -168,15 +168,6 @@ static void EdgeVertices (const TopoDS_Edge&   E,
   }
 }
                                      
-static void UpdateDetromp (TopTools_ListOfShape&           Detromp1, 
-                          TopTools_ListOfShape&           Detromp2, 
-                          const TopTools_SequenceOfShape& Vertices, 
-                          const TColgp_SequenceOfPnt&     Params, 
-                          const Bisector_Bisec&           Bisec,
-                          const Standard_Boolean          SOnE,
-                          const Standard_Boolean          EOnE,
-                          const BRepFill_TrimEdgeTool&    Trim);
-
 static Standard_Boolean VertexFromNode
 (const Handle(MAT_Node)&      aNode, 
  const Standard_Real          Offset,
@@ -377,9 +368,6 @@ void BRepFill_OffsetWire::Init(const TopoDS_Face&     Spine,
                               const GeomAbs_JoinType Join,
                                const Standard_Boolean IsOpenResult)
 {
-  Standard_NotImplemented_Raise_if(Join > GeomAbs_Arc,
-                                  "Only GeomAbs_Arc is implemented");
-
   myIsDone   = Standard_False;
   TopoDS_Shape aLocalShape = Spine.Oriented(TopAbs_FORWARD);
   mySpine    = TopoDS::Face(aLocalShape);
@@ -420,8 +408,8 @@ void BRepFill_OffsetWire::Init(const TopoDS_Face&     Spine,
 //   static BRepMAT2d_Explorer Exp;
 //  Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 End
   Exp.Perform(myWorkSpine);
-  myBilo.Compute(Exp,1,MAT_Left,myIsOpenResult);
-  myLink.Perform(Exp,myBilo);
+  myBilo.Compute(Exp, 1 ,MAT_Left, myJoinType, myIsOpenResult);
+  myLink.Perform(Exp, myBilo);
 }
 
 
@@ -648,7 +636,7 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
         newExp.Perform(myWorkSpine);
         BRepMAT2d_BisectingLocus newBilo;
         BRepMAT2d_LinkTopoBilo newLink;
-        newBilo.Compute(newExp,1,MAT_Left,myIsOpenResult);
+        newBilo.Compute(newExp, 1, MAT_Left, myJoinType, myIsOpenResult);
 
         if(!newBilo.IsDone())
         {
@@ -748,9 +736,6 @@ void BRepFill_OffsetWire::PerformWithBiLo
  const GeomAbs_JoinType          Join,
  const Standard_Real             Alt)
 {
-  Standard_NotImplemented_Raise_if (Join > GeomAbs_Arc,
-                                   "Only GeomAbs_Arc is implemented");
-
   myIsDone     = Standard_False;
   TopoDS_Shape aLocalShape = Spine.Oriented(TopAbs_FORWARD);
   myWorkSpine  = TopoDS::Face(aLocalShape);
@@ -983,7 +968,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
     if (!Detromp.IsBound(S[1])) Detromp.Bind(S[1],EmptyList);
 
     
-    UpdateDetromp (Detromp(S[0]), Detromp(S[1]), Vertices, Params, 
+    UpdateDetromp (Detromp, S[0], S[1], Vertices, Params, 
                   Bisec, StartOnEdge, EndOnEdge, Trim);
     //----------------------------------------------
     // Storage of vertices on parallel edges.
@@ -1259,6 +1244,102 @@ void BRepFill_OffsetWire::PrepareSpine()
 
 }
 
+//=======================================================================
+//function : UpdateDetromp
+//purpose  : For each interval on bissectrice defined by parameters
+//           test if the medium point is at a distance > offset        
+//           in this case vertices corresponding to the extremities of the interval
+//           are ranked in the proofing.
+//           => If the same vertex appears in the proofing, the 
+//           border of the zone of proximity is tangent to the offset .
+//=======================================================================
+
+void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfShape& Detromp,
+                                         const TopoDS_Shape& Shape1,
+                                         const TopoDS_Shape& Shape2,
+                                         const TopTools_SequenceOfShape& Vertices, 
+                                         const TColgp_SequenceOfPnt&     Params, 
+                                         const Bisector_Bisec&           Bisec,
+                                         const Standard_Boolean          SOnE,
+                                         const Standard_Boolean          EOnE,
+                                         const BRepFill_TrimEdgeTool&    Trim) const
+{
+  if (myJoinType == GeomAbs_Intersection &&
+      Vertices.Length() == 1 &&
+      !EOnE)
+  {
+    TopTools_IndexedMapOfShape Vmap1, Vmap2;
+    TopExp::MapShapes(Shape1, TopAbs_VERTEX, Vmap1);
+    TopExp::MapShapes(Shape2, TopAbs_VERTEX, Vmap2);
+    Standard_Boolean Adjacent = Standard_False;
+    for (Standard_Integer i = 1; i <= Vmap1.Extent(); i++)
+      for (Standard_Integer j = 1; j <= Vmap2.Extent(); j++)
+        if (Vmap1(i).IsSame(Vmap2(j)))
+        {
+          Adjacent = Standard_True;
+          break;
+        }
+    if (Adjacent)
+    {
+      Detromp(Shape1).Append(Vertices.First());
+      Detromp(Shape2).Append(Vertices.First());
+      return;
+    }
+  }
+  
+  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);  
+    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 ++;
+  }
+
+  // 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 (!V1.IsNull()) {
+       Detromp(Shape1).Append(V1);
+       Detromp(Shape2).Append(V1);
+      }
+    }
+  }    
+}
+
 //=======================================================================
 //function : MakeWires
 //purpose  : 
@@ -1994,77 +2075,6 @@ void MakeOffset (const TopoDS_Edge&        E,
   }
 }  
 
-//=======================================================================
-//function : UpdateDetromp
-//purpose  : For each interval on bissectrice defined by parameters
-//           test if the medium point is at a distance > offset        
-//           in this case vertices corresponding to the extremities of the interval
-//           are ranked in the proofing.
-//           => If the same vertex appears in the proofing, the 
-//           border of the zone of proximity is tangent to the offset .
-//=======================================================================
-
-void UpdateDetromp (TopTools_ListOfShape&           Detromp1,
-                   TopTools_ListOfShape&           Detromp2, 
-                   const TopTools_SequenceOfShape& Vertices, 
-                   const TColgp_SequenceOfPnt&     Params, 
-                   const Bisector_Bisec&           Bisec,
-                   const Standard_Boolean          SOnE,
-                   const Standard_Boolean          EOnE,
-                   const BRepFill_TrimEdgeTool&    Trim)
-{
-  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);  
-    if (!Trim.IsInside(P)) {
-      if (!V1.IsNull()) {
-         Detromp1.Append(V1);
-         Detromp2.Append(V1);
-      }
-      Detromp1.Append(V2);
-      Detromp2.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);  
-      if (!Trim.IsInside(P)) {
-       if (!V1.IsNull()) {
-         Detromp1.Append(V1);
-         Detromp2.Append(V1);
-       }
-      }
-    }
-    else {
-      if (!V1.IsNull()) {
-       Detromp1.Append(V1);
-       Detromp2.Append(V1);
-      }
-    }
-  }    
-}
 
 //=======================================================================
 //function : VertexFromNode
index afff536..5674253 100644 (file)
@@ -19,6 +19,7 @@ package BRepMAT2d
        ---Purpose: 
 
 uses
+    GeomAbs,
     MAT2d,
     MAT,
     TCollection,
index 85884e4..9d258ba 100644 (file)
@@ -52,6 +52,7 @@ class BisectingLocus from BRepMAT2d
        --         - The Nodes are the extremities of the arcs.
 
 uses
+    JoinType                 from GeomAbs,
     Graph                    from MAT,
     Arc                      from MAT,
     BasicElt                 from MAT,
@@ -74,6 +75,7 @@ is
             anExplo   : in out Explorer from BRepMAT2d;
              LineIndex :        Integer       = 1;
              aSide     :        Side from MAT = MAT_Left;
+            aJoinType    :     JoinType from GeomAbs = GeomAbs_Arc;
             IsOpenResult :     Boolean       = Standard_False)
        --- Purpose : Computation of the Bisector_Locus in a set of Lines 
        --            defined in <anExplo>.
index 1ed1a7e..fa5d0e3 100644 (file)
@@ -58,6 +58,7 @@ BRepMAT2d_BisectingLocus::BRepMAT2d_BisectingLocus()
 void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer&        anExplo,
                                        const Standard_Integer IndexLine,
                                        const MAT_Side         aSide,
+                                       const GeomAbs_JoinType aJoinType,
                                        const Standard_Boolean IsOpenResult)
 {
   MAT2d_Mat2d                        TheMAT;
@@ -87,7 +88,7 @@ void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer&        anExplo,
   //----------------------------------------------------------
   // Construction du circuit sur lequel est calcule la carte.
   //----------------------------------------------------------
-  Handle(MAT2d_Circuit) ACircuit = new MAT2d_Circuit(IsOpenResult);
+  Handle(MAT2d_Circuit) ACircuit = new MAT2d_Circuit(aJoinType, IsOpenResult);
 //  Modified by Sergey KHROMOV - Wed Mar  6 17:43:47 2002 Begin
 //   ACircuit->Perform(Figure,IndexLine,(aSide == MAT_Left));
   ACircuit->Perform(Figure,anExplo.GetIsClosed(), IndexLine,(aSide == MAT_Left));
@@ -97,6 +98,7 @@ void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer&        anExplo,
   // Initialistion du Tool.
   // -----------------------
   theTool.Sense(aSide);
+  theTool.SetJoinType(aJoinType);
   theTool.InitItems(ACircuit);
 
   // --------------------------------------------
index 481fd1a..ad290cc 100644 (file)
@@ -1501,15 +1501,18 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
   if (n < 5) return 1;
   char name[100];
 
-  BRepOffsetAPI_MakeOffset Paral;  
-  Paral.Init(GeomAbs_Arc);
+  BRepOffsetAPI_MakeOffset Paral;
+  GeomAbs_JoinType theJoinType = GeomAbs_Arc;
+  if (n >= 6 && strcmp(a[5], "i") == 0)
+    theJoinType = GeomAbs_Intersection;
+  Paral.Init(theJoinType);
   TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_FACE);
 
   if ( Base.IsNull())
   {
     Base = DBRep::Get(a[2]);
     if (Base.IsNull()) return 1;
-    Paral.Init(GeomAbs_Arc);
+    Paral.Init(theJoinType);
     TopExp_Explorer exp;
     for (exp.Init(Base,TopAbs_WIRE); exp.More(); exp.Next())
     {
@@ -1529,8 +1532,8 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
   Nb = Draw::Atoi(a[3]);
 
   Standard_Real Alt = 0.;
-  if ( n == 6)
-    Alt = Draw::Atof(a[5]);
+  if ( n == 7)
+    Alt = Draw::Atof(a[6]);
 
   Standard_Integer Compt = 1;
 
@@ -1568,8 +1571,12 @@ Standard_Integer openoffset(Draw_Interpretor& di,
 
   TopoDS_Shape Base = DBRep::Get(a[2], TopAbs_WIRE);
 
-  BRepOffsetAPI_MakeOffset Paral(TopoDS::Wire(Base), GeomAbs_Arc, Standard_True);
+  GeomAbs_JoinType theJoinType = GeomAbs_Arc;
+  if (n == 6 && strcmp(a[5], "i") == 0)
+    theJoinType = GeomAbs_Intersection;
   
+  BRepOffsetAPI_MakeOffset Paral(TopoDS::Wire(Base), theJoinType, Standard_True);
+
   Standard_Real U, dU;
   Standard_Integer Nb;
   dU = Draw::Atof(a[4]);
@@ -1861,11 +1868,11 @@ void  BRepTest::CurveCommands(Draw_Interpretor& theCommands)
     profile2d,g);
 
   theCommands.Add("mkoffset",
-    "mkoffset result face/compound of wires  nboffset stepoffset [alt]",__FILE__,
+    "mkoffset result face/compound of wires  nboffset stepoffset [jointype(a/i) [alt]]",__FILE__,
     mkoffset);
 
   theCommands.Add("openoffset",
-    "openoffset result wire nboffset stepoffset",__FILE__,
+    "openoffset result wire nboffset stepoffset [jointype(a/i)]",__FILE__,
     openoffset);
 
   theCommands.Add("mkedge",
index cc47a85..c8ae4e4 100644 (file)
@@ -100,9 +100,17 @@ static Standard_Integer drawcont(Draw_Interpretor& , Standard_Integer , const ch
 //           calculate the map of locations bisector on the contour defined by 
 //           the explorer.
 //==========================================================================
-static Standard_Integer mat(Draw_Interpretor& , Standard_Integer, const char**)
+static Standard_Integer mat(Draw_Interpretor&, Standard_Integer n, const char** a)
 {
-  MapBiLo.Compute(anExplo,1,SideOfMat);
+  GeomAbs_JoinType theJoinType = GeomAbs_Arc;
+  if (n  >= 2 && strcmp(a[1], "i") == 0)
+    theJoinType = GeomAbs_Intersection;
+
+  Standard_Boolean IsOpenResult = Standard_False;
+  if (n == 3 && strcmp(a[2], "o") == 0)
+    IsOpenResult = Standard_True;
+  
+  MapBiLo.Compute(anExplo, 1, SideOfMat, theJoinType, IsOpenResult);
   LinkComputed = Standard_False;
 
   return 0;
@@ -266,7 +274,7 @@ void BRepTest::MatCommands (Draw_Interpretor& theCommands)
 {
   theCommands.Add("topoload","load face",__FILE__,topoload);
   theCommands.Add("drawcont","display current contour",__FILE__,drawcont);
-  theCommands.Add("mat","computes the mat",__FILE__,mat);
+  theCommands.Add("mat","computes the mat: mat [a/i [o]]",__FILE__,mat);
   theCommands.Add("side","side left/right",__FILE__,side);
   theCommands.Add("result","result",__FILE__,result);
   theCommands.Add("zone","zone edge or vertex",__FILE__,zone);
index 08cecae..71ec72c 100644 (file)
@@ -20,7 +20,7 @@ package MAT2d
         --           Set of geometrys from Geom2d.
 
 uses
-
+    GeomAbs,
     MMgt,
     gp,
     Geom2d,
index c2b5251..6cbb70b 100644 (file)
@@ -26,7 +26,7 @@ inherits
        --           
 
 uses
-
+    JoinType                         from GeomAbs,
     SequenceOfInteger                from TColStd,
     Geometry                         from Geom2d,
     SequenceOfGeometry               from TColGeom2d,
@@ -41,7 +41,8 @@ uses
 
 is
 
-    Create(IsOpenResult : Boolean from Standard = Standard_False)
+    Create(aJoinType    : JoinType from GeomAbs  = GeomAbs_Arc;
+          IsOpenResult : Boolean  from Standard = Standard_False)
     returns Circuit from MAT2d;
 
 ---Category:  Computation
@@ -53,6 +54,11 @@ is
             Trigo       :        Boolean)
     is static;     
     
+    IsSharpCorner(me; Geom1, Geom2 : Geometry from Geom2d;
+                     Direction : Real from Standard)
+    returns Boolean
+    is static private;
+    
     PassByLast(me ; C1,C2 : Connexion from MAT2d) 
     returns Boolean
     is static private;
@@ -130,7 +136,8 @@ fields
     connexionMap : DataMapOfIntegerConnexion       from MAT2d;
     linkRefEqui  : DataMapOfBiIntSequenceOfInteger from MAT2d;
     linesLength  : SequenceOfInteger               from TColStd; 
-    myIsOpenResult : Boolean from Standard;
+    myJoinType     : JoinType from GeomAbs;
+    myIsOpenResult : Boolean  from Standard;
     
 end Circuit;
 
index b881062..49bfa1b 100644 (file)
@@ -67,16 +67,15 @@ static Standard_Real CrossProd(const Handle(Geom2d_Geometry)& Geom1,
                               const Handle(Geom2d_Geometry)& Geom2,
                                     Standard_Real&           DotProd);
 
-static Standard_Boolean IsSharpCorner (const Handle(Geom2d_Geometry)& Geom1,
-                                      const Handle(Geom2d_Geometry)& Geom2,
-                                      const Standard_Real&           Direction);
 
 //=============================================================================
 //function : Constructor
 //purpose :
 //=============================================================================
-MAT2d_Circuit::MAT2d_Circuit(const Standard_Boolean IsOpenResult)
+MAT2d_Circuit::MAT2d_Circuit(const GeomAbs_JoinType aJoinType,
+                             const Standard_Boolean IsOpenResult)
 {
+  myJoinType = aJoinType;
   myIsOpenResult = IsOpenResult;
 }
 
@@ -204,6 +203,133 @@ void  MAT2d_Circuit::Perform
   ConstructCircuit(FigItem,IndRefLine,Road);
 }
 
+//=======================================================================
+//function : IsSharpCorner
+//purpose  : Return True Si le point commun entre <Geom1> et <Geom2> est 
+//           une cassure saillante par rapport <Direction>
+//=======================================================================
+
+Standard_Boolean MAT2d_Circuit::IsSharpCorner(const Handle(Geom2d_Geometry)& Geom1,
+                                              const Handle(Geom2d_Geometry)& Geom2,
+                                              const Standard_Real Direction) const
+{
+  Standard_Real    DotProd;
+  Standard_Real    ProVec = CrossProd (Geom1,Geom2,DotProd);
+  Standard_Integer NbTest = 1;
+  Standard_Real    DU = Precision::Confusion();
+  Handle(Geom2d_TrimmedCurve) C1,C2;
+
+  C1= Handle(Geom2d_TrimmedCurve)::DownCast(Geom1);
+  C2= Handle(Geom2d_TrimmedCurve)::DownCast(Geom2);
+//  Modified by Sergey KHROMOV - Thu Oct 24 19:02:46 2002 Begin
+// Add the same criterion as it is in MAT2d_Circuit::InitOpen(..)
+//  Standard_Real  TolAng = 1.E-5;
+  Standard_Real  TolAng = 1.E-8;
+//  Modified by Sergey KHROMOV - Thu Oct 24 19:02:47 2002 End
+
+  if (myJoinType == GeomAbs_Arc)
+  {
+    while (NbTest <= 10) {
+      if      ((ProVec)*Direction < -TolAng)                 
+        return Standard_True;                // Saillant.
+      if      ((ProVec)*Direction >  TolAng)
+        return Standard_False;              // Rentrant.
+      else { 
+        if (DotProd > 0) {
+          return Standard_False;            // Plat.
+        }
+        TolAng = 1.E-8;
+        Standard_Real U1 = C1->LastParameter()  - NbTest*DU;
+        Standard_Real U2 = C2->FirstParameter() + NbTest*DU;
+        gp_Dir2d Dir1(C1->DN(U1,1));
+        gp_Dir2d Dir2(C2->DN(U2,1));
+        DotProd = Dir1.Dot(Dir2);
+        ProVec  =  Dir1^Dir2;
+        NbTest++;
+      } 
+    }
+    
+    
+    
+    // Rebroussement.
+    // on calculde des paralleles aux deux courbes du cote du domaine
+    // de calcul
+    // Si pas dintersection => saillant.
+    // Sinon                => rentrant.
+    Standard_Real D ;
+    Standard_Real Tol   = Precision::Confusion();
+    Standard_Real MilC1 = (C1->LastParameter() + C1->FirstParameter())*0.5;
+    Standard_Real MilC2 = (C2->LastParameter() + C2->FirstParameter())*0.5;
+    gp_Pnt2d      P     = C1->Value(C1->LastParameter());
+    gp_Pnt2d      P1    = C1->Value(MilC1);
+    gp_Pnt2d      P2    = C2->Value(MilC2);
+    
+    D = Min(P1.Distance(P),P2.Distance(P));
+    D /= 10;
+    
+    if (Direction > 0.) D = -D;
+    
+    Handle(Geom2dAdaptor_HCurve) HC1 = new Geom2dAdaptor_HCurve(C1);
+    Handle(Geom2dAdaptor_HCurve) HC2 = new Geom2dAdaptor_HCurve(C2);
+    Adaptor3d_OffsetCurve OC1(HC1,D,MilC1,C1->LastParameter());
+    Adaptor3d_OffsetCurve OC2(HC2,D,C2->FirstParameter(),MilC2);
+    Geom2dInt_GInter Intersect; 
+    Intersect.Perform(OC1,OC2,Tol,Tol);
+    
+#ifdef DEB
+    static Standard_Boolean Affich = 0;
+    if (Affich) {
+#ifdef DRAW
+      Standard_Real DU1 = (OC1.LastParameter() - OC1.FirstParameter())/9.;
+      Standard_Real DU2 = (OC2.LastParameter() - OC2.FirstParameter())/9.;
+      for (Standard_Integer ki = 0; ki <= 9; ki++) {
+        gp_Pnt2d P1 = OC1.Value(OC1.FirstParameter()+ki*DU1);
+        gp_Pnt2d P2 = OC2.Value(OC2.FirstParameter()+ki*DU2);
+        Handle(Draw_Marker2D) dr1 = new Draw_Marker2D(P1,Draw_Plus,Draw_vert);
+        Handle(Draw_Marker2D) dr2 = new Draw_Marker2D(P2,Draw_Plus,Draw_rouge); 
+        dout << dr1;
+        dout << dr2;
+      }
+      dout.Flush();
+#endif
+    }
+#endif
+    
+    if (Intersect.IsDone() && !Intersect.IsEmpty()) {
+      return Standard_False;
+    }
+    else {
+      return Standard_True;
+    }
+  } //end of if (myJoinType == GeomAbs_Arc)
+  else if (myJoinType == GeomAbs_Intersection)
+  {
+    if (Abs(ProVec) <= TolAng &&
+        DotProd < 0)
+    {
+      while (NbTest <= 10)
+      {
+        Standard_Real U1 = C1->LastParameter()  - NbTest*DU;
+        Standard_Real U2 = C2->FirstParameter() + NbTest*DU;
+        gp_Dir2d Dir1(C1->DN(U1,1));
+        gp_Dir2d Dir2(C2->DN(U2,1));
+        DotProd = Dir1.Dot(Dir2);
+        ProVec  =  Dir1^Dir2;
+        if      ((ProVec)*Direction < -TolAng)                 
+          return Standard_True;                // Saillant.
+        if      ((ProVec)*Direction >  TolAng)
+          return Standard_False;              // Rentrant.
+        
+        NbTest++;
+      }
+      return Standard_False;
+    }
+    else
+      return Standard_False;
+  }
+  return Standard_False;
+}
+
 //=======================================================================
 //function : SubSequence
 //purpose  : 
@@ -736,103 +862,6 @@ static Standard_Real CrossProd(const Handle(Geom2d_Geometry)& Geom1,
 }
 
 
-//=======================================================================
-//function : IsSharpCorner
-//purpose  : Return True Si le point commun entre <Geom1> et <Geom2> est 
-//           une cassure saillante par rapport <Direction>
-//=======================================================================
-
-static Standard_Boolean IsSharpCorner (const Handle(Geom2d_Geometry)& Geom1,
-                                      const Handle(Geom2d_Geometry)& Geom2,
-                                      const Standard_Real&           Direction)
-{    
-  Standard_Real    DotProd;
-  Standard_Real    ProVec = CrossProd (Geom1,Geom2,DotProd);
-  Standard_Integer NbTest = 1;
-  Standard_Real    DU = Precision::Confusion();
-  Handle(Geom2d_TrimmedCurve) C1,C2;
-
-  C1= Handle(Geom2d_TrimmedCurve)::DownCast(Geom1);
-  C2= Handle(Geom2d_TrimmedCurve)::DownCast(Geom2);
-//  Modified by Sergey KHROMOV - Thu Oct 24 19:02:46 2002 Begin
-// Add the same criterion as it is in MAT2d_Circuit::InitOpen(..)
-//  Standard_Real  TolAng = 1.E-5;
-  Standard_Real  TolAng = 1.E-8;
-//  Modified by Sergey KHROMOV - Thu Oct 24 19:02:47 2002 End
-
-  while (NbTest <= 10) {
-    if      ((ProVec)*Direction < -TolAng)                 
-      return Standard_True;                // Saillant.
-    if      ((ProVec)*Direction >  TolAng)
-      return Standard_False;              // Rentrant.
-    else { 
-      if (DotProd > 0) {
-       return Standard_False;            // Plat.
-      }
-      TolAng = 1.E-8;
-      Standard_Real U1 = C1->LastParameter()  - NbTest*DU;
-      Standard_Real U2 = C2->FirstParameter() + NbTest*DU;
-      gp_Dir2d Dir1(C1->DN(U1,1));
-      gp_Dir2d Dir2(C2->DN(U2,1));
-      DotProd = Dir1.Dot(Dir2);
-      ProVec  =  Dir1^Dir2;
-      NbTest++;
-    } 
-  }
-  
-
-  
-  // Rebroussement.
-  // on calculde des paralleles aux deux courbes du cote du domaine
-  // de calcul
-  // Si pas dintersection => saillant.
-  // Sinon                => rentrant.
-  Standard_Real D ;
-  Standard_Real Tol   = Precision::Confusion();
-  Standard_Real MilC1 = (C1->LastParameter() + C1->FirstParameter())*0.5;
-  Standard_Real MilC2 = (C2->LastParameter() + C2->FirstParameter())*0.5;
-  gp_Pnt2d      P     = C1->Value(C1->LastParameter());
-  gp_Pnt2d      P1    = C1->Value(MilC1);
-  gp_Pnt2d      P2    = C2->Value(MilC2);
-  
-  D = Min(P1.Distance(P),P2.Distance(P));
-  D /= 10;
-
-  if (Direction > 0.) D = -D;
-  
-  Handle(Geom2dAdaptor_HCurve) HC1 = new Geom2dAdaptor_HCurve(C1);
-  Handle(Geom2dAdaptor_HCurve) HC2 = new Geom2dAdaptor_HCurve(C2);
-  Adaptor3d_OffsetCurve OC1(HC1,D,MilC1,C1->LastParameter());
-  Adaptor3d_OffsetCurve OC2(HC2,D,C2->FirstParameter(),MilC2);
-  Geom2dInt_GInter Intersect; 
-  Intersect.Perform(OC1,OC2,Tol,Tol);
-  
-#ifdef DEB
-  static Standard_Boolean Affich = 0;
-  if (Affich) {
-#ifdef DRAW
-    Standard_Real DU1 = (OC1.LastParameter() - OC1.FirstParameter())/9.;
-    Standard_Real DU2 = (OC2.LastParameter() - OC2.FirstParameter())/9.;
-    for (Standard_Integer ki = 0; ki <= 9; ki++) {
-      gp_Pnt2d P1 = OC1.Value(OC1.FirstParameter()+ki*DU1);
-      gp_Pnt2d P2 = OC2.Value(OC2.FirstParameter()+ki*DU2);
-      Handle(Draw_Marker2D) dr1 = new Draw_Marker2D(P1,Draw_Plus,Draw_vert);
-      Handle(Draw_Marker2D) dr2 = new Draw_Marker2D(P2,Draw_Plus,Draw_rouge); 
-      dout << dr1;
-      dout << dr2;
-    }
-    dout.Flush();
-#endif
-  }
-#endif
-  
-  if (Intersect.IsDone() && !Intersect.IsEmpty()) {
-    return Standard_False;
-  }
-  else {
-    return Standard_True;
-  }
-}
 
 
 
index 1b6cc0c..a5740f0 100644 (file)
@@ -21,7 +21,7 @@ class Tool2d from MAT2d
 
 
 uses
-
+    JoinType                  from GeomAbs,
     Bisec                     from Bisector,
     Side                      from MAT,
     Bisector                  from MAT,
@@ -47,6 +47,9 @@ is
        --- Purpose :<aSide> defines the side of the computation of the map. 
     is static;
 
+    SetJoinType(me : in out ; aJoinType : JoinType from GeomAbs)
+    is static;
+
     InitItems(me          : in out                    ; 
               aCircuit    :        Circuit from MAT2d )
        --- Purpose : InitItems cuts the line in Items.
@@ -220,6 +223,7 @@ is
 fields
 
     theDirection          : Real;
+    theJoinType           : JoinType from GeomAbs;
     theNumberOfBisectors  : Integer;
     theNumberOfPnts       : Integer;
     theNumberOfVecs       : Integer;
index a805575..73efc72 100644 (file)
@@ -100,6 +100,7 @@ static Standard_Real MAT2d_TOLCONF = 1.e-7;
 MAT2d_Tool2d::MAT2d_Tool2d()
 {
   theDirection         = 1.;
+  theJoinType = GeomAbs_Arc; //default
   theNumberOfBisectors = 0;
   theNumberOfVecs      = 0;
   theNumberOfPnts      = 0;
@@ -132,6 +133,15 @@ void MAT2d_Tool2d::Sense(const MAT_Side aside)
   else                  theDirection = -1.;
 }
 
+//=============================================================================
+//function : SetJoinType
+//purpose  :
+//=============================================================================
+void MAT2d_Tool2d::SetJoinType(const GeomAbs_JoinType aJoinType)
+{
+  theJoinType = aJoinType;
+}
+
 //=============================================================================
 //function : NumberOfItems
 //purpose  :
@@ -637,6 +647,9 @@ Standard_Boolean MAT2d_Tool2d::IsSameDistance (
   Standard_Real EpsDist = MAT2d_TOLCONF*100. ;
   Distance = Dist(1);
   for (Standard_Integer i = 1; i <= 4; i++){
+    if (theJoinType == GeomAbs_Intersection &&
+        Precision::IsInfinite(Dist(i)))
+      continue;
     if (Abs(Dist(i) - Distance) > EpsDist) {
       Distance = Precision::Infinite();
       return Standard_False;
diff --git a/tests/bugs/modalg_5/bug25298_01 b/tests/bugs/modalg_5/bug25298_01
new file mode 100755 (executable)
index 0000000..9605b8f
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+restore [locate_data_file bug25225_2869_open.brep] a
+
+smallview
+display a
+fit
+
+if [catch { openoffset resoffset a 1 10 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 193.986
+
+  set nb_v_good 4
+  set nb_e_good 3
+  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 8
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_02 b/tests/bugs/modalg_5/bug25298_02
new file mode 100755 (executable)
index 0000000..703805d
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+restore [locate_data_file bug25225_2869_open.brep] a
+
+smallview
+display a
+fit
+
+if [catch { openoffset resoffset a 1 -10 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 159.96
+
+  set nb_v_good 3
+  set nb_e_good 2
+  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 6
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_03 b/tests/bugs/modalg_5/bug25298_03
new file mode 100755 (executable)
index 0000000..326c06a
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+restore [locate_data_file bug25225_2869_open.brep] a
+
+smallview
+display a
+fit
+
+if [catch { mkoffset resoffset a 1 10 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 416.777
+
+  set nb_v_good 7
+  set nb_e_good 7
+  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 15
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_04 b/tests/bugs/modalg_5/bug25298_04
new file mode 100755 (executable)
index 0000000..41cc815
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+restore [locate_data_file bug25225_2869_closed.brep] a
+
+smallview
+display a
+fit
+
+if [catch { mkoffset resoffset a 1 -10 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 192.023
+
+  set nb_v_good 3
+  set nb_e_good 3
+  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 7
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_05 b/tests/bugs/modalg_5/bug25298_05
new file mode 100755 (executable)
index 0000000..aa09510
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+restore [locate_data_file bug25225_2869_closed.brep] a
+
+smallview
+display a
+fit
+
+if [catch { mkoffset resoffset a 1 10 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 403.249
+
+  set nb_v_good 4
+  set nb_e_good 4
+  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 9
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_06 b/tests/bugs/modalg_5/bug25298_06
new file mode 100755 (executable)
index 0000000..f1cc363
--- /dev/null
@@ -0,0 +1,40 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+circle cc 0 0 0 10
+trim cc cc pi 3*pi/2
+mkedge e1 cc
+polyline pp 0 -10 0 -10 -10 0 -10 0 0
+wire ww e1 pp
+
+smallview
+display ww
+fit
+
+if [catch { mkoffset resoffset ww 1 2. i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 49.1327
+
+  set nb_v_good 5
+  set nb_e_good 5
+  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 11
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_07 b/tests/bugs/modalg_5/bug25298_07
new file mode 100755 (executable)
index 0000000..d9a2cd1
--- /dev/null
@@ -0,0 +1,40 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+circle cc 0 0 0 10
+trim cc cc pi 3*pi/2
+mkedge e1 cc
+polyline pp 0 -10 0 -10 -10 0 -10 0 0
+wire ww e1 pp
+
+smallview
+display ww
+fit
+
+if [catch { mkoffset resoffset ww 1 -0.2 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 24.2333
+
+  set nb_v_good 3
+  set nb_e_good 3
+  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 7
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_08 b/tests/bugs/modalg_5/bug25298_08
new file mode 100755 (executable)
index 0000000..443f4b9
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+polyline pp 0 0 0 10 0 0 10 10 0 6 10 0 6 15 0 4 15 0 4 10 0 0 10 0 0 0 0
+
+smallview
+display pp
+fit
+
+if [catch { mkoffset resoffset pp 1 1. i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 58
+
+  set nb_v_good 8
+  set nb_e_good 8
+  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 17
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_09 b/tests/bugs/modalg_5/bug25298_09
new file mode 100755 (executable)
index 0000000..94f6354
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+polyline pp 0 0 0 10 0 0 10 10 0 6 10 0 6 15 0 4 15 0 4 10 0 0 10 0 0 0 0
+
+smallview
+display pp
+fit
+
+if [catch { mkoffset resoffset pp 1 -1. i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 42
+
+  set nb_v_good 6
+  set nb_e_good 7
+  set nb_w_good 2
+  set nb_f_good 0
+  set nb_sh_good 0
+  set nb_sol_good 0
+  set nb_compsol_good 0
+  set nb_compound_good 1
+  set nb_shape_good 16
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_10 b/tests/bugs/modalg_5/bug25298_10
new file mode 100755 (executable)
index 0000000..472a149
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+polyline pp 0 0 0 10 0 0 10 10 0 6 10 0 6 15 0 4 15 0 4 10 0 0 10 0 0 0 0
+
+smallview
+display pp
+fit
+
+if [catch { mkoffset resoffset pp 1 -0.2 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 48.4
+
+  set nb_v_good 8
+  set nb_e_good 8
+  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 17
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_11 b/tests/bugs/modalg_5/bug25298_11
new file mode 100755 (executable)
index 0000000..dfba616
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+polyline pp 0 0 0 10 0 0 10 10 0 6 10 0 6 15 0 4 15 0 4 10 0 0 10 0 0 0 0
+
+smallview
+display pp
+fit
+
+if [catch { mkoffset resoffset pp 1 -2. i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 24
+
+  set nb_v_good 5
+  set nb_e_good 5
+  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 11
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_12 b/tests/bugs/modalg_5/bug25298_12
new file mode 100755 (executable)
index 0000000..934b10a
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+polyline a 0 0 0 10 0 0 10 20 0 5 5 0 0 20 0 0 0 0
+
+smallview
+display a
+fit
+
+if [catch { mkoffset resoffset a 1 0.5 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 92.9473
+
+  set nb_v_good 5
+  set nb_e_good 5
+  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 11
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_13 b/tests/bugs/modalg_5/bug25298_13
new file mode 100755 (executable)
index 0000000..8a502f0
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+polyline a 0 0 0 10 0 0 10 20 0 5 5 0 0 20 0 0 0 0
+
+smallview
+display a
+fit
+
+if [catch { mkoffset resoffset a 1 -0.2 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 77.093
+
+  set nb_v_good 5
+  set nb_e_good 5
+  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 11
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_14 b/tests/bugs/modalg_5/bug25298_14
new file mode 100755 (executable)
index 0000000..b0f32e5
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+polyline a 0 0 0 10 0 0 10 20 0 5 5 0 0 20 0 0 0 0
+
+smallview
+display a
+fit
+
+if [catch { mkoffset resoffset a 1 -2.5 i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 10
+
+  set nb_v_good 6
+  set nb_e_good 6
+  set nb_w_good 2
+  set nb_f_good 0
+  set nb_sh_good 0
+  set nb_sol_good 0
+  set nb_compsol_good 0
+  set nb_compound_good 1
+  set nb_shape_good 15
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_15 b/tests/bugs/modalg_5/bug25298_15
new file mode 100755 (executable)
index 0000000..9bf89e7
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+restore [locate_data_file bug25298_Offset_Test.brep] a
+
+smallview
+display a
+fit
+
+if [catch { mkoffset resoffset a 1 5. i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 484.978
+
+  set nb_v_good 7
+  set nb_e_good 7
+  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 15
+
+  display result
+  fit
+}
+
+set only_screen_axo 1
diff --git a/tests/bugs/modalg_5/bug25298_16 b/tests/bugs/modalg_5/bug25298_16
new file mode 100755 (executable)
index 0000000..881a45f
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "OCC25298"
+puts "============"
+puts ""
+#######################################################################
+# New option of BRepOffsetAPI_MakeOffset algorithm: processing of sharp corners in mode GeomAbs_Intersection
+#######################################################################
+
+restore [locate_data_file bug25298_Offset_Test.brep] a
+
+smallview
+display a
+fit
+
+if [catch { mkoffset resoffset a 1 -5. i } ] {
+  puts "Error : mkoffset is wrong"
+} else {
+  renamevar resoffset_1 result
+
+  set length 409.27
+
+  set nb_v_good 7
+  set nb_e_good 7
+  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 15
+
+  display result
+  fit
+}
+
+set only_screen_axo 1