]> OCCT Git - occt.git/commitdiff
0028828: Modeling Algorithms - New functionalities of BRepFilletAPI_MakeChamfer algorithm IR-2018-11-16
authorjgv <jgv@opencascade.com>
Wed, 14 Jun 2017 13:28:15 +0000 (16:28 +0300)
committerapn <apn@opencascade.com>
Fri, 16 Nov 2018 16:16:05 +0000 (19:16 +0300)
Two new functionalities have been added in BRepFilletAPI_MakeChamfer:
- constant throat (the section of chamfer is isosceles triangle, its height is constant in all sections - this is the "throat" of the weld);
- constant throat with penetration(the section of chamfer is right-angled triangle, the first of two surfaces (where is the top of the chamfer) is virtually moved inside the solid by offset operation, the apex of the section is on the intersection curve between moved surface and second surface, right angle is at the top of the chamfer, the length of the leg from apex to top is constant - this is the "throat" of the weld).

- New abstract classes BlendFunc_GenChamfer and BlendFunc_GenChamfInv have been added;
- Class BlendFunc_Chamfer is now descended from BlendFunc_GenChamfer, class BlendFunc_ChamfInv is now descended from BlendFunc_GenChamfInv.
- New class BlendFunc_ConstThroat is descended from BlendFunc_GenChamfer, new class BlendFund_ConstThroatInv is descended from BlendFunc_GenChamfInv.
- New class BlendFunc_ConstThroatWithPenetration is descended from BlendFunc_GenChamfer, new class BlendFund_ConstThroatWithPenetrationInv is descended from BlendFunc_GenChamfInv.
- Class ChFi3d_ChBuilder has now mode of chamfer that can be ClassicChamfer, ConstThroatChamfer and ConstThroatWithPenetrationChamfer.
- Two new DRAW Test Harness commands "chamf_throat" ant "chamf_throat_with_penetration" have been added for the second mode of ChBuilder.
- The interface of DRAW Test Harness command "chamf" changed for symmetric case.

84 files changed:
dox/dev_guides/upgrade/upgrade.md
src/BRepBlend/BRepBlend_ConstThroat.hxx [new file with mode: 0644]
src/BRepBlend/BRepBlend_ConstThroatInv.hxx [new file with mode: 0644]
src/BRepBlend/BRepBlend_ConstThroatWithPenetration.hxx [new file with mode: 0644]
src/BRepBlend/BRepBlend_ConstThroatWithPenetrationInv.hxx [new file with mode: 0644]
src/BRepBlend/FILES
src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.cxx
src/BRepFilletAPI/BRepFilletAPI_MakeChamfer.hxx
src/BRepTest/BRepTest_ChamferCommands.cxx
src/Blend/Blend_AppFunction.hxx
src/Blend/Blend_Function.hxx
src/Blend/Blend_Walking_4.gxx
src/BlendFunc/BlendFunc_ChamfInv.cxx
src/BlendFunc/BlendFunc_ChamfInv.hxx
src/BlendFunc/BlendFunc_Chamfer.cxx
src/BlendFunc/BlendFunc_Chamfer.hxx
src/BlendFunc/BlendFunc_ConstThroat.cxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_ConstThroat.hxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_ConstThroatInv.cxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_ConstThroatInv.hxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_ConstThroatWithPenetration.cxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_ConstThroatWithPenetration.hxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.cxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.hxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_GenChamfInv.cxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_GenChamfInv.hxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_GenChamfer.cxx [new file with mode: 0644]
src/BlendFunc/BlendFunc_GenChamfer.hxx [new file with mode: 0644]
src/BlendFunc/FILES
src/ChFi3d/ChFi3d_Builder.hxx
src/ChFi3d/ChFi3d_Builder_0.cxx
src/ChFi3d/ChFi3d_Builder_0.hxx
src/ChFi3d/ChFi3d_Builder_1.cxx
src/ChFi3d/ChFi3d_Builder_2.cxx
src/ChFi3d/ChFi3d_Builder_6.cxx
src/ChFi3d/ChFi3d_ChBuilder.cxx
src/ChFi3d/ChFi3d_ChBuilder.hxx
src/ChFi3d/ChFi3d_FilBuilder.cxx
src/ChFiDS/ChFiDS_ChamfMode.hxx [new file with mode: 0644]
src/ChFiDS/ChFiDS_ChamfSpine.cxx
src/ChFiDS/ChFiDS_ChamfSpine.hxx
src/ChFiDS/ChFiDS_Spine.cxx
src/ChFiDS/ChFiDS_Spine.hxx
src/ChFiDS/ChFiDS_Spine.lxx
src/ChFiDS/FILES
src/ChFiKPart/ChFiKPart_ComputeData.cxx
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCon.cxx
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCon.hxx
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.cxx
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnCyl.hxx
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnPln.cxx
src/ChFiKPart/ChFiKPart_ComputeData_ChPlnPln.hxx
src/FilletSurf/FilletSurf_InternalBuilder.cxx
src/IntWalk/IntWalk_PWalking.cxx
src/IntWalk/IntWalk_PWalking.hxx
tests/bugs/modalg_2/bug20222
tests/bugs/modalg_5/bug25199
tests/bugs/modalg_6/bug28261
tests/bugs/modalg_7/bug27711 [deleted file]
tests/bugs/modalg_7/bug27711_1 [new file with mode: 0644]
tests/bugs/modalg_7/bug27711_2 [new file with mode: 0644]
tests/bugs/modalg_7/bug27711_3 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_1 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_10 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_11 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_12 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_13 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_14 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_15 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_16 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_17 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_18 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_19 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_2 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_20 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_21 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_3 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_4 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_6 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_7 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_8 [new file with mode: 0644]
tests/bugs/modalg_7/bug28828_9 [new file with mode: 0644]
tests/chamfer/begin
tests/chamfer/end

index 06fc1a0b362ca42923abff785a6de3bb78e2a662..641bc8df981a81f7e009cc1ac18b76aac8013e00 100644 (file)
@@ -1672,3 +1672,9 @@ Standard_Boolean meshing_new()
   return !aStatus;
 }
 ~~~~
+
+@subsection upgrade_740_chamfer Changes in API of Chamfer algorithms
+
+Some public methods of the class BRepFilletAPI_MakeChamfer are released from excess arguments:
+- method Add for symmetric chamfer now takes only 2 arguments: distance and edge;
+- method GetDistAngle now takes only 3 arguments: index of contour, distance and angle.
diff --git a/src/BRepBlend/BRepBlend_ConstThroat.hxx b/src/BRepBlend/BRepBlend_ConstThroat.hxx
new file mode 100644 (file)
index 0000000..3f0721d
--- /dev/null
@@ -0,0 +1,23 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepBlend_ConstThroat_HeaderFile
+#define _BRepBlend_ConstThroat_HeaderFile
+
+#include <BlendFunc_ConstThroat.hxx>
+
+typedef BlendFunc_ConstThroat BRepBlend_ConstThroat;
+
+
+#endif // _BRepBlend_ConstThroat_HeaderFile
diff --git a/src/BRepBlend/BRepBlend_ConstThroatInv.hxx b/src/BRepBlend/BRepBlend_ConstThroatInv.hxx
new file mode 100644 (file)
index 0000000..3284414
--- /dev/null
@@ -0,0 +1,23 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepBlend_ConstThroatInv_HeaderFile
+#define _BRepBlend_ConstThroatInv_HeaderFile
+
+#include <BlendFunc_ConstThroatInv.hxx>
+
+typedef BlendFunc_ConstThroatInv BRepBlend_ConstThroatInv;
+
+
+#endif // _BRepBlend_ConstThroatInv_HeaderFile
diff --git a/src/BRepBlend/BRepBlend_ConstThroatWithPenetration.hxx b/src/BRepBlend/BRepBlend_ConstThroatWithPenetration.hxx
new file mode 100644 (file)
index 0000000..6ed1452
--- /dev/null
@@ -0,0 +1,23 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepBlend_ConstThroatWithPenetration_HeaderFile
+#define _BRepBlend_ConstThroatWithPenetration_HeaderFile
+
+#include <BlendFunc_ConstThroatWithPenetration.hxx>
+
+typedef BlendFunc_ConstThroatWithPenetration BRepBlend_ConstThroatWithPenetration;
+
+
+#endif // _BRepBlend_ConstThroatWithPenetration_HeaderFile
diff --git a/src/BRepBlend/BRepBlend_ConstThroatWithPenetrationInv.hxx b/src/BRepBlend/BRepBlend_ConstThroatWithPenetrationInv.hxx
new file mode 100644 (file)
index 0000000..78940e0
--- /dev/null
@@ -0,0 +1,23 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BRepBlend_ConstThroatWithPenetrationInv_HeaderFile
+#define _BRepBlend_ConstThroatWithPenetrationInv_HeaderFile
+
+#include <BlendFunc_ConstThroatWithPenetrationInv.hxx>
+
+typedef BlendFunc_ConstThroatWithPenetrationInv BRepBlend_ConstThroatWithPenetrationInv;
+
+
+#endif // _BRepBlend_ConstThroatWithPenetrationInv_HeaderFile
index 1792efc1e72b502a17e600ded921fc7eb541e5a5..2c60b2d0d406c8fe3f78208360cd9436a8e9e70d 100644 (file)
@@ -16,6 +16,10 @@ BRepBlend_BlendTool.hxx
 BRepBlend_BlendTool.lxx
 BRepBlend_Chamfer.hxx
 BRepBlend_ChamfInv.hxx
+BRepBlend_ConstThroat.hxx
+BRepBlend_ConstThroatInv.hxx
+BRepBlend_ConstThroatWithPenetration.hxx
+BRepBlend_ConstThroatWithPenetrationInv.hxx
 BRepBlend_ChAsym.hxx
 BRepBlend_ChAsymInv.hxx
 BRepBlend_ConstRad.hxx
index bc8204567fc77fd888ad4065fec9f3337cf64ce5..25dbeb6190ebf4fdd7936a26159233664c7544d0 100644 (file)
@@ -55,10 +55,9 @@ void BRepFilletAPI_MakeChamfer::Add(const TopoDS_Edge &E )
 //=======================================================================
 
 void BRepFilletAPI_MakeChamfer::Add(const Standard_Real Dis, 
-                             const TopoDS_Edge &E,
-                             const TopoDS_Face &F)
+                                    const TopoDS_Edge &E)
 {
-  myBuilder.Add(Dis, E, F);
+  myBuilder.Add(Dis, E);
 }
 
 
@@ -162,12 +161,20 @@ void BRepFilletAPI_MakeChamfer::SetDistAngle(const Standard_Real Dis,
 //================================================================
 
 void BRepFilletAPI_MakeChamfer::GetDistAngle(const Standard_Integer IC,
-                                      Standard_Real&         Dis, 
-                                      Standard_Real&         Angle,
-                                      Standard_Boolean&      DisOnFace1) const
+                                             Standard_Real&         Dis, 
+                                             Standard_Real&         Angle) const
 {
-  myBuilder.GetDistAngle(IC, Dis, Angle, DisOnFace1);
+  myBuilder.GetDistAngle(IC, Dis, Angle);
+}
+
+//=======================================================================
+//function : SetMode
+//purpose  : 
+//=======================================================================
 
+void BRepFilletAPI_MakeChamfer::SetMode(const ChFiDS_ChamfMode theMode)
+{
+  myBuilder.SetMode(theMode);
 }
 
 //=======================================================================
index 421c69aa7d0c2c29a9372ab604353728a09225dc..ce6310d18d05f2bd7c0d985293fa1f7e49c47483 100644 (file)
@@ -62,9 +62,8 @@ public:
   
   //! Adds edge E to the table of edges used by this
   //! algorithm to build chamfers, where
-  //! the parameters of the chamfer are given by the two
-  //! distances Dis1 and Dis2; the face F identifies the side
-  //! where Dis1 is measured.
+  //! the parameters of the chamfer are given by
+  //! the distance Dis (symmetric chamfer).
   //! The Add function results in a contour being built by
   //! propagation from the edge E (i.e. the contour contains at
   //! least this edge). This contour is composed of edges of
@@ -73,7 +72,7 @@ public:
   //! series of faces being located on either side of the contour.
   //! Warning
   //! Nothing is done if edge E or the face F does not belong to the initial shape.
-  Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E, const TopoDS_Face& F);
+  Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E);
   
   //! Sets the distances Dis1 and Dis2 which give the
   //! parameters of the chamfer along the contour of index
@@ -87,9 +86,19 @@ public:
   
   Standard_EXPORT void GetDist (const Standard_Integer IC, Standard_Real& Dis) const;
   
-  //! Adds a  fillet contour in  the  builder  (builds a
-  //! contour  of tangent edges to <E> and sets the two
-  //! distances <Dis1> and <Dis2> ( parameters of the chamfer ) ).
+  //! Adds edge E to the table of edges used by this
+  //! algorithm to build chamfers, where
+  //! the parameters of the chamfer are given by the two
+  //! distances Dis1 and Dis2; the face F identifies the side
+  //! where Dis1 is measured.
+  //! The Add function results in a contour being built by
+  //! propagation from the edge E (i.e. the contour contains at
+  //! least this edge). This contour is composed of edges of
+  //! the shape which are tangential to one another and
+  //! which delimit two series of tangential faces, with one
+  //! series of faces being located on either side of the contour.
+  //! Warning
+  //! Nothing is done if edge E or the face F does not belong to the initial shape.
   Standard_EXPORT void Add (const Standard_Real Dis1, const Standard_Real Dis2, const TopoDS_Edge& E, const TopoDS_Face& F);
   
   //! Sets the distances Dis1 and Dis2 which give the
@@ -122,7 +131,10 @@ public:
   
   //! gives the distances <Dis> and <Angle> of the fillet
   //! contour of index <IC> in the DS
-  Standard_EXPORT void GetDistAngle (const Standard_Integer IC, Standard_Real& Dis, Standard_Real& Angle, Standard_Boolean& DisOnFace1) const;
+  Standard_EXPORT void GetDistAngle (const Standard_Integer IC, Standard_Real& Dis, Standard_Real& Angle) const;
+  
+  //! Sets the mode of chamfer
+  Standard_EXPORT void SetMode (const ChFiDS_ChamfMode theMode);
   
   //! return True if chamfer symetric false else.
   Standard_EXPORT Standard_Boolean IsSymetric (const Standard_Integer IC) const;
index 81fce19a2519d9101842adc7c822ac552d0d9b30..0d317e8174b44af6ca955c4beeec935ac42b10a7 100644 (file)
 
 #include <Precision.hxx>
 
+//===============================================================================
+// function : chamf_throat_with_penetration
+// purpose  : command to construct chamfers with constant throat with penetration
+//            on several edges
+//            Here the chamfer is propagated on tangential edges to the 
+//            required edge
+//===============================================================================
+static Standard_Integer chamf_throat_with_penetration(Draw_Interpretor& di,
+                                                      Standard_Integer narg, 
+                                                      const char** a)
+{
+  if (narg < 7)
+    return 1;
+
+  TopoDS_Shape S = DBRep::Get(a[2]);
+  if (S.IsNull()) return 1;
+  
+  TopoDS_Edge E;
+  TopoDS_Face F;
+  Standard_Real offset, throat;
+  Standard_Integer i      = 3;
+  Standard_Integer NbArg  = 4;
+  
+  BRepFilletAPI_MakeChamfer aMCh(S);
+  aMCh.SetMode(ChFiDS_ConstThroatWithPenetrationChamfer);
+  
+  while (i + NbArg <= narg) {
+    TopoDS_Shape aLocalEdge(DBRep::Get(a[i], TopAbs_EDGE));
+    E = TopoDS::Edge(aLocalEdge);
+    TopoDS_Shape aLocalFace(DBRep::Get(a[i + 1], TopAbs_FACE));
+    F = TopoDS::Face(aLocalFace);
+    //      E = TopoDS::Edge(DBRep::Get(a[i], TopAbs_EDGE));
+    //      F = TopoDS::Face(DBRep::Get(a[i + 1], TopAbs_FACE));
+    if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) )  {
+      offset = Draw::Atof(a[i + 2]);
+      throat = Draw::Atof(a[i + 3]);
+      
+      if (offset > Precision::Confusion() &&
+          throat > offset)
+        aMCh.Add(offset,throat,E ,F);
+    }
+    i += NbArg;
+  }
+  
+  // compute the chamfer and display the result
+  if (aMCh.NbContours() == 0 )
+  {
+    //cout<<"No suitable edges to chamfer"<<endl;
+    di<<"No suitable edges to chamfer\n";
+    return 1;
+  }
+  else aMCh.Build();
+  
+  if (aMCh.IsDone()){
+    DBRep::Set(a[1],aMCh);
+    return 0;
+  }
+  else {
+    //cout<<"compute of chamfer failed"<<endl;
+    di<<"compute of chamfer failed\n";
+    return 1;
+  }
+}
+
+//===============================================================================
+// function : chamf_throat
+// purpose  : command to construct chamfers with constant throat on several edges
+//            Here the chamfer is propagated on tangential edges to the 
+//            required edge
+//===============================================================================
+static Standard_Integer chamf_throat(Draw_Interpretor& di,
+                                     Standard_Integer narg, 
+                                     const char** a)
+{
+  if (narg < 5)
+    return 1;
+
+  TopoDS_Shape S = DBRep::Get(a[2]);
+  if (S.IsNull()) return 1;
+  
+  TopoDS_Edge E;
+  Standard_Real throat;
+  Standard_Integer i      = 3;
+  
+  BRepFilletAPI_MakeChamfer aMCh(S);
+  aMCh.SetMode(ChFiDS_ConstThroatChamfer);
+  
+  while (i + 1 < narg) {
+    TopoDS_Shape aLocalEdge(DBRep::Get(a[i], TopAbs_EDGE));
+    E = TopoDS::Edge(aLocalEdge);
+    if (!E.IsNull() && (aMCh.Contour(E) == 0) )  {
+      throat = Draw::Atof(a[i + 1]);
+      
+      if (throat > Precision::Confusion()) 
+        aMCh.Add(throat, E);
+    }
+    i += 2;
+  }
+  
+  // compute the chamfer and display the result
+  if (aMCh.NbContours() == 0 )
+  {
+    //cout<<"No suitable edges to chamfer"<<endl;
+    di<<"No suitable edges to chamfer\n";
+    return 1;
+  }
+  else aMCh.Build();
+  
+  if (aMCh.IsDone()){
+    DBRep::Set(a[1],aMCh);
+    return 0;
+  }
+  else {
+    //cout<<"compute of chamfer failed"<<endl;
+    di<<"compute of chamfer failed\n";
+    return 1;
+  }
+}
+
 //=========================================================================
 // function : chamfer
 // purpose  : command to construct chamfers on several edges
 //=========================================================================
  
 static Standard_Integer chamfer(Draw_Interpretor& di,
-                               Standard_Integer narg, 
-                               const char** a)
-     
+                                Standard_Integer narg, 
+                                const char** a)
 {
   // check the argument number of the command
   if (narg == 1) {
-    //cout <<" help for chamf : "<< endl;
-    //cout <<"   Construction by equal distances from edge          :  chamf newname shape edge face S dist"<< endl;
-    //cout <<"   Construction by two distances from edge            :  chamf newname shape edge face dist1 dist2"<< endl;
-    //cout <<"   Construction by distance from edge and given angle :  chamf newname shape edge face A dist angle"<< endl;
     di <<" help for chamf : \n";
-    di <<"   Construction by equal distances from edge          :  chamf newname shape edge face S dist\n";
+    di <<"   Construction by equal distances from edge          :  chamf newname shape edge dist\n";
     di <<"   Construction by two distances from edge            :  chamf newname shape edge face dist1 dist2\n";
     di <<"   Construction by distance from edge and given angle :  chamf newname shape edge face A dist angle\n";
   }
   else {
-    if (narg < 7) return 1;
+    if (narg < 5)
+      return 1;
   
     TopoDS_Shape S = DBRep::Get(a[2]);
-    if (S.IsNull()) return 1;
+    if (S.IsNull())
+      return 1;
 
     TopoDS_Edge E;
     TopoDS_Face F;
     Standard_Real d1,d2, angle;
     Standard_Integer i      = 3;
-    Standard_Integer Method = 1;
-    Standard_Integer NbArg  = 3;
 
     BRepFilletAPI_MakeChamfer aMCh(S);
 
-    if (!strcasecmp(a[i + 2], "S") ) Method = 0;
-
-    if (Method != 0) {
-      if (!strcasecmp(a[i + 2], "A")) {
-        Method = 2;
-        NbArg++;
-      }
-    }
-
-    while (i + NbArg < narg) {
+    while (i + 1 < narg) {
       TopoDS_Shape aLocalEdge(DBRep::Get(a[i], TopAbs_EDGE));
+      if (aLocalEdge.IsNull())
+        return 1;
       E = TopoDS::Edge(aLocalEdge);
       TopoDS_Shape aLocalFace(DBRep::Get(a[i + 1], TopAbs_FACE));
-      F = TopoDS::Face(aLocalFace);
-//      E = TopoDS::Edge(DBRep::Get(a[i], TopAbs_EDGE));
-//      F = TopoDS::Face(DBRep::Get(a[i + 1], TopAbs_FACE));
-      if (Method == 0) {
-        if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) )  {
-          d1 = Draw::Atof(a[i + 3]);
-
-          if ( d1 > Precision::Confusion()) 
-           aMCh.Add(d1,E ,F);
-        }
-        i += 4;
-      }
-      else if (Method == 1) {
-        if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) )  {
-          d1 = Draw::Atof(a[i + 2]);
-          d2 = Draw::Atof(a[i + 3]);
-      
-          if (   (d1 > Precision::Confusion())
-             && (d2 > Precision::Confusion()) )
-           aMCh.Add(d1,d2,E,F);
-        }
-        i += 4;
-      }
-      else {
-        if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) )  {
-          d1     = Draw::Atof(a[i + 3]);
-          angle  = Draw::Atof(a[i + 4]);
-          angle *= M_PI / 180.;
-      
-          if (   (d1 > Precision::Confusion())
-             && (angle > Precision::Confusion())
-              && (M_PI /  2.-  angle > Precision::Confusion()) )
-           aMCh.AddDA(d1, angle, E, F);
-        }
-        i += 5;
+      if (aLocalFace.IsNull())
+      {
+        //symmetric chamfer (one distance)
+        d1 = atof(a[i + 1]);
+        if (aMCh.Contour(E) == 0 &&
+            d1 > Precision::Confusion())
+          aMCh.Add(d1, E);
+        i += 2;
       }
+      else
+      {
+        F = TopoDS::Face(aLocalFace);
 
-      if ( i < narg) {
-        Method = 1;
-        NbArg  = 3;
-        if (!strcasecmp(a[i + 2], "S") ) Method = 0;
-
-        if (Method != 0) {
-          if (!strcasecmp(a[i + 2], "A")) {
-            Method = 2;
-            NbArg++;
+        if (i + 3 < narg)
+        {
+          if (!strcasecmp(a[i + 2], "A") &&
+              i + 4 < narg)
+          {
+            //chamfer with distance and angle
+            d1    = Draw::Atof(a[i + 3]);
+            angle = Draw::Atof(a[i + 4]);
+            angle *= M_PI / 180.;
+            if (aMCh.Contour(E) == 0 &&
+                d1    > Precision::Confusion() &&
+                angle > Precision::Confusion() &&
+                M_PI/2 - angle > Precision::Confusion())
+              aMCh.AddDA(d1, angle, E, F);
+            i += 5;
+          }
+          else
+          {
+            //chamfer with two distances
+            d1 = Draw::Atof(a[i + 2]);
+            d2 = Draw::Atof(a[i + 3]);
+            if (aMCh.Contour(E) == 0 &&
+                d1 > Precision::Confusion() &&
+                d2 > Precision::Confusion())
+              aMCh.Add(d1, d2, E, F);
+            i += 4;
           }
         }
-
       }
     }
 
@@ -150,8 +251,8 @@ static Standard_Integer chamfer(Draw_Interpretor& di,
       return 1;
     }
   }
-      return 0;
-
+  
+  return 0;
 }
 
 
@@ -177,4 +278,11 @@ void  BRepTest::ChamferCommands(Draw_Interpretor& theCommands)
   theCommands.Add("chamf",
                  "for help call chamf without arguments",__FILE__,chamfer,g);
 
+  theCommands.Add("chamf_throat",
+                 "chamf_throat result shape edge throat"
+                  ,__FILE__,chamf_throat,g);
+  
+  theCommands.Add("chamf_throat_with_penetration",
+                 "chamf_throat_with_penetration result shape edge face offset throat",
+                  __FILE__,chamf_throat_with_penetration,g);
 }
index a8fb943381a52a0025d40157ec7b0d18585bdbff..c604eb85e1d5a9b7da0c2f46412508169292c316 100644 (file)
@@ -74,7 +74,9 @@ public:
   //! <D> for the variable <X>.
   //! Returns True if the computation was done successfully,
   //! False otherwise.
-  Standard_EXPORT virtual Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) = 0;
+  Standard_EXPORT virtual Standard_Boolean Values (const math_Vector& X,
+                                                   math_Vector& F,
+                                                   math_Matrix& D) = 0;
   
   //! Sets the value of the parameter along the guide line.
   //! This determines the plane in which the solution has
@@ -90,7 +92,8 @@ public:
   //! Returns in the vector Tolerance the parametric tolerance
   //! for each of the 4 variables;
   //! Tol is the tolerance used in 3d space.
-  Standard_EXPORT virtual void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const = 0;
+  Standard_EXPORT virtual void GetTolerance (math_Vector& Tolerance,
+                                             const Standard_Real Tol) const = 0;
   
   //! Returns in the vector InfBound the lowest values allowed
   //! for each of the 4 variables.
@@ -102,7 +105,8 @@ public:
   //! Tol is the tolerance used in 3d space.
   //! The computation is made at the current value of
   //! the parameter on the guide line.
-  Standard_EXPORT virtual Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) = 0;
+  Standard_EXPORT virtual Standard_Boolean IsSolution (const math_Vector& Sol,
+                                                       const Standard_Real Tol) = 0;
   
   //! Returns   the    minimal  Distance  beetween   two
   //! extremitys of calculed sections.
@@ -135,16 +139,24 @@ public:
   //! for the parameters. i.e. T.Length() > NbIntervals()
   //! raises
   //! OutOfRange from Standard
-  Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const = 0;
+  Standard_EXPORT virtual void Intervals (TColStd_Array1OfReal& T,
+                                          const GeomAbs_Shape S) const = 0;
   
-  Standard_EXPORT virtual void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) = 0;
+  Standard_EXPORT virtual void GetShape (Standard_Integer& NbPoles,
+                                         Standard_Integer& NbKnots,
+                                         Standard_Integer& Degree,
+                                         Standard_Integer& NbPoles2d) = 0;
   
   //! Returns the tolerance to reach in approximation
   //! to respecte
   //! BoundTol error at the Boundary
   //! AngleTol tangent error at the Boundary
   //! SurfTol error inside the surface.
-  Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const = 0;
+  Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol,
+                                             const Standard_Real SurfTol,
+                                             const Standard_Real AngleTol,
+                                             math_Vector& Tol3d,
+                                             math_Vector& Tol1D) const = 0;
   
   Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) = 0;
   
@@ -153,16 +165,37 @@ public:
   //! Used for the first and last section
   //! The method returns Standard_True if the derivatives
   //! are computed, otherwise it returns Standard_False.
-  Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths) = 0;
-  
-  Standard_EXPORT virtual void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) = 0;
+  Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P,
+                                                    TColgp_Array1OfPnt& Poles,
+                                                    TColgp_Array1OfVec& DPoles,
+                                                    TColgp_Array1OfPnt2d& Poles2d,
+                                                    TColgp_Array1OfVec2d& DPoles2d,
+                                                    TColStd_Array1OfReal& Weigths,
+                                                    TColStd_Array1OfReal& DWeigths) = 0;
+  
+  Standard_EXPORT virtual void Section (const Blend_Point& P,
+                                        TColgp_Array1OfPnt& Poles,
+                                        TColgp_Array1OfPnt2d& Poles2d,
+                                        TColStd_Array1OfReal& Weigths) = 0;
   
   //! Used for the first and last section
   //! The method returns Standard_True if the derivatives
   //! are computed, otherwise it returns Standard_False.
-  Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfVec& D2Poles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColgp_Array1OfVec2d& D2Poles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths, TColStd_Array1OfReal& D2Weigths) = 0;
-  
-  Standard_EXPORT virtual void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const = 0;
+  Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P,
+                                                    TColgp_Array1OfPnt& Poles,
+                                                    TColgp_Array1OfVec& DPoles,
+                                                    TColgp_Array1OfVec& D2Poles,
+                                                    TColgp_Array1OfPnt2d& Poles2d,
+                                                    TColgp_Array1OfVec2d& DPoles2d,
+                                                    TColgp_Array1OfVec2d& D2Poles2d,
+                                                    TColStd_Array1OfReal& Weigths,
+                                                    TColStd_Array1OfReal& DWeigths,
+                                                    TColStd_Array1OfReal& D2Weigths) = 0;
+  
+  Standard_EXPORT virtual void Resolution (const Standard_Integer IC2d,
+                                           const Standard_Real Tol,
+                                           Standard_Real& TolU,
+                                           Standard_Real& TolV) const = 0;
   
   //! Returns  the parameter  of  the point  P. Used  to
   //! impose the parameters in the approximation.
index 7374b3139e00002c0cef3f028aab60208bbcde92..62d4d53e30a21ddaa3383214091023c626bc4b36 100644 (file)
@@ -56,55 +56,6 @@ public:
   //! Returns 4.
   Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE;
   
-  //! returns the number of equations of the function.
-  Standard_EXPORT virtual Standard_Integer NbEquations() const Standard_OVERRIDE = 0;
-  
-  //! computes the values <F> of the Functions for the
-  //! variable <X>.
-  //! Returns True if the computation was done successfully,
-  //! False otherwise.
-  Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE = 0;
-  
-  //! returns the values <D> of the derivatives for the
-  //! variable <X>.
-  //! Returns True if the computation was done successfully,
-  //! False otherwise.
-  Standard_EXPORT virtual Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE = 0;
-  
-  //! returns the values <F> of the functions and the derivatives
-  //! <D> for the variable <X>.
-  //! Returns True if the computation was done successfully,
-  //! False otherwise.
-  Standard_EXPORT virtual Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE = 0;
-  
-  //! Sets the value of the parameter along the guide line.
-  //! This determines the plane in which the solution has
-  //! to be found.
-  Standard_EXPORT virtual void Set (const Standard_Real Param) Standard_OVERRIDE = 0;
-  
-  //! Sets the bounds of the parametric interval on
-  //! the guide line.
-  //! This determines the derivatives in these values if the
-  //! function is not Cn.
-  Standard_EXPORT virtual void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE = 0;
-  
-  //! Returns in the vector Tolerance the parametric tolerance
-  //! for each of the 4 variables;
-  //! Tol is the tolerance used in 3d space.
-  Standard_EXPORT virtual void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE = 0;
-  
-  //! Returns in the vector InfBound the lowest values allowed
-  //! for each of the 4 variables.
-  //! Returns in the vector SupBound the greatest values allowed
-  //! for each of the 4 variables.
-  Standard_EXPORT virtual void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE = 0;
-  
-  //! Returns Standard_True if Sol is a zero of the function.
-  //! Tol is the tolerance used in 3d space.
-  //! The computation is made at the current value of
-  //! the parameter on the guide line.
-  Standard_EXPORT virtual Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE = 0;
-  
   //! Returns the point on the first support.
   Standard_EXPORT const gp_Pnt& Pnt1() const Standard_OVERRIDE;
   
@@ -143,36 +94,37 @@ public:
   //! at the beginning and the end of the section, and
   //! returns the normal (of the surfaces) at
   //! these points.
-  Standard_EXPORT virtual void Tangent (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, gp_Vec& TgFirst, gp_Vec& TgLast, gp_Vec& NormFirst, gp_Vec& NormLast) const = 0;
+  Standard_EXPORT virtual void Tangent (const Standard_Real U1,
+                                        const Standard_Real V1,
+                                        const Standard_Real U2,
+                                        const Standard_Real V2,
+                                        gp_Vec& TgFirst,
+                                        gp_Vec& TgLast,
+                                        gp_Vec& NormFirst,
+                                        gp_Vec& NormLast) const = 0;
   
   Standard_EXPORT virtual Standard_Boolean TwistOnS1() const;
   
   Standard_EXPORT virtual Standard_Boolean TwistOnS2() const;
   
-  Standard_EXPORT virtual void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE = 0;
-  
-  //! Returns the tolerance to reach in approximation
-  //! to respecte
-  //! BoundTol error at the Boundary
-  //! AngleTol tangent error at the Boundary
-  //! SurfTol error inside the surface.
-  Standard_EXPORT virtual void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const Standard_OVERRIDE = 0;
-  
-  Standard_EXPORT virtual void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE = 0;
-  
-  Standard_EXPORT virtual void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE = 0;
-  
-  //! Used for the first and last section
-  //! The method returns Standard_True if the derivatives
-  //! are computed, otherwise it returns Standard_False.
-  Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE = 0;
-  
-  Standard_EXPORT virtual void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE = 0;
+  Standard_EXPORT virtual void Section (const Blend_Point& P,
+                                        TColgp_Array1OfPnt& Poles,
+                                        TColgp_Array1OfPnt2d& Poles2d,
+                                        TColStd_Array1OfReal& Weigths) Standard_OVERRIDE = 0;
   
   //! Used for the first and last section
   //! The method returns Standard_True if the derivatives
   //! are computed, otherwise it returns Standard_False
-  Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfVec& D2Poles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColgp_Array1OfVec2d& D2Poles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths, TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_Boolean Section (const Blend_Point& P,
+                                                    TColgp_Array1OfPnt& Poles,
+                                                    TColgp_Array1OfVec& DPoles,
+                                                    TColgp_Array1OfVec& D2Poles,
+                                                    TColgp_Array1OfPnt2d& Poles2d,
+                                                    TColgp_Array1OfVec2d& DPoles2d,
+                                                    TColgp_Array1OfVec2d& D2Poles2d,
+                                                    TColStd_Array1OfReal& Weigths,
+                                                    TColStd_Array1OfReal& DWeigths,
+                                                    TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE;
 
 
 
index 35c38f2a03f626133a5e82910b307bc3fac44b28..85a766a4a5d1a385f338670cc3da607bbc36b39c 100644 (file)
 #include <Extrema_ExtPS.hxx>
 #include <Extrema_ExtPC.hxx>
 
+#ifdef DRAW
+#include <DrawTrSurf.hxx>
+#endif
+
+
 static const Standard_Real CosRef3D = 0.88;
 
 static void RecadreIfPeriodic(Standard_Real& NewU,
@@ -483,6 +488,16 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
        else {
          line->Prepend(previousP);
        }
+#ifdef DRAW
+        Standard_Integer nbpts = line->NbPoints();
+        char name [100];
+        sprintf(name, "pg%d", nbpts);
+        DrawTrSurf::Set(name, PtOnGuide);
+        sprintf(name, "p1_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS1());
+        sprintf(name, "p2_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS2());
+#endif
 
        parprec = param;
 
@@ -551,6 +566,16 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
        else {
          line->Prepend(previousP);
        }
+#ifdef DRAW
+        Standard_Integer nbpts = line->NbPoints();
+        char name [100];
+        sprintf(name, "pg%d", nbpts);
+        DrawTrSurf::Set(name, PtOnGuide);
+        sprintf(name, "p1_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS1());
+        sprintf(name, "p2_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS2());
+#endif
 
        parprec = param;
 
@@ -588,6 +613,17 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
        else {
          line->Prepend(previousP);
        }
+#ifdef DRAW
+        Standard_Integer nbpts = line->NbPoints();
+        char name [100];
+        sprintf(name, "pg%d", nbpts);
+        DrawTrSurf::Set(name, PtOnGuide);
+        sprintf(name, "p1_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS1());
+        sprintf(name, "p2_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS2());
+#endif
+
        MakeExtremity(Ext1,Standard_True,Index1,
                      solrst1(1),Isvtx1,Vtx1);
         // On blinde le cas singulier ou un des recadrage a planter
@@ -613,6 +649,17 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
        else {
          line->Prepend(previousP);
        }
+#ifdef DRAW
+        Standard_Integer nbpts = line->NbPoints();
+        char name [100];
+        sprintf(name, "pg%d", nbpts);
+        DrawTrSurf::Set(name, PtOnGuide);
+        sprintf(name, "p1_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS1());
+        sprintf(name, "p2_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS2());
+#endif
+
         // On blinde le cas singulier ou un des recadrage a plante
         if (previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2*tolesp)) {
          Ext1.SetValue(previousP.PointOnS2(),
@@ -639,6 +686,16 @@ void Blend_Walking::InternalPerform(Blend_Function& Func,
        else {
          line->Prepend(previousP);
        }
+#ifdef DRAW
+        Standard_Integer nbpts = line->NbPoints();
+        char name [100];
+        sprintf(name, "pg%d", nbpts);
+        DrawTrSurf::Set(name, PtOnGuide);
+        sprintf(name, "p1_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS1());
+        sprintf(name, "p2_%d", nbpts);
+        DrawTrSurf::Set(name, previousP.PointOnS2());
+#endif
 
        if ( (Isvtx1 != Isvtx2) &&
            (previousP.PointOnS1().IsEqual(previousP.PointOnS2(), 2*tolesp)) ) {
index c576f72c8076cbf0bf9f50bfd975fb5fc24ee9ed..762d72ef766d5f84ad89294852858dd415a2d14d 100644 (file)
 //function : BlendFunc_ChamfInv
 //purpose  : 
 //=======================================================================
+
 BlendFunc_ChamfInv::BlendFunc_ChamfInv(const Handle(Adaptor3d_HSurface)& S1,
                                        const Handle(Adaptor3d_HSurface)& S2,
-                                       const Handle(Adaptor3d_HCurve)&   C) :
-       surf1(S1),surf2(S2),curv(C),corde1(surf1,curv),corde2(surf2,curv)
+                                       const Handle(Adaptor3d_HCurve)&   C)
+  : BlendFunc_GenChamfInv(S1,S2,C),
+    corde1(surf1,curv),corde2(surf2,curv)
 {
 }
 
@@ -83,97 +85,6 @@ void BlendFunc_ChamfInv::Set(const Standard_Real Dist1, const Standard_Real Dist
   corde2.SetDist(dis2);
 }
 
-//=======================================================================
-//function : NbEquations
-//purpose  : 
-//=======================================================================
-
-Standard_Integer BlendFunc_ChamfInv::NbEquations () const
-{
-  return 4;
-}
-
-//=======================================================================
-//function : GetTolerance
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_ChamfInv::Set(const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& C)
-{
-  first = OnFirst;
-  csurf = C;
-}
-
-//=======================================================================
-//function : GetTolerance
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_ChamfInv::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
-{
-  Tolerance(1) = csurf->Resolution(Tol);
-  Tolerance(2) = curv->Resolution(Tol);
-  if (first) {
-    Tolerance(3) = surf2->UResolution(Tol);
-    Tolerance(4) = surf2->VResolution(Tol);
-  }
-  else {
-    Tolerance(3) = surf1->UResolution(Tol);
-    Tolerance(4) = surf1->VResolution(Tol);
-  }
-}
-
-
-//=======================================================================
-//function : GetBounds
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_ChamfInv::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
-{
-  InfBound(1) = csurf->FirstParameter();
-  InfBound(2) = curv->FirstParameter();
-  SupBound(1) = csurf->LastParameter();
-  SupBound(2) = curv->LastParameter();
-
-  if (first) {
-    InfBound(3) = surf2->FirstUParameter();
-    InfBound(4) = surf2->FirstVParameter();
-    SupBound(3) = surf2->LastUParameter();
-    SupBound(4) = surf2->LastVParameter();
-    if(!Precision::IsInfinite(InfBound(3)) &&
-       !Precision::IsInfinite(SupBound(3))) {
-      const Standard_Real range = (SupBound(3) - InfBound(3));
-      InfBound(3) -= range;
-      SupBound(3) += range;
-    }
-    if(!Precision::IsInfinite(InfBound(4)) &&
-       !Precision::IsInfinite(SupBound(4))) {
-      const Standard_Real range = (SupBound(4) - InfBound(4));
-      InfBound(4) -= range;
-      SupBound(4) += range;
-    }
-  }
-  else {
-    InfBound(3) = surf1->FirstUParameter();
-    InfBound(4) = surf1->FirstVParameter();
-    SupBound(3) = surf1->LastUParameter();
-    SupBound(4) = surf1->LastVParameter();
-    if(!Precision::IsInfinite(InfBound(3)) &&
-       !Precision::IsInfinite(SupBound(3))) {
-      const Standard_Real range = (SupBound(3) - InfBound(3));
-      InfBound(3) -= range;
-      SupBound(3) += range;
-    }
-    if(!Precision::IsInfinite(InfBound(4)) &&
-       !Precision::IsInfinite(SupBound(4))) {
-      const Standard_Real range = (SupBound(4) - InfBound(4));
-      InfBound(4) -= range;
-      SupBound(4) += range;
-    }
-  }    
-}
-
 //=======================================================================
 //function : IsSolution
 //purpose  : 
@@ -207,7 +118,6 @@ Standard_Boolean BlendFunc_ChamfInv::IsSolution(const math_Vector& Sol, const St
 
 }
 
-
 //=======================================================================
 //function : Value
 //purpose  : 
@@ -324,15 +234,3 @@ Standard_Boolean BlendFunc_ChamfInv::Derivatives(const math_Vector& X, math_Matr
 
   return Standard_True;
 } 
-
-//=======================================================================
-//function : Values
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean BlendFunc_ChamfInv::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
-{
-  Value(X,F);
-  Derivatives(X,D);
-  return Standard_True;
-}
index c8cedca4c788816e526ce8fdb7c2fde7d21906d5..d0faafc74fd2f2969271d351c5c2cd8feeeed751 100644 (file)
@@ -24,7 +24,7 @@
 #include <Standard_Integer.hxx>
 #include <Standard_Boolean.hxx>
 #include <BlendFunc_Corde.hxx>
-#include <Blend_FuncInv.hxx>
+#include <BlendFunc_GenChamfInv.hxx>
 #include <math_Vector.hxx>
 #include <Standard_Real.hxx>
 class Adaptor3d_HSurface;
@@ -34,7 +34,9 @@ class math_Matrix;
 
 
 
-class BlendFunc_ChamfInv  : public Blend_FuncInv
+//! Class for a function used to compute a chamfer with two constant distances
+//! on a surface's boundary
+class BlendFunc_ChamfInv  : public BlendFunc_GenChamfInv
 {
 public:
 
@@ -43,17 +45,8 @@ public:
   
   Standard_EXPORT BlendFunc_ChamfInv(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_HCurve)& C);
   
-  Standard_EXPORT void Set (const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& COnSurf) Standard_OVERRIDE;
-  
-  Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE;
-  
-  Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE;
-  
   Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
   
-  //! returns the number of equations of the function.
-  Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
-  
   //! computes the values <F> of the Functions for the
   //! variable <X>.
   //! Returns True if the computation was done successfully,
@@ -65,14 +58,12 @@ public:
   //! Returns True if the computation was done successfully,
   //! False otherwise.
   Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
+
+  using Blend_FuncInv::Set;
   
-  //! returns the values <F> of the functions and the derivatives
-  //! <D> for the variable <X>.
-  //! Returns True if the computation was done successfully,
-  //! False otherwise.
-  Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE;
-  
-  Standard_EXPORT void Set (const Standard_Real Dist1, const Standard_Real Dist2, const Standard_Integer Choix);
+  Standard_EXPORT virtual void Set (const Standard_Real Dist1,
+                                    const Standard_Real Dist2,
+                                    const Standard_Integer Choix) Standard_OVERRIDE;
 
 
 
@@ -87,12 +78,6 @@ private:
 
 
 
-  Handle(Adaptor3d_HSurface) surf1;
-  Handle(Adaptor3d_HSurface) surf2;
-  Handle(Adaptor3d_HCurve) curv;
-  Handle(Adaptor2d_HCurve2d) csurf;
-  Standard_Integer choix;
-  Standard_Boolean first;
   BlendFunc_Corde corde1;
   BlendFunc_Corde corde2;
 
index 80aa5219000790a3699b61f7bf29ef1882913a85..8e7c7a47e2975b59ff5ae6bf66ee82f041ca990d 100644 (file)
 //function : BlendFunc_Chamfer
 //purpose  : 
 //=======================================================================
+
 BlendFunc_Chamfer::BlendFunc_Chamfer(const Handle(Adaptor3d_HSurface)& S1,
                                      const Handle(Adaptor3d_HSurface)& S2,
-                                     const Handle(Adaptor3d_HCurve)&   CG) :
-    surf1(S1),surf2(S2),
-       curv(CG),
-       distmin(RealLast()),
-       corde1(S1,CG),corde2(S2,CG)
-{
-}
-
-//=======================================================================
-//function : NbEquations
-//purpose  : 
-//=======================================================================
-
-Standard_Integer BlendFunc_Chamfer::NbEquations () const
+                                     const Handle(Adaptor3d_HCurve)&   CG)
+  : BlendFunc_GenChamfer(S1,S2,CG),
+    corde1(S1,CG),corde2(S2,CG)
 {
-  return 4;
 }
 
-
 //=======================================================================
 //function : Set
 //purpose  : 
@@ -80,54 +68,6 @@ void BlendFunc_Chamfer::Set(const Standard_Real Param)
   corde2.SetParam(Param);
 }
 
-//=======================================================================
-//function : Set
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_Chamfer::Set(const Standard_Real, const Standard_Real)
-{
-}
-
-//=======================================================================
-//function : GetTolerance
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_Chamfer::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
-{
-  Tolerance(1) = surf1->UResolution(Tol);
-  Tolerance(2) = surf1->VResolution(Tol);
-  Tolerance(3) = surf2->UResolution(Tol);
-  Tolerance(4) = surf2->VResolution(Tol);
-}
-
-//=======================================================================
-//function : GetBounds
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_Chamfer::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
-{
-  InfBound(1) = surf1->FirstUParameter();
-  InfBound(2) = surf1->FirstVParameter();
-  InfBound(3) = surf2->FirstUParameter();
-  InfBound(4) = surf2->FirstVParameter();
-  SupBound(1) = surf1->LastUParameter();
-  SupBound(2) = surf1->LastVParameter();
-  SupBound(3) = surf2->LastUParameter();
-  SupBound(4) = surf2->LastVParameter();
-
-  for(Standard_Integer i = 1; i <= 4; i++){
-    if(!Precision::IsInfinite(InfBound(i)) &&
-       !Precision::IsInfinite(SupBound(i))) {
-      const Standard_Real range = (SupBound(i) - InfBound(i));
-      InfBound(i) -= range;
-      SupBound(i) += range;
-    }
-  }
-}
-
 //=======================================================================
 //function : IsSolution
 //purpose  : 
@@ -151,16 +91,6 @@ Standard_Boolean BlendFunc_Chamfer::IsSolution(const math_Vector& Sol, const Sta
   return issol;
 }
 
-//=======================================================================
-//function : GetMinimalDistance
-//purpose  : 
-//=======================================================================
-
-Standard_Real BlendFunc_Chamfer::GetMinimalDistance() const
-{
-  return distmin;
-}
-
 //=======================================================================
 //function : Value
 //purpose  : 
@@ -214,17 +144,6 @@ Standard_Boolean BlendFunc_Chamfer::Derivatives(const math_Vector& X, math_Matri
   return Standard_True;
 }
 
-//=======================================================================
-//function : Values
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean BlendFunc_Chamfer::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
-{
-  Standard_Boolean val = Value(X,F);
-  return (val && Derivatives(X,D));
-}
-
 //=======================================================================
 //function : PointOnS1
 //purpose  : 
@@ -343,41 +262,6 @@ void BlendFunc_Chamfer::Tangent(const Standard_Real U1,
     TgL.Reverse();
 }
 
-//=======================================================================
-//function : Section
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_Chamfer::Section(const Standard_Real /*Param*/,
-                               const Standard_Real U1,
-                               const Standard_Real V1,
-                               const Standard_Real U2,
-                               const Standard_Real V2,
-                               Standard_Real& Pdeb,
-                               Standard_Real& Pfin,
-                               gp_Lin& C)
-{
-  const gp_Pnt pts1 = surf1->Value(U1,V1);
-  const gp_Pnt pts2 = surf2->Value(U2,V2);
-  const gp_Dir dir( gp_Vec(pts1,pts2) );
-
-  C.SetLocation(pts1);
-  C.SetDirection(dir);
-
-  Pdeb = 0.;
-  Pfin = ElCLib::Parameter(C,pts2);
-}  
-
-//=======================================================================
-//function : IsRational
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean BlendFunc_Chamfer::IsRational() const
-{
-  return Standard_False;
-}
-
 //=======================================================================
 //function : GetSectionSize
 //purpose  : Non implementee (non necessaire car non rationel)
@@ -386,205 +270,3 @@ Standard_Real BlendFunc_Chamfer::GetSectionSize() const
 {
   throw Standard_NotImplemented("BlendFunc_Chamfer::GetSectionSize()");
 }
-
-//=======================================================================
-//function : GetMinimalWeight
-//purpose  : 
-//=======================================================================
-void BlendFunc_Chamfer::GetMinimalWeight(TColStd_Array1OfReal& Weights) const 
-{
-  Weights.Init(1);
-}
-
-
-//=======================================================================
-//function : NbIntervals
-//purpose  : 
-//=======================================================================
-
-Standard_Integer BlendFunc_Chamfer::NbIntervals (const GeomAbs_Shape S) const
-{
-  return  curv->NbIntervals(BlendFunc::NextShape(S));
-}
-
-
-//=======================================================================
-//function : Intervals
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_Chamfer::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
-{
-  curv->Intervals(T, BlendFunc::NextShape(S)); 
-}
-
-//=======================================================================
-//function : GetShape
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_Chamfer::GetShape (Standard_Integer& NbPoles,
-                                 Standard_Integer& NbKnots,
-                                 Standard_Integer& Degree,
-                                 Standard_Integer& NbPoles2d)
-{
-  NbPoles = 2;
-  NbPoles2d = 2;
-  NbKnots = 2;
-  Degree = 1;  
-}
-  
-//=======================================================================
-//function : GetTolerance
-//purpose  : Determine les Tolerance a utiliser dans les approximations.
-//=======================================================================
-void BlendFunc_Chamfer::GetTolerance(const Standard_Real BoundTol, 
-                                    const Standard_Real, 
-                                    const Standard_Real, 
-                                    math_Vector& Tol3d, 
-                                    math_Vector&) const
-{
-  Tol3d.Init(BoundTol);
-}
-
-//=======================================================================
-//function : Knots
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_Chamfer::Knots(TColStd_Array1OfReal& TKnots)
-{
-  TKnots(1) = 0.;
-  TKnots(2) = 1.;
-}
-
-
-//=======================================================================
-//function : Mults
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_Chamfer::Mults(TColStd_Array1OfInteger& TMults)
-{
-  TMults(1) = 2;
-  TMults(2) = 2;
-}
-
-//=======================================================================
-//function : Section
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean BlendFunc_Chamfer::Section
-  (const Blend_Point& /*P*/,
-   TColgp_Array1OfPnt& /*Poles*/,
-   TColgp_Array1OfVec& /*DPoles*/,
-   TColgp_Array1OfVec& /*D2Poles*/,
-   TColgp_Array1OfPnt2d& /*Poles2d*/,
-   TColgp_Array1OfVec2d& /*DPoles2d*/,
-   TColgp_Array1OfVec2d& /*D2Poles2d*/,
-   TColStd_Array1OfReal& /*Weights*/,
-   TColStd_Array1OfReal& /*DWeights*/,
-   TColStd_Array1OfReal& /*D2Weights*/)
-{
-   return Standard_False;
-}
-
-//=======================================================================
-//function : Section
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean BlendFunc_Chamfer::Section
-  (const Blend_Point& P,
-   TColgp_Array1OfPnt& Poles,
-   TColgp_Array1OfVec& DPoles,
-   TColgp_Array1OfPnt2d& Poles2d,
-   TColgp_Array1OfVec2d& DPoles2d,
-   TColStd_Array1OfReal& Weights,
-   TColStd_Array1OfReal& DWeights)
-{
-  math_Vector sol(1,4),valsol(1,4),secmember(1,4);
-  math_Matrix gradsol(1,4,1,4);
-
-  Standard_Real prm = P.Parameter();
-  Standard_Integer low = Poles.Lower();
-  Standard_Integer upp = Poles.Upper();
-  Standard_Boolean istgt;
-
-  P.ParametersOnS1(sol(1),sol(2));
-  P.ParametersOnS2(sol(3),sol(4));
-
-  Set(prm);
-  
-  Values(sol,valsol,gradsol);
-  IsSolution(sol,tol); 
-
-  istgt = IsTangencyPoint();
-
-  Poles2d(Poles2d.Lower()).SetCoord(sol(1),sol(2));
-  Poles2d(Poles2d.Upper()).SetCoord(sol(3),sol(4));
-  if (!istgt) {
-  DPoles2d(Poles2d.Lower()).SetCoord(Tangent2dOnS1().X(),
-                                    Tangent2dOnS1().Y());
-  DPoles2d(Poles2d.Upper()).SetCoord(Tangent2dOnS2().X(),
-                                    Tangent2dOnS2().Y());
-  }
-  Poles(low) = PointOnS1();
-  Poles(upp) = PointOnS2();
-  Weights(low) = 1.0;
-  Weights(upp) = 1.0;
-  if (!istgt) {
-    DPoles(low) = TangentOnS1();
-    DPoles(upp) = TangentOnS2();
-    DWeights(low) = 0.0;
-    DWeights(upp) = 0.0;  
-  }
-
-  return (!istgt);
-}
-
-//=======================================================================
-//function : Section
-//purpose  : 
-//=======================================================================
-
-void BlendFunc_Chamfer::Section(const Blend_Point& P,
-                               TColgp_Array1OfPnt& Poles,
-                               TColgp_Array1OfPnt2d& Poles2d,
-                               TColStd_Array1OfReal& Weights)
-{
-  Standard_Real u1,v1,u2,v2,prm = P.Parameter();
-  Standard_Integer low = Poles.Lower();
-  Standard_Integer upp = Poles.Upper();
-  math_Vector X(1,4), F(1,4);
-
-  P.ParametersOnS1(u1,v1);
-  P.ParametersOnS2(u2,v2);
-  X(1)=u1;
-  X(2)=v1;
-  X(3)=u2;
-  X(4)=v2;
-  Poles2d(Poles2d.Lower()).SetCoord(u1,v1);
-  Poles2d(Poles2d.Upper()).SetCoord(u2,v2);
-
-  Set(prm);
-  Value(X,F);
-  Poles(low) = PointOnS1();
-  Poles(upp) = PointOnS2();
-  Weights(low) = 1.0;
-  Weights(upp) = 1.0;
-}
-
-void BlendFunc_Chamfer::Resolution(const Standard_Integer IC2d, const Standard_Real Tol,
-                                   Standard_Real& TolU, Standard_Real& TolV) const
-{
-  if(IC2d == 1){
-    TolU = surf1->UResolution(Tol);
-    TolV = surf1->VResolution(Tol);
-  }
-  else {
-    TolU = surf2->UResolution(Tol);
-    TolV = surf2->VResolution(Tol);
-  }
-}
index 30a98b9a7c4a1a638f6c404afbc1cdeaf8ca9302..bce30b50ff9dcfe5e7a27f3b459126efc2c7030e 100644 (file)
@@ -24,7 +24,7 @@
 #include <Standard_Integer.hxx>
 #include <Standard_Real.hxx>
 #include <BlendFunc_Corde.hxx>
-#include <Blend_Function.hxx>
+#include <BlendFunc_GenChamfer.hxx>
 #include <Standard_Boolean.hxx>
 #include <math_Vector.hxx>
 #include <TColStd_Array1OfReal.hxx>
@@ -45,7 +45,9 @@ class Blend_Point;
 
 
 
-class BlendFunc_Chamfer  : public Blend_Function
+//! Class for a function used to compute a "ordinary" chamfer:
+//! when distances from spine to surfaces are constant
+class BlendFunc_Chamfer  : public BlendFunc_GenChamfer
 {
 public:
 
@@ -54,9 +56,6 @@ public:
   
   Standard_EXPORT BlendFunc_Chamfer(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_HCurve)& CG);
   
-  //! returns the number of equations of the function.
-  Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
-  
   //! computes the values <F> of the Functions for the
   //! variable <X>.
   //! Returns True if the computation was done successfully,
@@ -69,26 +68,10 @@ public:
   //! False otherwise.
   Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
   
-  //! returns the values <F> of the functions and the derivatives
-  //! <D> for the variable <X>.
-  //! Returns True if the computation was done successfully,
-  //! False otherwise.
-  Standard_EXPORT Standard_Boolean Values (const math_Vector& X, math_Vector& F, math_Matrix& D) Standard_OVERRIDE;
-  
   Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE;
   
-  Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
-  
-  Standard_EXPORT void GetTolerance (math_Vector& Tolerance, const Standard_Real Tol) const Standard_OVERRIDE;
-  
-  Standard_EXPORT void GetBounds (math_Vector& InfBound, math_Vector& SupBound) const Standard_OVERRIDE;
-  
   Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
   
-  //! Returns   the    minimal  Distance  beetween   two
-  //! extremitys of calculed sections.
-  Standard_EXPORT Standard_Real GetMinimalDistance() const Standard_OVERRIDE;
-  
   Standard_EXPORT const gp_Pnt& PointOnS1() const Standard_OVERRIDE;
   
   Standard_EXPORT const gp_Pnt& PointOnS2() const Standard_OVERRIDE;
@@ -110,56 +93,11 @@ public:
   Standard_EXPORT void Tangent (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, gp_Vec& TgFirst, gp_Vec& TgLast, gp_Vec& NormFirst, gp_Vec& NormLast) const Standard_OVERRIDE;
   
   //! Sets the distances and the "quadrant".
-  Standard_EXPORT void Set (const Standard_Real Dist1, const Standard_Real Dist2, const Standard_Integer Choix);
-  
-  //! Returns False
-  Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
+  Standard_EXPORT void Set (const Standard_Real Dist1, const Standard_Real Dist2, const Standard_Integer Choix) Standard_OVERRIDE;
   
   //! Returns the length of the maximum section
   Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE;
   
-  //! Compute the minimal value of weight for each poles
-  //! of all sections.
-  Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE;
-  
-  //! Returns  the number  of  intervals for  continuity
-  //! <S>. May be one if Continuity(me) >= <S>
-  Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
-  
-  //! Stores in <T> the  parameters bounding the intervals
-  //! of continuity <S>.
-  //!
-  //! The array must provide  enough room to  accomodate
-  //! for the parameters. i.e. T.Length() > NbIntervals()
-  //! raises
-  //! OutOfRange from Standard
-  Standard_EXPORT void Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
-  
-  Standard_EXPORT void GetShape (Standard_Integer& NbPoles, Standard_Integer& NbKnots, Standard_Integer& Degree, Standard_Integer& NbPoles2d) Standard_OVERRIDE;
-  
-  //! Returns the tolerance to reach in approximation
-  //! to respecte
-  //! BoundTol error at the Boundary
-  //! AngleTol tangent error at the Boundary
-  //! SurfTol error inside the surface.
-  Standard_EXPORT void GetTolerance (const Standard_Real BoundTol, const Standard_Real SurfTol, const Standard_Real AngleTol, math_Vector& Tol3d, math_Vector& Tol1D) const Standard_OVERRIDE;
-  
-  Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE;
-  
-  Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE;
-  
-  //! Obsolete method
-  Standard_EXPORT void Section (const Standard_Real Param, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, Standard_Real& Pdeb, Standard_Real& Pfin, gp_Lin& C);
-  
-  //! Used for the first and last section
-  Standard_EXPORT Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfVec& D2Poles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColgp_Array1OfVec2d& D2Poles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths, TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE;
-  
-  //! Used for the first and last section
-  Standard_EXPORT Standard_Boolean Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfVec& DPoles, TColgp_Array1OfPnt2d& Poles2d, TColgp_Array1OfVec2d& DPoles2d, TColStd_Array1OfReal& Weigths, TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE;
-  
-  Standard_EXPORT void Section (const Blend_Point& P, TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt2d& Poles2d, TColStd_Array1OfReal& Weigths) Standard_OVERRIDE;
-  
-  Standard_EXPORT void Resolution (const Standard_Integer IC2d, const Standard_Real Tol, Standard_Real& TolU, Standard_Real& TolV) const Standard_OVERRIDE;
 
 
 
@@ -173,13 +111,6 @@ protected:
 private:
 
 
-
-  Handle(Adaptor3d_HSurface) surf1;
-  Handle(Adaptor3d_HSurface) surf2;
-  Handle(Adaptor3d_HCurve) curv;
-  Standard_Integer choix;
-  Standard_Real tol;
-  Standard_Real distmin;
   BlendFunc_Corde corde1;
   BlendFunc_Corde corde2;
 
diff --git a/src/BlendFunc/BlendFunc_ConstThroat.cxx b/src/BlendFunc/BlendFunc_ConstThroat.cxx
new file mode 100644 (file)
index 0000000..0eb7a01
--- /dev/null
@@ -0,0 +1,320 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Adaptor3d_HCurve.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <Blend_Point.hxx>
+#include <BlendFunc.hxx>
+#include <BlendFunc_ConstThroat.hxx>
+#include <ElCLib.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Vec2d.hxx>
+#include <math_Matrix.hxx>
+#include <math_Gauss.hxx>
+#include <Precision.hxx>
+#include <Standard_NotImplemented.hxx>
+
+#define Eps 1.e-15
+
+
+//=======================================================================
+//function : BlendFunc_ConstThroat
+//purpose  : 
+//=======================================================================
+
+BlendFunc_ConstThroat::BlendFunc_ConstThroat(const Handle(Adaptor3d_HSurface)& S1,
+                                             const Handle(Adaptor3d_HSurface)& S2,
+                                             const Handle(Adaptor3d_HCurve)& C)
+  : BlendFunc_GenChamfer(S1,S2,C)
+{
+}
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_ConstThroat::Set(const Standard_Real aThroat,
+                                const Standard_Real,
+                                const Standard_Integer Choix)
+{
+  Throat = aThroat;
+  choix = Choix;
+}
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_ConstThroat::Set(const Standard_Real Param)
+{
+  param = Param;
+  curv->D2(param,ptgui,d1gui,d2gui);
+  normtg = d1gui.Magnitude();
+  nplan  = d1gui.Normalized();
+  theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
+}
+
+//=======================================================================
+//function : IsSolution
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroat::IsSolution(const math_Vector& Sol, const Standard_Real Tol)
+{
+  math_Vector secmember(1,4), valsol(1,4);
+  math_Matrix gradsol(1,4,1,4);
+
+  Value(Sol, valsol);
+  Derivatives(Sol, gradsol);
+
+  tol = Tol;
+  
+  gp_Vec dnplan, temp1, temp2, tempmid;
+
+  if (Abs(valsol(1)) <= Tol &&
+      Abs(valsol(2)) <= Tol &&
+      Abs(valsol(3)) <= Tol*Tol &&
+      Abs(valsol(4)) <= Tol*Tol)
+  {
+    dnplan.SetLinearForm(1./normtg,d2gui,
+                        -1./normtg*(nplan.Dot(d2gui)),nplan); 
+    
+    temp1.SetXYZ(pts1.XYZ() - ptgui.XYZ());
+    temp2.SetXYZ(pts2.XYZ() - ptgui.XYZ());
+    tempmid.SetXYZ((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ());
+    surf1->D1(Sol(1),Sol(2),pts1,d1u1,d1v1);
+    surf2->D1(Sol(3),Sol(4),pts2,d1u2,d1v2);
+    
+    secmember(1) = nplan.Dot(d1gui) - dnplan.Dot(temp1);
+    secmember(2) = nplan.Dot(d1gui) - dnplan.Dot(temp2);
+    secmember(3) = 2.*d1gui.Dot(tempmid);
+    secmember(4) = 2.*d1gui.Dot(temp2) - 2.*d1gui.Dot(temp1);
+
+    math_Gauss Resol(gradsol);
+    if (Resol.IsDone()) {
+      Resol.Solve(secmember);
+      tg1.SetLinearForm(secmember(1),d1u1,secmember(2),d1v1);
+      tg2.SetLinearForm(secmember(3),d1u2,secmember(4),d1v2);
+      tg12d.SetCoord(secmember(1),secmember(2));
+      tg22d.SetCoord(secmember(3),secmember(4));
+      istangent = Standard_False;
+    }
+    else {
+      istangent = Standard_True;
+    }
+
+    distmin = Min(distmin, pts1.Distance(pts2));
+    
+    return Standard_True;
+  }
+  
+  return Standard_False;
+}
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroat::Value(const math_Vector& X, math_Vector& F)
+{
+  surf1->D0( X(1), X(2), pts1 );
+  surf2->D0( X(3), X(4), pts2 );
+  
+  F(1) = nplan.XYZ().Dot(pts1.XYZ()) + theD;
+  F(2) = nplan.XYZ().Dot(pts2.XYZ()) + theD;
+
+  const gp_Pnt ptmid((pts1.XYZ() + pts2.XYZ())/2);
+  const gp_Vec vmid(ptgui, ptmid);
+  
+  F(3) = vmid.SquareMagnitude() - Throat*Throat;
+
+  const gp_Vec vref1(ptgui, pts1);
+  const gp_Vec vref2(ptgui, pts2);
+
+  F(4) = vref1.SquareMagnitude() - vref2.SquareMagnitude();
+  
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Derivatives
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroat::Derivatives(const math_Vector& X, math_Matrix& D)
+{
+  surf1->D1( X(1), X(2), pts1, d1u1, d1v1);  
+  surf2->D1( X(3), X(4), pts2, d1u2, d1v2);
+
+  D(1,1) = nplan.Dot(d1u1);
+  D(1,2) = nplan.Dot(d1v1);
+  D(1,3) = 0.;
+  D(1,4) = 0.;
+  D(2,1) = 0.;
+  D(2,2) = 0.;
+  D(2,3) = nplan.Dot(d1u2);
+  D(2,4) = nplan.Dot(d1v2);
+  D(3,1) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1u1);
+  D(3,2) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1v1);
+  D(3,3) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1u2);
+  D(3,4) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1v2);
+  D(4,1) = 2.*gp_Vec(ptgui,pts1).Dot(d1u1);
+  D(4,2) = 2.*gp_Vec(ptgui,pts1).Dot(d1v1);
+  D(4,3) = -2.*gp_Vec(ptgui,pts2).Dot(d1u2);
+  D(4,4) = -2.*gp_Vec(ptgui,pts2).Dot(d1v2);
+  
+  return Standard_True;
+}
+
+//=======================================================================
+//function : PointOnS1
+//purpose  : 
+//=======================================================================
+
+const gp_Pnt& BlendFunc_ConstThroat::PointOnS1 () const
+{
+  return pts1;
+}
+
+
+//=======================================================================
+//function : PointOnS2
+//purpose  : 
+//=======================================================================
+
+const gp_Pnt& BlendFunc_ConstThroat::PointOnS2 () const
+{
+  return pts2;
+}
+
+
+//=======================================================================
+//function : IsTangencyPoint
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroat::IsTangencyPoint () const
+{
+  return istangent;
+}
+
+
+//=======================================================================
+//function : TangentOnS1
+//purpose  : 
+//=======================================================================
+
+const gp_Vec& BlendFunc_ConstThroat::TangentOnS1 () const
+{
+  if (istangent)
+    throw Standard_DomainError("BlendFunc_ConstThroat::TangentOnS1");
+  return tg1;
+}
+
+
+//=======================================================================
+//function : TangentOnS2
+//purpose  : 
+//=======================================================================
+
+const gp_Vec& BlendFunc_ConstThroat::TangentOnS2 () const
+{
+  if (istangent)
+    throw Standard_DomainError("BlendFunc_ConstThroat::TangentOnS2");
+  return tg2;
+}
+
+
+//=======================================================================
+//function : Tangent2dOnS1
+//purpose  : 
+//=======================================================================
+
+const gp_Vec2d& BlendFunc_ConstThroat::Tangent2dOnS1 () const
+{
+  if (istangent)
+    throw Standard_DomainError("BlendFunc_ConstThroat::Tangent2dOnS1");
+  return tg12d;
+}
+
+
+//=======================================================================
+//function : Tangent2dOnS2
+//purpose  : 
+//=======================================================================
+
+const gp_Vec2d& BlendFunc_ConstThroat::Tangent2dOnS2 () const
+{
+  if (istangent)
+    throw Standard_DomainError("BlendFunc_ConstThroat::Tangent2dOnS2");
+  return tg22d;
+}
+
+
+//=======================================================================
+//function : Tangent
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_ConstThroat::Tangent(const Standard_Real U1,
+                                    const Standard_Real V1,
+                                    const Standard_Real U2,
+                                    const Standard_Real V2,
+                                    gp_Vec& TgF,
+                                    gp_Vec& TgL,
+                                    gp_Vec& NmF,
+                                    gp_Vec& NmL) const
+{
+  gp_Pnt pt;
+  gp_Vec d1u,d1v;
+  Standard_Boolean revF = Standard_False;
+  Standard_Boolean revL = Standard_False;
+
+  surf1->D1(U1,V1,pt,d1u,d1v);
+  NmF = d1u.Crossed(d1v);
+
+  surf2->D1(U2,V2,pt,d1u,d1v);
+  NmL = d1u.Crossed(d1v);
+
+  TgF = (nplan.Crossed(NmF)).Normalized();
+  TgL = (nplan.Crossed(NmL)).Normalized();
+
+  if( (choix == 2)||(choix == 5) ){
+    revF = Standard_True;
+    revL = Standard_True;
+  }
+  if( (choix == 4)||(choix == 7) )
+    revL = Standard_True;
+  if( (choix == 3)||(choix == 8) )
+    revF = Standard_True;
+
+  if( revF )
+    TgF.Reverse();
+  if( revL )
+    TgL.Reverse();
+}
+
+//=======================================================================
+//function : GetSectionSize
+//purpose  : 
+//=======================================================================
+Standard_Real BlendFunc_ConstThroat::GetSectionSize() const 
+{
+  throw Standard_NotImplemented("BlendFunc_ConstThroat::GetSectionSize()");
+}
diff --git a/src/BlendFunc/BlendFunc_ConstThroat.hxx b/src/BlendFunc/BlendFunc_ConstThroat.hxx
new file mode 100644 (file)
index 0000000..18c9eae
--- /dev/null
@@ -0,0 +1,138 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BlendFunc_ConstThroat_HeaderFile
+#define _BlendFunc_ConstThroat_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Standard_Integer.hxx>
+#include <Standard_Real.hxx>
+#include <BlendFunc_GenChamfer.hxx>
+#include <Standard_Boolean.hxx>
+#include <math_Vector.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <GeomAbs_Shape.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array1OfVec.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <TColgp_Array1OfVec2d.hxx>
+class Adaptor3d_HSurface;
+class Adaptor3d_HCurve;
+class math_Matrix;
+class gp_Pnt;
+class gp_Vec;
+class gp_Vec2d;
+class gp_Lin;
+class Blend_Point;
+
+
+//! Class for a function used to compute a symmetric chamfer
+//! with constant throat that is the height of isosceles triangle in section
+class BlendFunc_ConstThroat  : public BlendFunc_GenChamfer
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+  
+  Standard_EXPORT BlendFunc_ConstThroat(const Handle(Adaptor3d_HSurface)& S1,
+                                        const Handle(Adaptor3d_HSurface)& S2,
+                                        const Handle(Adaptor3d_HCurve)& C);
+  
+  
+  //! computes the values <F> of the Functions for the
+  //! variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
+  
+  //! returns the values <D> of the derivatives for the
+  //! variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
+  
+  Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE;
+  
+  Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Pnt& PointOnS1() const Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Pnt& PointOnS2() const Standard_OVERRIDE;
+  
+  Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Vec& TangentOnS1() const Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Vec2d& Tangent2dOnS1() const Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Vec& TangentOnS2() const Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Vec2d& Tangent2dOnS2() const Standard_OVERRIDE;
+  
+  //! Returns the tangent vector at the section,
+  //! at the beginning and the end of the section, and
+  //! returns the normal (of the surfaces) at
+  //! these points.
+  Standard_EXPORT void Tangent (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, gp_Vec& TgFirst, gp_Vec& TgLast, gp_Vec& NormFirst, gp_Vec& NormLast) const Standard_OVERRIDE;
+  
+  //! Sets the throat and the "quadrant".
+  Standard_EXPORT void Set (const Standard_Real aThroat, const Standard_Real, const Standard_Integer Choix) Standard_OVERRIDE;
+  
+  //! Returns the length of the maximum section
+  Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE;
+
+  
+
+
+
+protected:
+
+  gp_Pnt pts1;
+  gp_Pnt pts2;
+  gp_Vec d1u1;
+  gp_Vec d1v1;
+  gp_Vec d1u2;
+  gp_Vec d1v2;
+  Standard_Boolean istangent;
+  gp_Vec tg1;
+  gp_Vec2d tg12d;
+  gp_Vec tg2;
+  gp_Vec2d tg22d;
+  Standard_Real param;
+  Standard_Real Throat;
+
+  gp_Pnt ptgui;
+  gp_Vec nplan;
+  Standard_Real normtg;
+  Standard_Real theD;
+  gp_Vec d1gui;
+  gp_Vec d2gui;
+
+private:
+
+
+};
+
+
+
+
+
+
+
+#endif // _BlendFunc_ConstThroat_HeaderFile
diff --git a/src/BlendFunc/BlendFunc_ConstThroatInv.cxx b/src/BlendFunc/BlendFunc_ConstThroatInv.cxx
new file mode 100644 (file)
index 0000000..27c2260
--- /dev/null
@@ -0,0 +1,250 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <Adaptor2d_HCurve2d.hxx>
+#include <Adaptor3d_HCurve.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <BlendFunc.hxx>
+#include <BlendFunc_ConstThroatInv.hxx>
+#include <math_Matrix.hxx>
+#include <Precision.hxx>
+
+//=======================================================================
+//function : BlendFunc_ConstThroatInv
+//purpose  : 
+//=======================================================================
+
+BlendFunc_ConstThroatInv::BlendFunc_ConstThroatInv(const Handle(Adaptor3d_HSurface)& S1,
+                                                   const Handle(Adaptor3d_HSurface)& S2,
+                                                   const Handle(Adaptor3d_HCurve)&   C)
+  : BlendFunc_GenChamfInv(S1,S2,C)
+{
+}
+
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_ConstThroatInv::Set(const Standard_Real    theThroat,
+                                   const Standard_Real,
+                                   const Standard_Integer Choix)
+{
+  //Standard_Real dis1,dis2;
+
+  Throat = theThroat;
+
+  choix = Choix;
+  switch (choix) {
+  case 1:
+  case 2:
+    {
+      sign1 = -1;
+      sign2 = -1;
+    }
+    break;
+  case 3:
+  case 4:
+    {
+      sign1 = 1;
+      sign2 = -1;
+    }
+    break;
+  case 5:
+  case 6:
+    {
+      sign1 = 1;
+      sign2 = 1;
+    }
+    break;
+  case 7:
+  case 8:
+    {
+      sign1 = -1;
+      sign2 = 1;
+    }
+    break;
+  default:
+    sign1 = -1;
+    sign2 = -1;
+  }
+}
+
+//=======================================================================
+//function : IsSolution
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroatInv::IsSolution(const math_Vector& Sol, const Standard_Real Tol)
+{
+  math_Vector valsol(1,4);
+  Value(Sol, valsol);
+
+  if (Abs(valsol(1)) <= Tol &&
+      Abs(valsol(2)) <= Tol &&
+      Abs(valsol(3)) <= Tol*Tol &&
+      Abs(valsol(4)) <= Tol*Tol)
+    return Standard_True;
+
+  return Standard_False;;
+}
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroatInv::Value(const math_Vector& X, math_Vector& F)
+{
+  gp_Pnt2d p2d;
+  gp_Vec2d v2d;
+  csurf->D1(X(1),p2d,v2d);  
+  param = X(2);
+  curv->D2(param,ptgui,d1gui,d2gui);
+  normtg = d1gui.Magnitude();
+  nplan  = d1gui.Normalized();
+  theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
+
+  math_Vector XX(1,4);
+
+  if(first){
+    XX(1) = p2d.X(); XX(2) = p2d.Y();
+    XX(3) = X(3); XX(4) = X(4);
+  }
+
+  else{
+    XX(1) = X(3); XX(2) = X(4);
+    XX(3) = p2d.X(); XX(4) = p2d.Y();
+  }
+  
+  surf1->D0( XX(1), XX(2), pts1 );
+  surf2->D0( XX(3), XX(4), pts2 );
+  
+  F(1) = nplan.XYZ().Dot(pts1.XYZ()) + theD;
+  F(2) = nplan.XYZ().Dot(pts2.XYZ()) + theD;
+
+  const gp_Pnt ptmid((pts1.XYZ() + pts2.XYZ())/2);
+  const gp_Vec vmid(ptgui, ptmid);
+  
+  F(3) = vmid.SquareMagnitude() - Throat*Throat;
+
+  const gp_Vec vref1(ptgui, pts1);
+  const gp_Vec vref2(ptgui, pts2);
+
+  F(4) = vref1.SquareMagnitude() - vref2.SquareMagnitude();
+  
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Derivatives
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroatInv::Derivatives(const math_Vector& X, math_Matrix& D)
+{
+  //Standard_Integer i, j;
+  gp_Pnt2d p2d;
+  gp_Vec2d v2d; //, df1, df2;
+  //gp_Pnt pts, ptgui;
+  gp_Vec dnplan, temp, temp1, temp2, tempmid; //, d1u, d1v, nplan;
+  math_Vector XX(1,4); //x1(1,2), x2(1,2);
+  //math_Matrix d1(1,2,1,2), d2(1,2,1,2);
+
+  csurf->D1(X(1), p2d, v2d);  
+  //corde1.SetParam(X(2));
+  //corde2.SetParam(X(2));
+  param = X(2);
+  curv->D2(param,ptgui,d1gui,d2gui);
+  normtg = d1gui.Magnitude();
+  nplan  = d1gui.Normalized();
+  theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
+
+  dnplan.SetLinearForm(1./normtg,d2gui,
+                       -1./normtg*(nplan.Dot(d2gui)),nplan); 
+  
+  temp1.SetXYZ(pts1.XYZ() - ptgui.XYZ());
+  temp2.SetXYZ(pts2.XYZ() - ptgui.XYZ());
+  tempmid.SetXYZ((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ());
+  
+  //x1(1) = p2d.X(); x1(2) = p2d.Y();
+  //x2(1) = X(3); x2(2) = X(4);
+  if (first)
+  {
+    XX(1) = p2d.X(); XX(2) = p2d.Y();
+    XX(3) = X(3); XX(4) = X(4);
+  }
+  else
+  {
+    XX(1) = X(3); XX(2) = X(4);
+    XX(3) = p2d.X(); XX(4) = p2d.Y();
+  }
+
+  surf1->D1(XX(1), XX(2), pts1, d1u1, d1v1);
+  surf2->D1(XX(3), XX(4), pts2, d1u2, d1v2);
+  
+  if( first ){
+    // p2d = pts est sur surf1
+    //ptgui = corde1.PointOnGuide();
+    //nplan = corde1.NPlan();
+    temp.SetLinearForm(v2d.X(),d1u1, v2d.Y(),d1v1);
+
+    D(1,1) = nplan.Dot(temp);
+    D(2,1) = 0.;
+    D(3,1) = gp_Vec(ptgui,pts1).Dot(temp);
+    D(4,1) = 2*(gp_Vec(ptgui,pts1).Dot(temp));
+
+    D(1,3) = 0.;
+    D(1,4) = 0.;
+    D(2,3) = nplan.Dot(d1u2);
+    D(2,4) = nplan.Dot(d1v2);
+    D(3,3) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1u2);
+    D(3,4) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1v2);
+    D(4,3) = -2.*gp_Vec(ptgui,pts2).Dot(d1u2);
+    D(4,4) = -2.*gp_Vec(ptgui,pts2).Dot(d1v2);
+    
+    //surf1->D1(x1(1),x1(2),pts,d1u,d1v);
+  }   
+  else{
+    //  p2d = pts est sur surf2
+    //ptgui = corde2.PointOnGuide();
+    //nplan = corde2.NPlan();
+    temp.SetLinearForm(v2d.X(),d1u2, v2d.Y(),d1v2);
+
+    D(1,1) = 0.;
+    D(2,1) = nplan.Dot(temp);
+    D(3,1) = gp_Vec(ptgui,pts2).Dot(temp);
+    D(4,1) = -2*(gp_Vec(ptgui,pts2).Dot(temp));
+
+    D(1,3) = nplan.Dot(d1u1);
+    D(1,4) = nplan.Dot(d1v1);
+    D(2,3) = 0.;
+    D(2,4) = 0.;
+    D(3,3) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1u1);
+    D(3,4) = gp_Vec((pts1.XYZ() + pts2.XYZ())/2 - ptgui.XYZ()).Dot(d1v1);
+    D(4,3) = 2.*gp_Vec(ptgui,pts1).Dot(d1u1);
+    D(4,4) = 2.*gp_Vec(ptgui,pts1).Dot(d1v1);
+    
+    //surf2->D1(x1(1),x1(2),pts,d1u,d1v);
+  }
+
+  D(1,2) = dnplan.Dot(temp1) - nplan.Dot(d1gui);
+  D(2,2) = dnplan.Dot(temp2) - nplan.Dot(d1gui);
+  D(3,2) = -2.*d1gui.Dot(tempmid);
+  D(4,2) = 2.*d1gui.Dot(temp1) - 2.*d1gui.Dot(temp2);
+
+  return Standard_True;
+} 
diff --git a/src/BlendFunc/BlendFunc_ConstThroatInv.hxx b/src/BlendFunc/BlendFunc_ConstThroatInv.hxx
new file mode 100644 (file)
index 0000000..9837a4a
--- /dev/null
@@ -0,0 +1,100 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BlendFunc_ConstThroatInv_HeaderFile
+#define _BlendFunc_ConstThroatInv_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Standard_Integer.hxx>
+#include <Standard_Boolean.hxx>
+#include <BlendFunc_GenChamfInv.hxx>
+#include <math_Vector.hxx>
+#include <Standard_Real.hxx>
+class Adaptor3d_HSurface;
+class Adaptor3d_HCurve;
+class Adaptor2d_HCurve2d;
+class math_Matrix;
+
+
+
+//! Class for a function used to compute a ConstThroat chamfer on a surface's boundary
+class BlendFunc_ConstThroatInv  : public BlendFunc_GenChamfInv
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+  
+  Standard_EXPORT BlendFunc_ConstThroatInv(const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_HCurve)& C);
+  
+  Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
+  
+  //! computes the values <F> of the Functions for the
+  //! variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
+  
+  //! returns the values <D> of the derivatives for the
+  //! variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
+  
+  using Blend_FuncInv::Set;
+  
+  Standard_EXPORT virtual void Set (const Standard_Real theThroat,
+                                    const Standard_Real,
+                                    const Standard_Integer Choix) Standard_OVERRIDE;
+
+
+
+
+protected:
+
+  Standard_Real Throat;
+
+  Standard_Real param;
+  Standard_Real sign1;
+  Standard_Real sign2;
+
+  gp_Pnt ptgui;
+  gp_Vec nplan;
+  Standard_Real normtg;
+  Standard_Real theD;
+  gp_Vec d1gui;
+  gp_Vec d2gui;
+  
+  gp_Pnt pts1;
+  gp_Pnt pts2;
+  gp_Vec d1u1;
+  gp_Vec d1v1;
+  gp_Vec d1u2;
+  gp_Vec d1v2;
+
+
+private:
+
+};
+
+
+
+
+
+
+
+#endif // _BlendFunc_ConstThroatInv_HeaderFile
diff --git a/src/BlendFunc/BlendFunc_ConstThroatWithPenetration.cxx b/src/BlendFunc/BlendFunc_ConstThroatWithPenetration.cxx
new file mode 100644 (file)
index 0000000..105df68
--- /dev/null
@@ -0,0 +1,217 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Adaptor3d_HCurve.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <Blend_Point.hxx>
+#include <BlendFunc.hxx>
+#include <BlendFunc_ConstThroatWithPenetration.hxx>
+#include <ElCLib.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Vec2d.hxx>
+#include <math_Matrix.hxx>
+#include <math_Gauss.hxx>
+#include <Precision.hxx>
+#include <Standard_NotImplemented.hxx>
+
+#define Eps 1.e-15
+
+
+//=======================================================================
+//function : BlendFunc_ConstThroatWithPenetration
+//purpose  : 
+//=======================================================================
+
+BlendFunc_ConstThroatWithPenetration::
+BlendFunc_ConstThroatWithPenetration(const Handle(Adaptor3d_HSurface)& S1,
+                                     const Handle(Adaptor3d_HSurface)& S2,
+                                     const Handle(Adaptor3d_HCurve)& C)
+  : BlendFunc_ConstThroat(S1,S2,C)
+{
+}
+
+//=======================================================================
+//function : IsSolution
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroatWithPenetration::
+IsSolution(const math_Vector& Sol, const Standard_Real Tol)
+{
+  math_Vector secmember(1,4), valsol(1,4);
+  math_Matrix gradsol(1,4,1,4);
+
+  Value(Sol, valsol);
+  Derivatives(Sol, gradsol);
+
+  tol = Tol;
+  
+  gp_Vec dnplan, temp1, temp2, temp3;
+
+  if (Abs(valsol(1)) <= Tol &&
+      Abs(valsol(2)) <= Tol &&
+      Abs(valsol(3)) <= Tol*Tol &&
+      Abs(valsol(4)) <= Tol)
+  {
+    dnplan.SetLinearForm(1./normtg,d2gui,
+                        -1./normtg*(nplan.Dot(d2gui)),nplan); 
+    
+    temp1.SetXYZ(pts1.XYZ() - ptgui.XYZ());
+    temp2.SetXYZ(pts2.XYZ() - ptgui.XYZ());
+    temp3.SetXYZ(pts2.XYZ() - pts1.XYZ());
+    surf1->D1(Sol(1),Sol(2),pts1,d1u1,d1v1);
+    surf2->D1(Sol(3),Sol(4),pts2,d1u2,d1v2);
+    
+    secmember(1) = nplan.Dot(d1gui) - dnplan.Dot(temp1);
+    secmember(2) = nplan.Dot(d1gui) - dnplan.Dot(temp2);
+    secmember(3) = 2.*d1gui.Dot(temp1);
+    secmember(4) = d1gui.Dot(temp3);
+
+    math_Gauss Resol(gradsol);
+    if (Resol.IsDone()) {
+      Resol.Solve(secmember);
+      tg1.SetLinearForm(secmember(1),d1u1,secmember(2),d1v1);
+      tg2.SetLinearForm(secmember(3),d1u2,secmember(4),d1v2);
+      tg12d.SetCoord(secmember(1),secmember(2));
+      tg22d.SetCoord(secmember(3),secmember(4));
+      istangent = Standard_False;
+    }
+    else {
+      istangent = Standard_True;
+    }
+
+    distmin = Min(distmin, pts1.Distance(pts2));
+    
+    return Standard_True;
+  }
+  
+  return Standard_False;
+}
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroatWithPenetration::Value(const math_Vector& X,
+                                                             math_Vector& F)
+{
+  surf1->D0( X(1), X(2), pts1 );
+  surf2->D0( X(3), X(4), pts2 );
+  
+  F(1) = nplan.XYZ().Dot(pts1.XYZ()) + theD;
+  F(2) = nplan.XYZ().Dot(pts2.XYZ()) + theD;
+
+  const gp_Vec vref(ptgui, pts1);
+  
+  F(3) = vref.SquareMagnitude() - Throat*Throat;
+
+  const gp_Vec vec12(pts1, pts2);
+
+  F(4) = vref.Dot(vec12);
+  
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Derivatives
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroatWithPenetration::Derivatives(const math_Vector& X,
+                                                                   math_Matrix& D)
+{
+  surf1->D1( X(1), X(2), pts1, d1u1, d1v1);  
+  surf2->D1( X(3), X(4), pts2, d1u2, d1v2);
+
+  D(1,1) = nplan.Dot(d1u1);
+  D(1,2) = nplan.Dot(d1v1);
+  D(1,3) = 0.;
+  D(1,4) = 0.;
+  D(2,1) = 0.;
+  D(2,2) = 0.;
+  D(2,3) = nplan.Dot(d1u2);
+  D(2,4) = nplan.Dot(d1v2);
+  D(3,1) = 2.*gp_Vec(ptgui,pts1).Dot(d1u1);
+  D(3,2) = 2.*gp_Vec(ptgui,pts1).Dot(d1v1);
+  D(3,3) = 0.;
+  D(3,4) = 0.;
+  D(4,1) = d1u1.Dot(gp_Vec(pts1,pts2)) - gp_Vec(ptgui,pts1).Dot(d1u1);
+  D(4,2) = d1v1.Dot(gp_Vec(pts1,pts2)) - gp_Vec(ptgui,pts1).Dot(d1v1);
+  D(4,3) = gp_Vec(ptgui,pts1).Dot(d1u2);
+  D(4,4) = gp_Vec(ptgui,pts1).Dot(d1v2);
+  
+  return Standard_True;
+}
+
+//=======================================================================
+//function : TangentOnS1
+//purpose  : 
+//=======================================================================
+
+const gp_Vec& BlendFunc_ConstThroatWithPenetration::TangentOnS1 () const
+{
+  if (istangent)
+    throw Standard_DomainError("BlendFunc_ConstThroatWithPenetration::TangentOnS1");
+  return tg1;
+}
+
+
+//=======================================================================
+//function : TangentOnS2
+//purpose  : 
+//=======================================================================
+
+const gp_Vec& BlendFunc_ConstThroatWithPenetration::TangentOnS2 () const
+{
+  if (istangent)
+    throw Standard_DomainError("BlendFunc_ConstThroatWithPenetration::TangentOnS2");
+  return tg2;
+}
+
+
+//=======================================================================
+//function : Tangent2dOnS1
+//purpose  : 
+//=======================================================================
+
+const gp_Vec2d& BlendFunc_ConstThroatWithPenetration::Tangent2dOnS1 () const
+{
+  if (istangent)
+    throw Standard_DomainError("BlendFunc_ConstThroatWithPenetration::Tangent2dOnS1");
+  return tg12d;
+}
+
+//=======================================================================
+//function : Tangent2dOnS2
+//purpose  : 
+//=======================================================================
+
+const gp_Vec2d& BlendFunc_ConstThroatWithPenetration::Tangent2dOnS2 () const
+{
+  if (istangent)
+    throw Standard_DomainError("BlendFunc_ConstThroatWithPenetration::Tangent2dOnS2");
+  return tg22d;
+}
+
+//=======================================================================
+//function : GetSectionSize
+//purpose  : 
+//=======================================================================
+Standard_Real BlendFunc_ConstThroatWithPenetration::GetSectionSize() const 
+{
+  throw Standard_NotImplemented("BlendFunc_ConstThroatWithPenetration::GetSectionSize()");
+}
diff --git a/src/BlendFunc/BlendFunc_ConstThroatWithPenetration.hxx b/src/BlendFunc/BlendFunc_ConstThroatWithPenetration.hxx
new file mode 100644 (file)
index 0000000..90f9e2f
--- /dev/null
@@ -0,0 +1,125 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BlendFunc_ConstThroatWithPenetration_HeaderFile
+#define _BlendFunc_ConstThroatWithPenetration_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Standard_Integer.hxx>
+#include <Standard_Real.hxx>
+#include <BlendFunc_ConstThroat.hxx>
+#include <Standard_Boolean.hxx>
+#include <math_Vector.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <GeomAbs_Shape.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array1OfVec.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <TColgp_Array1OfVec2d.hxx>
+class Adaptor3d_HSurface;
+class Adaptor3d_HCurve;
+class math_Matrix;
+class gp_Pnt;
+class gp_Vec;
+class gp_Vec2d;
+class gp_Lin;
+class Blend_Point;
+
+
+//! Class for a function used to compute a chamfer with constant throat:
+//! the section of chamfer is right-angled triangle,
+//! the first of two surfaces (where is the top of the chamfer)
+//! is virtually moved inside the solid by offset operation,
+//! the apex of the section is on the intersection curve between moved surface and second surface,
+//! right angle is at the top of the chamfer,
+//! the length of the leg from apex to top is constant - it is throat
+class BlendFunc_ConstThroatWithPenetration  : public BlendFunc_ConstThroat
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+  
+  Standard_EXPORT BlendFunc_ConstThroatWithPenetration(const Handle(Adaptor3d_HSurface)& S1,
+                                                       const Handle(Adaptor3d_HSurface)& S2,
+                                                       const Handle(Adaptor3d_HCurve)& C);
+  
+  
+  //! computes the values <F> of the Functions for the
+  //! variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
+  
+  //! returns the values <D> of the derivatives for the
+  //! variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
+  
+  //Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE;
+  
+  Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
+  
+  //Standard_EXPORT const gp_Pnt& PointOnS1() const Standard_OVERRIDE;
+  
+  //Standard_EXPORT const gp_Pnt& PointOnS2() const Standard_OVERRIDE;
+  
+  //Standard_EXPORT Standard_Boolean IsTangencyPoint() const Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Vec& TangentOnS1() const Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Vec2d& Tangent2dOnS1() const Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Vec& TangentOnS2() const Standard_OVERRIDE;
+  
+  Standard_EXPORT const gp_Vec2d& Tangent2dOnS2() const Standard_OVERRIDE;
+  
+  //! Returns the tangent vector at the section,
+  //! at the beginning and the end of the section, and
+  //! returns the normal (of the surfaces) at
+  //! these points.
+  //Standard_EXPORT void Tangent (const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, gp_Vec& TgFirst, gp_Vec& TgLast, gp_Vec& NormFirst, gp_Vec& NormLast) const Standard_OVERRIDE;
+  
+  //! Sets the throat and the "quadrant".
+  //Standard_EXPORT void Set (const Standard_Real theThroat, const Standard_Real, const Standard_Integer Choix) Standard_OVERRIDE;
+  
+  //! Returns the length of the maximum section
+  Standard_EXPORT Standard_Real GetSectionSize() const Standard_OVERRIDE;
+
+  
+
+
+
+protected:
+
+
+
+private:
+
+
+
+};
+
+
+
+
+
+
+
+#endif // _BlendFunc_ConstThroatWithPenetration_HeaderFile
diff --git a/src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.cxx b/src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.cxx
new file mode 100644 (file)
index 0000000..7c0ad10
--- /dev/null
@@ -0,0 +1,213 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <Adaptor2d_HCurve2d.hxx>
+#include <Adaptor3d_HCurve.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <BlendFunc.hxx>
+#include <BlendFunc_ConstThroatWithPenetrationInv.hxx>
+#include <math_Matrix.hxx>
+#include <Precision.hxx>
+
+//=======================================================================
+//function : BlendFunc_ConstThroatInv
+//purpose  : 
+//=======================================================================
+
+BlendFunc_ConstThroatWithPenetrationInv::
+BlendFunc_ConstThroatWithPenetrationInv(const Handle(Adaptor3d_HSurface)& S1,
+                                        const Handle(Adaptor3d_HSurface)& S2,
+                                        const Handle(Adaptor3d_HCurve)&   C)
+  : BlendFunc_ConstThroatInv(S1,S2,C)
+{
+}
+
+
+//=======================================================================
+//function : IsSolution
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroatWithPenetrationInv::IsSolution(const math_Vector& Sol,
+                                                                     const Standard_Real Tol)
+{
+  math_Vector valsol(1,4);
+  Value(Sol, valsol);
+
+  if (Abs(valsol(1)) <= Tol &&
+      Abs(valsol(2)) <= Tol &&
+      Abs(valsol(3)) <= Tol*Tol &&
+      Abs(valsol(4)) <= Tol)
+    return Standard_True;
+
+  return Standard_False;;
+}
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroatWithPenetrationInv::Value(const math_Vector& X,
+                                                                math_Vector& F)
+{
+  gp_Pnt2d p2d;
+  gp_Vec2d v2d;
+  csurf->D1(X(1),p2d,v2d);  
+  param = X(2);
+  curv->D2(param,ptgui,d1gui,d2gui);
+  normtg = d1gui.Magnitude();
+  nplan  = d1gui.Normalized();
+  theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
+
+  math_Vector XX(1,4);
+
+  if(first){
+    XX(1) = p2d.X(); XX(2) = p2d.Y();
+    XX(3) = X(3); XX(4) = X(4);
+  }
+
+  else{
+    XX(1) = X(3); XX(2) = X(4);
+    XX(3) = p2d.X(); XX(4) = p2d.Y();
+  }
+  
+  surf1->D0( XX(1), XX(2), pts1 );
+  surf2->D0( XX(3), XX(4), pts2 );
+  
+  F(1) = nplan.XYZ().Dot(pts1.XYZ()) + theD;
+  F(2) = nplan.XYZ().Dot(pts2.XYZ()) + theD;
+
+  const gp_Vec vref(ptgui, pts1);
+  
+  F(3) = vref.SquareMagnitude() - Throat*Throat;
+
+  const gp_Vec vec12(pts1, pts2);
+
+  F(4) = vref.Dot(vec12);
+  
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Derivatives
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_ConstThroatWithPenetrationInv::Derivatives(const math_Vector& X,
+                                                                      math_Matrix& D)
+{
+  //Standard_Integer i, j;
+  gp_Pnt2d p2d;
+  gp_Vec2d v2d; //, df1, df2;
+  //gp_Pnt pts, ptgui;
+  gp_Vec dnplan, temp, temp1, temp2, temp3; //, d1u, d1v, nplan;
+  math_Vector XX(1,4); //x1(1,2), x2(1,2);
+  //math_Matrix d1(1,2,1,2), d2(1,2,1,2);
+
+  csurf->D1(X(1), p2d, v2d);  
+  //corde1.SetParam(X(2));
+  //corde2.SetParam(X(2));
+  param = X(2);
+  curv->D2(param,ptgui,d1gui,d2gui);
+  normtg = d1gui.Magnitude();
+  nplan  = d1gui.Normalized();
+  theD = - (nplan.XYZ().Dot(ptgui.XYZ()));
+
+  dnplan.SetLinearForm(1./normtg,d2gui,
+                       -1./normtg*(nplan.Dot(d2gui)),nplan); 
+  
+  temp1.SetXYZ(pts1.XYZ() - ptgui.XYZ());
+  temp2.SetXYZ(pts2.XYZ() - ptgui.XYZ());
+  temp3.SetXYZ(pts2.XYZ() - pts1.XYZ());
+  
+  //x1(1) = p2d.X(); x1(2) = p2d.Y();
+  //x2(1) = X(3); x2(2) = X(4);
+  if (first)
+  {
+    XX(1) = p2d.X(); XX(2) = p2d.Y();
+    XX(3) = X(3); XX(4) = X(4);
+  }
+  else
+  {
+    XX(1) = X(3); XX(2) = X(4);
+    XX(3) = p2d.X(); XX(4) = p2d.Y();
+  }
+
+  surf1->D1(XX(1), XX(2), pts1, d1u1, d1v1);
+  surf2->D1(XX(3), XX(4), pts2, d1u2, d1v2);
+  
+  if( first ){
+    // p2d = pts est sur surf1
+    //ptgui = corde1.PointOnGuide();
+    //nplan = corde1.NPlan();
+    temp.SetLinearForm(v2d.X(),d1u1, v2d.Y(),d1v1);
+
+    D(1,1) = nplan.Dot(temp);
+    D(2,1) = 0.;
+    //D(3,1) = 2*gp_Vec(ptgui,pts1).Dot(temp);
+    D(3,1) = 2*temp1.Dot(temp);
+    //D(4,1) = temp.Dot(gp_Vec(pts1,pts2)) - temp.Dot(gp_Vec(ptgui,pts1));
+    D(4,1) = temp.Dot(temp3) - temp.Dot(temp1);
+
+    D(1,3) = 0.;
+    D(1,4) = 0.;
+    D(2,3) = nplan.Dot(d1u2);
+    D(2,4) = nplan.Dot(d1v2);
+    D(3,3) = 0.;
+    D(3,4) = 0.;
+    //D(4,3) = gp_Vec(ptgui,pts1).Dot(d1u2);
+    D(4,3) = temp1.Dot(d1u2);
+    //D(4,4) = gp_Vec(ptgui,pts1).Dot(d1v2);
+    D(4,4) = temp1.Dot(d1v2);
+    
+    //surf1->D1(x1(1),x1(2),pts,d1u,d1v);
+  }   
+  else{
+    //  p2d = pts est sur surf2
+    //ptgui = corde2.PointOnGuide();
+    //nplan = corde2.NPlan();
+    temp.SetLinearForm(v2d.X(),d1u2, v2d.Y(),d1v2);
+
+    D(1,1) = 0.;
+    D(2,1) = nplan.Dot(temp);
+    D(3,1) = 0.;
+    //D(4,1) = gp_Vec(ptgui,pts1).Dot(temp);
+    D(4,1) = temp1.Dot(temp);
+
+    D(1,3) = nplan.Dot(d1u1);
+    D(1,4) = nplan.Dot(d1v1);
+    D(2,3) = 0.;
+    D(2,4) = 0.;
+    //D(3,3) = 2.*gp_Vec(ptgui,pts1).Dot(d1u1);
+    D(3,3) = 2.*temp1.Dot(d1u1);
+    //D(3,4) = 2.*gp_Vec(ptgui,pts1).Dot(d1v1);
+    D(3,4) = 2.*temp1.Dot(d1v1);
+    //D(4,3) = d1u1.Dot(gp_Vec(pts1,pts2)) - d1u1.Dot(gp_Vec(ptgui,pts1));
+    D(4,3) = d1u1.Dot(temp3) - d1u1.Dot(temp1);
+    D(4,4) = d1v1.Dot(temp3) - d1v1.Dot(temp1);
+    
+    //surf2->D1(x1(1),x1(2),pts,d1u,d1v);
+  }
+
+  D(1,2) = dnplan.Dot(temp1) - nplan.Dot(d1gui);
+  D(2,2) = dnplan.Dot(temp2) - nplan.Dot(d1gui);
+  //D(3,2) = -2.*gp_Vec(ptgui,pts1).Dot(d1gui);
+  D(3,2) = -2.*d1gui.Dot(temp1);
+  //D(4,2) = -(gp_Vec(pts1,pts2).Dot(d1gui));
+  D(4,2) = -d1gui.Dot(temp3);
+
+  return Standard_True;
+} 
diff --git a/src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.hxx b/src/BlendFunc/BlendFunc_ConstThroatWithPenetrationInv.hxx
new file mode 100644 (file)
index 0000000..a11c9cf
--- /dev/null
@@ -0,0 +1,77 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BlendFunc_ConstThroatWithPenetrationInv_HeaderFile
+#define _BlendFunc_ConstThroatWithPenetrationInv_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Standard_Integer.hxx>
+#include <Standard_Boolean.hxx>
+#include <BlendFunc_ConstThroatInv.hxx>
+#include <math_Vector.hxx>
+#include <Standard_Real.hxx>
+class Adaptor3d_HSurface;
+class Adaptor3d_HCurve;
+class Adaptor2d_HCurve2d;
+class math_Matrix;
+
+
+
+//! Class for a function used to compute a ConstThroatWithPenetration chamfer
+//! on a surface's boundary
+class BlendFunc_ConstThroatWithPenetrationInv  : public BlendFunc_ConstThroatInv
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+  
+  Standard_EXPORT BlendFunc_ConstThroatWithPenetrationInv(const Handle(Adaptor3d_HSurface)& S1,
+                                                          const Handle(Adaptor3d_HSurface)& S2,
+                                                          const Handle(Adaptor3d_HCurve)& C);
+  
+  Standard_EXPORT Standard_Boolean IsSolution (const math_Vector& Sol, const Standard_Real Tol) Standard_OVERRIDE;
+  
+  //! computes the values <F> of the Functions for the
+  //! variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Value (const math_Vector& X, math_Vector& F) Standard_OVERRIDE;
+  
+  //! returns the values <D> of the derivatives for the
+  //! variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Derivatives (const math_Vector& X, math_Matrix& D) Standard_OVERRIDE;
+  
+
+
+protected:
+
+
+private:
+  
+
+};
+
+
+
+
+
+
+
+#endif // _BlendFunc_ConstThroatWithPenetrationInv_HeaderFile
diff --git a/src/BlendFunc/BlendFunc_GenChamfInv.cxx b/src/BlendFunc/BlendFunc_GenChamfInv.cxx
new file mode 100644 (file)
index 0000000..925273f
--- /dev/null
@@ -0,0 +1,137 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <Adaptor2d_HCurve2d.hxx>
+#include <Adaptor3d_HCurve.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <BlendFunc.hxx>
+#include <BlendFunc_ChamfInv.hxx>
+#include <math_Matrix.hxx>
+#include <Precision.hxx>
+
+
+//=======================================================================
+//function : BlendFunc_GenChamfInv
+//purpose  : 
+//=======================================================================
+BlendFunc_GenChamfInv::BlendFunc_GenChamfInv(const Handle(Adaptor3d_HSurface)& S1,
+                                             const Handle(Adaptor3d_HSurface)& S2,
+                                             const Handle(Adaptor3d_HCurve)&   C) :
+  surf1(S1),surf2(S2),curv(C)
+{
+}
+
+//=======================================================================
+//function : NbEquations
+//purpose  : 
+//=======================================================================
+
+Standard_Integer BlendFunc_GenChamfInv::NbEquations () const
+{
+  return 4;
+}
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfInv::Set(const Standard_Boolean OnFirst, const Handle(Adaptor2d_HCurve2d)& C)
+{
+  first = OnFirst;
+  csurf = C;
+}
+
+//=======================================================================
+//function : GetTolerance
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfInv::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
+{
+  Tolerance(1) = csurf->Resolution(Tol);
+  Tolerance(2) = curv->Resolution(Tol);
+  if (first) {
+    Tolerance(3) = surf2->UResolution(Tol);
+    Tolerance(4) = surf2->VResolution(Tol);
+  }
+  else {
+    Tolerance(3) = surf1->UResolution(Tol);
+    Tolerance(4) = surf1->VResolution(Tol);
+  }
+}
+
+
+//=======================================================================
+//function : GetBounds
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfInv::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
+{
+  InfBound(1) = csurf->FirstParameter();
+  InfBound(2) = curv->FirstParameter();
+  SupBound(1) = csurf->LastParameter();
+  SupBound(2) = curv->LastParameter();
+
+  if (first) {
+    InfBound(3) = surf2->FirstUParameter();
+    InfBound(4) = surf2->FirstVParameter();
+    SupBound(3) = surf2->LastUParameter();
+    SupBound(4) = surf2->LastVParameter();
+    if(!Precision::IsInfinite(InfBound(3)) &&
+       !Precision::IsInfinite(SupBound(3))) {
+      const Standard_Real range = (SupBound(3) - InfBound(3));
+      InfBound(3) -= range;
+      SupBound(3) += range;
+    }
+    if(!Precision::IsInfinite(InfBound(4)) &&
+       !Precision::IsInfinite(SupBound(4))) {
+      const Standard_Real range = (SupBound(4) - InfBound(4));
+      InfBound(4) -= range;
+      SupBound(4) += range;
+    }
+  }
+  else {
+    InfBound(3) = surf1->FirstUParameter();
+    InfBound(4) = surf1->FirstVParameter();
+    SupBound(3) = surf1->LastUParameter();
+    SupBound(4) = surf1->LastVParameter();
+    if(!Precision::IsInfinite(InfBound(3)) &&
+       !Precision::IsInfinite(SupBound(3))) {
+      const Standard_Real range = (SupBound(3) - InfBound(3));
+      InfBound(3) -= range;
+      SupBound(3) += range;
+    }
+    if(!Precision::IsInfinite(InfBound(4)) &&
+       !Precision::IsInfinite(SupBound(4))) {
+      const Standard_Real range = (SupBound(4) - InfBound(4));
+      InfBound(4) -= range;
+      SupBound(4) += range;
+    }
+  }    
+}
+
+//=======================================================================
+//function : Values
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_GenChamfInv::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
+{
+  Value(X,F);
+  Derivatives(X,D);
+  return Standard_True;
+}
diff --git a/src/BlendFunc/BlendFunc_GenChamfInv.hxx b/src/BlendFunc/BlendFunc_GenChamfInv.hxx
new file mode 100644 (file)
index 0000000..2d0ada5
--- /dev/null
@@ -0,0 +1,94 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BlendFunc_GenChamfInv_HeaderFile
+#define _BlendFunc_GenChamfInv_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Standard_Integer.hxx>
+#include <Standard_Boolean.hxx>
+#include <BlendFunc_Corde.hxx>
+#include <Blend_FuncInv.hxx>
+#include <math_Vector.hxx>
+#include <Standard_Real.hxx>
+class Adaptor3d_HSurface;
+class Adaptor3d_HCurve;
+class Adaptor2d_HCurve2d;
+class math_Matrix;
+
+
+
+//! Deferred class for a function used to compute a general chamfer on a surface's boundary
+class BlendFunc_GenChamfInv  : public Blend_FuncInv
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+  Standard_EXPORT BlendFunc_GenChamfInv(const Handle(Adaptor3d_HSurface)& S1,
+                                        const Handle(Adaptor3d_HSurface)& S2,
+                                        const Handle(Adaptor3d_HCurve)& C);
+  
+  Standard_EXPORT virtual void Set (const Standard_Boolean OnFirst,
+                                    const Handle(Adaptor2d_HCurve2d)& COnSurf) Standard_OVERRIDE;
+  
+  Standard_EXPORT void GetTolerance (math_Vector& Tolerance,
+                                     const Standard_Real Tol) const Standard_OVERRIDE;
+  
+  Standard_EXPORT void GetBounds (math_Vector& InfBound,
+                                  math_Vector& SupBound) const Standard_OVERRIDE;
+  
+  //! returns the number of equations of the function.
+  Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
+  
+  //! returns the values <F> of the functions and the derivatives
+  //! <D> for the variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Values (const math_Vector& X,
+                                           math_Vector& F,
+                                           math_Matrix& D) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual void Set (const Standard_Real Dist1,
+                                    const Standard_Real Dist2,
+                                    const Standard_Integer Choix) = 0;
+
+
+
+
+protected:
+
+  Handle(Adaptor3d_HSurface) surf1;
+  Handle(Adaptor3d_HSurface) surf2;
+  Handle(Adaptor3d_HCurve) curv;
+  Handle(Adaptor2d_HCurve2d) csurf;
+  Standard_Integer choix;
+  Standard_Boolean first;
+
+
+private:
+
+  
+};
+
+
+
+
+
+
+
+#endif // _BlendFunc_GenChamfInv_HeaderFile
diff --git a/src/BlendFunc/BlendFunc_GenChamfer.cxx b/src/BlendFunc/BlendFunc_GenChamfer.cxx
new file mode 100644 (file)
index 0000000..54fe638
--- /dev/null
@@ -0,0 +1,356 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Adaptor3d_HCurve.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <Blend_Point.hxx>
+#include <BlendFunc.hxx>
+#include <BlendFunc_Chamfer.hxx>
+#include <ElCLib.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Vec2d.hxx>
+#include <math_Matrix.hxx>
+#include <Precision.hxx>
+#include <Standard_NotImplemented.hxx>
+
+
+//=======================================================================
+//function : BlendFunc_GenChamfer
+//purpose  : 
+//=======================================================================
+BlendFunc_GenChamfer::BlendFunc_GenChamfer(const Handle(Adaptor3d_HSurface)& S1,
+                                           const Handle(Adaptor3d_HSurface)& S2,
+                                           const Handle(Adaptor3d_HCurve)&   CG)
+  : surf1(S1),surf2(S2),curv(CG),
+    distmin(RealLast())
+{
+}
+
+//=======================================================================
+//function : NbEquations
+//purpose  : 
+//=======================================================================
+
+Standard_Integer BlendFunc_GenChamfer::NbEquations () const
+{
+  return 4;
+}
+
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfer::Set(const Standard_Real, const Standard_Real)
+{
+}
+
+//=======================================================================
+//function : GetTolerance
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfer::GetTolerance(math_Vector& Tolerance, const Standard_Real Tol) const
+{
+  Tolerance(1) = surf1->UResolution(Tol);
+  Tolerance(2) = surf1->VResolution(Tol);
+  Tolerance(3) = surf2->UResolution(Tol);
+  Tolerance(4) = surf2->VResolution(Tol);
+}
+
+//=======================================================================
+//function : GetBounds
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfer::GetBounds(math_Vector& InfBound, math_Vector& SupBound) const
+{
+  InfBound(1) = surf1->FirstUParameter();
+  InfBound(2) = surf1->FirstVParameter();
+  InfBound(3) = surf2->FirstUParameter();
+  InfBound(4) = surf2->FirstVParameter();
+  SupBound(1) = surf1->LastUParameter();
+  SupBound(2) = surf1->LastVParameter();
+  SupBound(3) = surf2->LastUParameter();
+  SupBound(4) = surf2->LastVParameter();
+
+  for(Standard_Integer i = 1; i <= 4; i++){
+    if(!Precision::IsInfinite(InfBound(i)) &&
+       !Precision::IsInfinite(SupBound(i))) {
+      const Standard_Real range = (SupBound(i) - InfBound(i));
+      InfBound(i) -= range;
+      SupBound(i) += range;
+    }
+  }
+}
+
+//=======================================================================
+//function : GetMinimalDistance
+//purpose  : 
+//=======================================================================
+
+Standard_Real BlendFunc_GenChamfer::GetMinimalDistance() const
+{
+  return distmin;
+}
+
+//=======================================================================
+//function : Values
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_GenChamfer::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
+{
+  Standard_Boolean val = Value(X,F);
+  return (val && Derivatives(X,D));
+}
+
+//=======================================================================
+//function : Section
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfer::Section(const Standard_Real /*Param*/,
+                                   const Standard_Real U1,
+                                   const Standard_Real V1,
+                                   const Standard_Real U2,
+                                   const Standard_Real V2,
+                                   Standard_Real& Pdeb,
+                                   Standard_Real& Pfin,
+                                   gp_Lin& C)
+{
+  const gp_Pnt pts1 = surf1->Value(U1,V1);
+  const gp_Pnt pts2 = surf2->Value(U2,V2);
+  const gp_Dir dir( gp_Vec(pts1,pts2) );
+
+  C.SetLocation(pts1);
+  C.SetDirection(dir);
+
+  Pdeb = 0.;
+  Pfin = ElCLib::Parameter(C,pts2);
+}  
+
+//=======================================================================
+//function : IsRational
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_GenChamfer::IsRational() const
+{
+  return Standard_False;
+}
+
+//=======================================================================
+//function : GetMinimalWeight
+//purpose  : 
+//=======================================================================
+void BlendFunc_GenChamfer::GetMinimalWeight(TColStd_Array1OfReal& Weights) const 
+{
+  Weights.Init(1);
+}
+
+
+//=======================================================================
+//function : NbIntervals
+//purpose  : 
+//=======================================================================
+
+Standard_Integer BlendFunc_GenChamfer::NbIntervals (const GeomAbs_Shape S) const
+{
+  return  curv->NbIntervals(BlendFunc::NextShape(S));
+}
+
+
+//=======================================================================
+//function : Intervals
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfer::Intervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const
+{
+  curv->Intervals(T, BlendFunc::NextShape(S)); 
+}
+
+//=======================================================================
+//function : GetShape
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfer::GetShape (Standard_Integer& NbPoles,
+                                 Standard_Integer& NbKnots,
+                                 Standard_Integer& Degree,
+                                 Standard_Integer& NbPoles2d)
+{
+  NbPoles = 2;
+  NbPoles2d = 2;
+  NbKnots = 2;
+  Degree = 1;  
+}
+  
+//=======================================================================
+//function : GetTolerance
+//purpose  : Determine les Tolerance a utiliser dans les approximations.
+//=======================================================================
+void BlendFunc_GenChamfer::GetTolerance(const Standard_Real BoundTol, 
+                                        const Standard_Real, 
+                                        const Standard_Real, 
+                                        math_Vector& Tol3d, 
+                                        math_Vector&) const
+{
+  Tol3d.Init(BoundTol);
+}
+
+//=======================================================================
+//function : Knots
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfer::Knots(TColStd_Array1OfReal& TKnots)
+{
+  TKnots(1) = 0.;
+  TKnots(2) = 1.;
+}
+
+
+//=======================================================================
+//function : Mults
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfer::Mults(TColStd_Array1OfInteger& TMults)
+{
+  TMults(1) = 2;
+  TMults(2) = 2;
+}
+
+//=======================================================================
+//function : Section
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_GenChamfer::Section
+  (const Blend_Point& /*P*/,
+   TColgp_Array1OfPnt& /*Poles*/,
+   TColgp_Array1OfVec& /*DPoles*/,
+   TColgp_Array1OfVec& /*D2Poles*/,
+   TColgp_Array1OfPnt2d& /*Poles2d*/,
+   TColgp_Array1OfVec2d& /*DPoles2d*/,
+   TColgp_Array1OfVec2d& /*D2Poles2d*/,
+   TColStd_Array1OfReal& /*Weights*/,
+   TColStd_Array1OfReal& /*DWeights*/,
+   TColStd_Array1OfReal& /*D2Weights*/)
+{
+  return Standard_False;
+}
+
+//=======================================================================
+//function : Section
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean BlendFunc_GenChamfer::Section
+  (const Blend_Point& P,
+   TColgp_Array1OfPnt& Poles,
+   TColgp_Array1OfVec& DPoles,
+   TColgp_Array1OfPnt2d& Poles2d,
+   TColgp_Array1OfVec2d& DPoles2d,
+   TColStd_Array1OfReal& Weights,
+   TColStd_Array1OfReal& DWeights)
+{
+  math_Vector sol(1,4),valsol(1,4),secmember(1,4);
+  math_Matrix gradsol(1,4,1,4);
+
+  Standard_Real prm = P.Parameter();
+  Standard_Integer low = Poles.Lower();
+  Standard_Integer upp = Poles.Upper();
+  Standard_Boolean istgt;
+
+  P.ParametersOnS1(sol(1),sol(2));
+  P.ParametersOnS2(sol(3),sol(4));
+
+  Set(prm);
+  
+  Values(sol,valsol,gradsol);
+  IsSolution(sol,tol); 
+
+  istgt = IsTangencyPoint();
+
+  Poles2d(Poles2d.Lower()).SetCoord(sol(1),sol(2));
+  Poles2d(Poles2d.Upper()).SetCoord(sol(3),sol(4));
+  if (!istgt) {
+  DPoles2d(Poles2d.Lower()).SetCoord(Tangent2dOnS1().X(),
+                                    Tangent2dOnS1().Y());
+  DPoles2d(Poles2d.Upper()).SetCoord(Tangent2dOnS2().X(),
+                                    Tangent2dOnS2().Y());
+  }
+  Poles(low) = PointOnS1();
+  Poles(upp) = PointOnS2();
+  Weights(low) = 1.0;
+  Weights(upp) = 1.0;
+  if (!istgt) {
+    DPoles(low) = TangentOnS1();
+    DPoles(upp) = TangentOnS2();
+    DWeights(low) = 0.0;
+    DWeights(upp) = 0.0;  
+  }
+
+  return (!istgt);
+}
+
+//=======================================================================
+//function : Section
+//purpose  : 
+//=======================================================================
+
+void BlendFunc_GenChamfer::Section(const Blend_Point& P,
+                                   TColgp_Array1OfPnt& Poles,
+                                   TColgp_Array1OfPnt2d& Poles2d,
+                                   TColStd_Array1OfReal& Weights)
+{
+  Standard_Real u1,v1,u2,v2,prm = P.Parameter();
+  Standard_Integer low = Poles.Lower();
+  Standard_Integer upp = Poles.Upper();
+  math_Vector X(1,4), F(1,4);
+
+  P.ParametersOnS1(u1,v1);
+  P.ParametersOnS2(u2,v2);
+  X(1)=u1;
+  X(2)=v1;
+  X(3)=u2;
+  X(4)=v2;
+  Poles2d(Poles2d.Lower()).SetCoord(u1,v1);
+  Poles2d(Poles2d.Upper()).SetCoord(u2,v2);
+
+  Set(prm);
+  Value(X,F);
+  Poles(low) = PointOnS1();
+  Poles(upp) = PointOnS2();
+  Weights(low) = 1.0;
+  Weights(upp) = 1.0;
+}
+
+void BlendFunc_GenChamfer::Resolution(const Standard_Integer IC2d, const Standard_Real Tol,
+                                      Standard_Real& TolU, Standard_Real& TolV) const
+{
+  if(IC2d == 1){
+    TolU = surf1->UResolution(Tol);
+    TolV = surf1->VResolution(Tol);
+  }
+  else {
+    TolU = surf2->UResolution(Tol);
+    TolV = surf2->VResolution(Tol);
+  }
+}
diff --git a/src/BlendFunc/BlendFunc_GenChamfer.hxx b/src/BlendFunc/BlendFunc_GenChamfer.hxx
new file mode 100644 (file)
index 0000000..a79f066
--- /dev/null
@@ -0,0 +1,200 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BlendFunc_GenChamfer_HeaderFile
+#define _BlendFunc_GenChamfer_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Standard_Integer.hxx>
+#include <Standard_Real.hxx>
+#include <BlendFunc_Corde.hxx>
+#include <Blend_Function.hxx>
+#include <Standard_Boolean.hxx>
+#include <math_Vector.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <GeomAbs_Shape.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array1OfVec.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <TColgp_Array1OfVec2d.hxx>
+class Adaptor3d_HSurface;
+class Adaptor3d_HCurve;
+class math_Matrix;
+class gp_Pnt;
+class gp_Vec;
+class gp_Vec2d;
+class gp_Lin;
+class Blend_Point;
+
+
+
+//! Deferred class for a function used to compute a general chamfer
+class BlendFunc_GenChamfer  : public Blend_Function
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+  Standard_EXPORT BlendFunc_GenChamfer(const Handle(Adaptor3d_HSurface)& S1,
+                                       const Handle(Adaptor3d_HSurface)& S2,
+                                       const Handle(Adaptor3d_HCurve)& CG);
+  
+  //! returns the number of equations of the function.
+  Standard_EXPORT Standard_Integer NbEquations() const Standard_OVERRIDE;
+  
+  //! returns the values <F> of the functions and the derivatives
+  //! <D> for the variable <X>.
+  //! Returns True if the computation was done successfully,
+  //! False otherwise.
+  Standard_EXPORT Standard_Boolean Values (const math_Vector& X,
+                                           math_Vector& F,
+                                           math_Matrix& D) Standard_OVERRIDE;
+  
+  //! Sets the value of the parameter along the guide line.
+  //! This determines the plane in which the solution has
+  //! to be found.
+  Standard_EXPORT void Set (const Standard_Real Param) Standard_OVERRIDE = 0;
+  
+  //! Sets the bounds of the parametric interval on
+  //! the guide line.
+  //! This determines the derivatives in these values if the
+  //! function is not Cn.
+  Standard_EXPORT void Set (const Standard_Real First, const Standard_Real Last) Standard_OVERRIDE;
+  
+  Standard_EXPORT void GetTolerance (math_Vector& Tolerance,
+                                     const Standard_Real Tol) const Standard_OVERRIDE;
+  
+  Standard_EXPORT void GetBounds (math_Vector& InfBound,
+                                  math_Vector& SupBound) const Standard_OVERRIDE;
+  
+  //! Returns   the    minimal  Distance  beetween   two
+  //! extremitys of calculed sections.
+  Standard_EXPORT Standard_Real GetMinimalDistance() const Standard_OVERRIDE;
+  
+  //! Sets the distances and the "quadrant".
+  Standard_EXPORT virtual void Set (const Standard_Real Dist1,
+                                    const Standard_Real Dist2,
+                                    const Standard_Integer Choix) = 0;
+  
+  //! Returns False
+  Standard_EXPORT Standard_Boolean IsRational() const Standard_OVERRIDE;
+  
+  //! Compute the minimal value of weight for each poles
+  //! of all sections.
+  Standard_EXPORT void GetMinimalWeight (TColStd_Array1OfReal& Weigths) const Standard_OVERRIDE;
+  
+  //! Returns  the number  of  intervals for  continuity
+  //! <S>. May be one if Continuity(me) >= <S>
+  Standard_EXPORT Standard_Integer NbIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
+  
+  //! Stores in <T> the  parameters bounding the intervals
+  //! of continuity <S>.
+  //!
+  //! The array must provide  enough room to  accomodate
+  //! for the parameters. i.e. T.Length() > NbIntervals()
+  //! raises
+  //! OutOfRange from Standard
+  Standard_EXPORT void Intervals (TColStd_Array1OfReal& T,
+                                  const GeomAbs_Shape S) const Standard_OVERRIDE;
+  
+  Standard_EXPORT void GetShape (Standard_Integer& NbPoles,
+                                 Standard_Integer& NbKnots,
+                                 Standard_Integer& Degree,
+                                 Standard_Integer& NbPoles2d) Standard_OVERRIDE;
+  
+  //! Returns the tolerance to reach in approximation
+  //! to respecte
+  //! BoundTol error at the Boundary
+  //! AngleTol tangent error at the Boundary
+  //! SurfTol error inside the surface.
+  Standard_EXPORT void GetTolerance (const Standard_Real BoundTol,
+                                     const Standard_Real SurfTol,
+                                     const Standard_Real AngleTol,
+                                     math_Vector& Tol3d,
+                                     math_Vector& Tol1D) const Standard_OVERRIDE;
+  
+  Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) Standard_OVERRIDE;
+  
+  Standard_EXPORT void Mults (TColStd_Array1OfInteger& TMults) Standard_OVERRIDE;
+  
+  //! Obsolete method
+  Standard_EXPORT void Section (const Standard_Real Param,
+                                const Standard_Real U1,
+                                const Standard_Real V1,
+                                const Standard_Real U2,
+                                const Standard_Real V2,
+                                Standard_Real& Pdeb,
+                                Standard_Real& Pfin,
+                                gp_Lin& C);
+  
+  //! Used for the first and last section
+  Standard_EXPORT Standard_Boolean Section (const Blend_Point& P,
+                                            TColgp_Array1OfPnt& Poles,
+                                            TColgp_Array1OfVec& DPoles,
+                                            TColgp_Array1OfVec& D2Poles,
+                                            TColgp_Array1OfPnt2d& Poles2d,
+                                            TColgp_Array1OfVec2d& DPoles2d,
+                                            TColgp_Array1OfVec2d& D2Poles2d,
+                                            TColStd_Array1OfReal& Weigths,
+                                            TColStd_Array1OfReal& DWeigths,
+                                            TColStd_Array1OfReal& D2Weigths) Standard_OVERRIDE;
+  
+  //! Used for the first and last section
+  Standard_EXPORT Standard_Boolean Section (const Blend_Point& P,
+                                            TColgp_Array1OfPnt& Poles,
+                                            TColgp_Array1OfVec& DPoles,
+                                            TColgp_Array1OfPnt2d& Poles2d,
+                                            TColgp_Array1OfVec2d& DPoles2d,
+                                            TColStd_Array1OfReal& Weigths,
+                                            TColStd_Array1OfReal& DWeigths) Standard_OVERRIDE;
+  
+  Standard_EXPORT void Section (const Blend_Point& P,
+                                TColgp_Array1OfPnt& Poles,
+                                TColgp_Array1OfPnt2d& Poles2d,
+                                TColStd_Array1OfReal& Weigths) Standard_OVERRIDE;
+  
+  Standard_EXPORT void Resolution (const Standard_Integer IC2d,
+                                   const Standard_Real Tol,
+                                   Standard_Real& TolU,
+                                   Standard_Real& TolV) const Standard_OVERRIDE;
+
+
+
+
+protected:
+
+  Handle(Adaptor3d_HSurface) surf1;
+  Handle(Adaptor3d_HSurface) surf2;
+  Handle(Adaptor3d_HCurve) curv;
+  Standard_Integer choix;
+  Standard_Real tol;
+  Standard_Real distmin;
+
+
+private:
+
+
+};
+
+
+
+
+
+
+
+#endif // _BlendFunc_GenChamfer_HeaderFile
index ae10cff2c5f948c885f78432c88c9b4c3fda790d..e353a1144955a93fbe6eddb364df880e11cf58ed 100644 (file)
@@ -1,5 +1,9 @@
 BlendFunc.cxx
 BlendFunc.hxx
+BlendFunc_GenChamfer.cxx
+BlendFunc_GenChamfer.hxx
+BlendFunc_GenChamfInv.cxx
+BlendFunc_GenChamfInv.hxx
 BlendFunc_Chamfer.cxx
 BlendFunc_Chamfer.hxx
 BlendFunc_ChamfInv.cxx
@@ -30,3 +34,11 @@ BlendFunc_SectionShape.hxx
 BlendFunc_Tensor.cxx
 BlendFunc_Tensor.hxx
 BlendFunc_Tensor.lxx
+BlendFunc_ConstThroat.cxx
+BlendFunc_ConstThroat.hxx
+BlendFunc_ConstThroatInv.cxx
+BlendFunc_ConstThroatInv.hxx
+BlendFunc_ConstThroatWithPenetration.cxx
+BlendFunc_ConstThroatWithPenetration.hxx
+BlendFunc_ConstThroatWithPenetrationInv.cxx
+BlendFunc_ConstThroatWithPenetrationInv.hxx
index 238c0b850d6a40584ecb0950599791188b3c47cb..d07ad09b60d8dbd0aa7ed99ce7487ad5a851d532 100644 (file)
@@ -30,6 +30,7 @@
 #include <ChFiDS_Regularities.hxx>
 #include <TopTools_ListOfShape.hxx>
 #include <TopTools_DataMapOfShapeListOfInteger.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_Integer.hxx>
 #include <ChFiDS_ErrorStatus.hxx>
@@ -37,6 +38,9 @@
 #include <TopAbs_Orientation.hxx>
 #include <ChFiDS_SequenceOfSurfData.hxx>
 #include <TopAbs_State.hxx>
+
+#include <BRepAdaptor_Surface.hxx>
+
 class TopOpeBRepDS_HDataStructure;
 class TopOpeBRepBuild_HBuilder;
 class Standard_OutOfRange;
@@ -82,9 +86,15 @@ public:
 
   Standard_EXPORT virtual ~ChFi3d_Builder();
   
-  Standard_EXPORT void SetParams (const Standard_Real Tang, const Standard_Real Tesp, const Standard_Real T2d, const Standard_Real TApp3d, const Standard_Real TolApp2d, const Standard_Real Fleche);
+  Standard_EXPORT void SetParams (const Standard_Real Tang,
+                                  const Standard_Real Tesp,
+                                  const Standard_Real T2d,
+                                  const Standard_Real TApp3d,
+                                  const Standard_Real TolApp2d,
+                                  const Standard_Real Fleche);
   
-  Standard_EXPORT void SetContinuity (const GeomAbs_Shape InternalContinuity, const Standard_Real AngularTolerance);
+  Standard_EXPORT void SetContinuity (const GeomAbs_Shape InternalContinuity,
+                                      const Standard_Real AngularTolerance);
   
   //! extracts from  the list the contour containing edge E.
   Standard_EXPORT void Remove (const TopoDS_Edge& E);
@@ -96,7 +106,8 @@ public:
   //! gives  the number of  the contour containing E or 0
   //! if E does  not  belong  to  any  contour.
   //! Sets in IndexInSpine the index of E in the contour if it's found
-  Standard_EXPORT Standard_Integer Contains (const TopoDS_Edge& E, Standard_Integer& IndexInSpine) const;
+  Standard_EXPORT Standard_Integer Contains (const TopoDS_Edge& E,
+                                             Standard_Integer& IndexInSpine) const;
   
   //! gives the number of  disjoint contours on  which
   //! the  fillets  are  calculated
@@ -119,11 +130,13 @@ public:
   
   //! returns the abscissa of the vertex V on
   //! the contour of index IC.
-  Standard_EXPORT Standard_Real Abscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const;
+  Standard_EXPORT Standard_Real Abscissa (const Standard_Integer IC,
+                                          const TopoDS_Vertex& V) const;
   
   //! returns the relative abscissa([0.,1.]) of the
   //! vertex V on the contour of index IC.
-  Standard_EXPORT Standard_Real RelativeAbscissa (const Standard_Integer IC, const TopoDS_Vertex& V) const;
+  Standard_EXPORT Standard_Real RelativeAbscissa (const Standard_Integer IC,
+                                                  const TopoDS_Vertex& V) const;
   
   //! returns true if the contour of index IC is closed
   //! an tangent.
@@ -158,7 +171,8 @@ public:
   Standard_EXPORT Standard_Integer NbComputedSurfaces (const Standard_Integer IC) const;
   
   //! Returns the IS'th surface calculated on  the contour IC.
-  Standard_EXPORT Handle(Geom_Surface) ComputedSurface (const Standard_Integer IC, const Standard_Integer IS) const;
+  Standard_EXPORT Handle(Geom_Surface) ComputedSurface (const Standard_Integer IC,
+                                                        const Standard_Integer IS) const;
   
   //! Returns the number of vertices on  which the calculation
   //! has failed.
@@ -189,7 +203,16 @@ public:
   //! Method, implemented in the inheritants, calculates
   //! the elements of construction of the surface (fillet or
   //! chamfer).
-  Standard_EXPORT Standard_Boolean SplitKPart (const Handle(ChFiDS_SurfData)& Data, ChFiDS_SequenceOfSurfData& SetData, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Iedge, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, Standard_Boolean& Intf, Standard_Boolean& Intl);
+  Standard_EXPORT Standard_Boolean SplitKPart (const Handle(ChFiDS_SurfData)& Data,
+                                               ChFiDS_SequenceOfSurfData& SetData,
+                                               const Handle(ChFiDS_Spine)& Spine,
+                                               const Standard_Integer Iedge,
+                                               const Handle(Adaptor3d_HSurface)& S1,
+                                               const Handle(Adaptor3d_TopolTool)& I1,
+                                               const Handle(Adaptor3d_HSurface)& S2,
+                                               const Handle(Adaptor3d_TopolTool)& I2,
+                                               Standard_Boolean& Intf,
+                                               Standard_Boolean& Intl);
   
   Standard_EXPORT Standard_Boolean PerformTwoCornerbyInter (const Standard_Integer Index);
 
@@ -203,92 +226,544 @@ protected:
   
   Standard_EXPORT virtual void SimulKPart (const Handle(ChFiDS_SurfData)& SD) const = 0;
   
-  Standard_EXPORT virtual Standard_Boolean SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, const math_Vector& Soldep, Standard_Integer& Intf, Standard_Integer& Intl) = 0;
-  
-  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const TopAbs_Orientation Or2, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep);
-  
-  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep);
-  
-  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const TopAbs_Orientation Or2, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP1, const Standard_Boolean RecRst1, const Standard_Boolean RecP2, const Standard_Boolean RecRst2, const math_Vector& Soldep);
-  
-  Standard_EXPORT Standard_Boolean SimulData (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, Blend_Function& Func, Blend_FuncInv& FInv, const Standard_Real PFirst, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const math_Vector& Soldep, const Standard_Integer NbSecMin, const Standard_Boolean RecOnS1 = Standard_False, const Standard_Boolean RecOnS2 = Standard_False);
-  
-  Standard_EXPORT Standard_Boolean SimulData (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& HGuide, Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor2d_HCurve2d)& PC2, const Handle(Adaptor3d_TopolTool)& I2, Standard_Boolean& Decroch, Blend_SurfRstFunction& Func, Blend_FuncInv& FInv, Blend_SurfPointFuncInv& FInvP, Blend_SurfCurvFuncInv& FInvC, const Standard_Real PFirst, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const math_Vector& Soldep, const Standard_Integer NbSecMin, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst);
-  
-  Standard_EXPORT Standard_Boolean SimulData (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& HGuide, Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor2d_HCurve2d)& PC1, const Handle(Adaptor3d_TopolTool)& I1, Standard_Boolean& Decroch1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor2d_HCurve2d)& PC2, const Handle(Adaptor3d_TopolTool)& I2, Standard_Boolean& Decroch2, Blend_RstRstFunction& Func, Blend_SurfCurvFuncInv& FInv1, Blend_CurvPointFuncInv& FInvP1, Blend_SurfCurvFuncInv& FInv2, Blend_CurvPointFuncInv& FInvP2, const Standard_Real PFirst, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const math_Vector& Soldep, const Standard_Integer NbSecMin, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP1, const Standard_Boolean RecRst1, const Standard_Boolean RecP2, const Standard_Boolean RecRst2);
+  Standard_EXPORT virtual Standard_Boolean SimulSurf (Handle(ChFiDS_SurfData)& Data,
+                                                      const Handle(ChFiDS_HElSpine)& Guide,
+                                                      const Handle(ChFiDS_Spine)& Spine,
+                                                      const Standard_Integer Choix,
+                                                      const Handle(BRepAdaptor_HSurface)& S1,
+                                                      const Handle(Adaptor3d_TopolTool)& I1,
+                                                      const Handle(BRepAdaptor_HSurface)& S2,
+                                                      const Handle(Adaptor3d_TopolTool)& I2,
+                                                      const Standard_Real TolGuide,
+                                                      Standard_Real& First,
+                                                      Standard_Real& Last,
+                                                      const Standard_Boolean Inside,
+                                                      const Standard_Boolean Appro,
+                                                      const Standard_Boolean Forward,
+                                                      const Standard_Boolean RecOnS1,
+                                                      const Standard_Boolean RecOnS2,
+                                                      const math_Vector& Soldep,
+                                                      Standard_Integer& Intf,
+                                                      Standard_Integer& Intl) = 0;
+  
+  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
+                                          const Handle(ChFiDS_HElSpine)& Guide,
+                                          const Handle(ChFiDS_Spine)& Spine,
+                                          const Standard_Integer Choix,
+                                          const Handle(BRepAdaptor_HSurface)& S1,
+                                          const Handle(Adaptor3d_TopolTool)& I1,
+                                          const Handle(BRepAdaptor_HCurve2d)& PC1,
+                                          const Handle(BRepAdaptor_HSurface)& Sref1,
+                                          const Handle(BRepAdaptor_HCurve2d)& PCref1,
+                                          Standard_Boolean& Decroch1,
+                                          const Handle(BRepAdaptor_HSurface)& S2,
+                                          const Handle(Adaptor3d_TopolTool)& I2,
+                                          const TopAbs_Orientation Or2,
+                                          const Standard_Real Fleche,
+                                          const Standard_Real TolGuide,
+                                          Standard_Real& First,
+                                          Standard_Real& Last,
+                                          const Standard_Boolean Inside,
+                                          const Standard_Boolean Appro,
+                                          const Standard_Boolean Forward,
+                                          const Standard_Boolean RecP,
+                                          const Standard_Boolean RecS,
+                                          const Standard_Boolean RecRst,
+                                          const math_Vector& Soldep);
+  
+  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
+                                          const Handle(ChFiDS_HElSpine)& Guide,
+                                          const Handle(ChFiDS_Spine)& Spine,
+                                          const Standard_Integer Choix,
+                                          const Handle(BRepAdaptor_HSurface)& S1,
+                                          const Handle(Adaptor3d_TopolTool)& I1,
+                                          const TopAbs_Orientation Or1,
+                                          const Handle(BRepAdaptor_HSurface)& S2,
+                                          const Handle(Adaptor3d_TopolTool)& I2,
+                                          const Handle(BRepAdaptor_HCurve2d)& PC2,
+                                          const Handle(BRepAdaptor_HSurface)& Sref2,
+                                          const Handle(BRepAdaptor_HCurve2d)& PCref2,
+                                          Standard_Boolean& Decroch2,
+                                          const Standard_Real Fleche,
+                                          const Standard_Real TolGuide,
+                                          Standard_Real& First,
+                                          Standard_Real& Last,
+                                          const Standard_Boolean Inside,
+                                          const Standard_Boolean Appro,
+                                          const Standard_Boolean Forward,
+                                          const Standard_Boolean RecP,
+                                          const Standard_Boolean RecS,
+                                          const Standard_Boolean RecRst,
+                                          const math_Vector& Soldep);
+  
+  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
+                                          const Handle(ChFiDS_HElSpine)& Guide,
+                                          const Handle(ChFiDS_Spine)& Spine,
+                                          const Standard_Integer Choix,
+                                          const Handle(BRepAdaptor_HSurface)& S1,
+                                          const Handle(Adaptor3d_TopolTool)& I1,
+                                          const Handle(BRepAdaptor_HCurve2d)& PC1,
+                                          const Handle(BRepAdaptor_HSurface)& Sref1,
+                                          const Handle(BRepAdaptor_HCurve2d)& PCref1,
+                                          Standard_Boolean& Decroch1,
+                                          const TopAbs_Orientation Or1,
+                                          const Handle(BRepAdaptor_HSurface)& S2,
+                                          const Handle(Adaptor3d_TopolTool)& I2,
+                                          const Handle(BRepAdaptor_HCurve2d)& PC2,
+                                          const Handle(BRepAdaptor_HSurface)& Sref2,
+                                          const Handle(BRepAdaptor_HCurve2d)& PCref2,
+                                          Standard_Boolean& Decroch2,
+                                          const TopAbs_Orientation Or2,
+                                          const Standard_Real Fleche,
+                                          const Standard_Real TolGuide,
+                                          Standard_Real& First,
+                                          Standard_Real& Last,
+                                          const Standard_Boolean Inside,
+                                          const Standard_Boolean Appro,
+                                          const Standard_Boolean Forward,
+                                          const Standard_Boolean RecP1,
+                                          const Standard_Boolean RecRst1,
+                                          const Standard_Boolean RecP2,
+                                          const Standard_Boolean RecRst2,
+                                          const math_Vector& Soldep);
+  
+  Standard_EXPORT Standard_Boolean SimulData (Handle(ChFiDS_SurfData)& Data,
+                                              const Handle(ChFiDS_HElSpine)& Guide,
+                                              const Handle(ChFiDS_HElSpine)& AdditionalGuide,
+                                              Handle(BRepBlend_Line)& Lin,
+                                              const Handle(Adaptor3d_HSurface)& S1,
+                                              const Handle(Adaptor3d_TopolTool)& I1,
+                                              const Handle(Adaptor3d_HSurface)& S2,
+                                              const Handle(Adaptor3d_TopolTool)& I2,
+                                              Blend_Function& Func,
+                                              Blend_FuncInv& FInv,
+                                              const Standard_Real PFirst,
+                                              const Standard_Real MaxStep,
+                                              const Standard_Real Fleche,
+                                              const Standard_Real TolGuide,
+                                              Standard_Real& First,
+                                              Standard_Real& Last,
+                                              const Standard_Boolean Inside,
+                                              const Standard_Boolean Appro,
+                                              const Standard_Boolean Forward,
+                                              const math_Vector& Soldep,
+                                              const Standard_Integer NbSecMin,
+                                              const Standard_Boolean RecOnS1 = Standard_False,
+                                              const Standard_Boolean RecOnS2 = Standard_False);
+  
+  Standard_EXPORT Standard_Boolean SimulData (Handle(ChFiDS_SurfData)& Data,
+                                              const Handle(ChFiDS_HElSpine)& HGuide,
+                                              Handle(BRepBlend_Line)& Lin,
+                                              const Handle(Adaptor3d_HSurface)& S1,
+                                              const Handle(Adaptor3d_TopolTool)& I1,
+                                              const Handle(Adaptor3d_HSurface)& S2,
+                                              const Handle(Adaptor2d_HCurve2d)& PC2,
+                                              const Handle(Adaptor3d_TopolTool)& I2,
+                                              Standard_Boolean& Decroch,
+                                              Blend_SurfRstFunction& Func,
+                                              Blend_FuncInv& FInv,
+                                              Blend_SurfPointFuncInv& FInvP,
+                                              Blend_SurfCurvFuncInv& FInvC,
+                                              const Standard_Real PFirst,
+                                              const Standard_Real MaxStep,
+                                              const Standard_Real Fleche,
+                                              const Standard_Real TolGuide,
+                                              Standard_Real& First,
+                                              Standard_Real& Last,
+                                              const math_Vector& Soldep,
+                                              const Standard_Integer NbSecMin,
+                                              const Standard_Boolean Inside,
+                                              const Standard_Boolean Appro,
+                                              const Standard_Boolean Forward,
+                                              const Standard_Boolean RecP,
+                                              const Standard_Boolean RecS,
+                                              const Standard_Boolean RecRst);
+  
+  Standard_EXPORT Standard_Boolean SimulData (Handle(ChFiDS_SurfData)& Data,
+                                              const Handle(ChFiDS_HElSpine)& HGuide,
+                                              Handle(BRepBlend_Line)& Lin,
+                                              const Handle(Adaptor3d_HSurface)& S1,
+                                              const Handle(Adaptor2d_HCurve2d)& PC1,
+                                              const Handle(Adaptor3d_TopolTool)& I1,
+                                              Standard_Boolean& Decroch1,
+                                              const Handle(Adaptor3d_HSurface)& S2,
+                                              const Handle(Adaptor2d_HCurve2d)& PC2,
+                                              const Handle(Adaptor3d_TopolTool)& I2,
+                                              Standard_Boolean& Decroch2,
+                                              Blend_RstRstFunction& Func,
+                                              Blend_SurfCurvFuncInv& FInv1,
+                                              Blend_CurvPointFuncInv& FInvP1,
+                                              Blend_SurfCurvFuncInv& FInv2,
+                                              Blend_CurvPointFuncInv& FInvP2,
+                                              const Standard_Real PFirst,
+                                              const Standard_Real MaxStep,
+                                              const Standard_Real Fleche,
+                                              const Standard_Real TolGuide,
+                                              Standard_Real& First,
+                                              Standard_Real& Last,
+                                              const math_Vector& Soldep,
+                                              const Standard_Integer NbSecMin,
+                                              const Standard_Boolean Inside,
+                                              const Standard_Boolean Appro,
+                                              const Standard_Boolean Forward,
+                                              const Standard_Boolean RecP1,
+                                              const Standard_Boolean RecRst1,
+                                              const Standard_Boolean RecP2,
+                                              const Standard_Boolean RecRst2);
   
   Standard_EXPORT virtual void SetRegul() = 0;
   
-  Standard_EXPORT Standard_Boolean PerformElement (const Handle(ChFiDS_Spine)& CElement);
+  Standard_EXPORT Standard_Boolean PerformElement (const Handle(ChFiDS_Spine)& CElement,
+                                                   const Standard_Real         Offset,
+                                                   const TopoDS_Face&          theFirstFace);
   
   Standard_EXPORT void PerformExtremity (const Handle(ChFiDS_Spine)& CElement);
   
-  Standard_EXPORT void PerformSetOfSurf (Handle(ChFiDS_Stripe)& S, const Standard_Boolean Simul = Standard_False);
-  
-  Standard_EXPORT void PerformSetOfKPart (Handle(ChFiDS_Stripe)& S, const Standard_Boolean Simul = Standard_False);
-  
-  Standard_EXPORT void PerformSetOfKGen (Handle(ChFiDS_Stripe)& S, const Standard_Boolean Simul = Standard_False);
-  
-  Standard_EXPORT void Trunc (const Handle(ChFiDS_SurfData)& SD, const Handle(ChFiDS_Spine)& Spine, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const Standard_Integer iedge, const Standard_Boolean isfirst, const Standard_Integer cntlFiOnS);
-  
-  Standard_EXPORT void CallPerformSurf (Handle(ChFiDS_Stripe)& Stripe, const Standard_Boolean Simul, ChFiDS_SequenceOfSurfData& SeqSD, Handle(ChFiDS_SurfData)& SD, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Handle(BRepAdaptor_HSurface)& HS1, const Handle(BRepAdaptor_HSurface)& HS3, const gp_Pnt2d& P1, const gp_Pnt2d& P3, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HSurface)& HS2, const Handle(BRepAdaptor_HSurface)& HS4, const gp_Pnt2d& P2, const gp_Pnt2d& P4, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, math_Vector& Soldep, Standard_Integer& Intf, Standard_Integer& Intl, Handle(BRepAdaptor_HSurface)& Surf1, Handle(BRepAdaptor_HSurface)& Surf2);
+  Standard_EXPORT void PerformSetOfSurf (Handle(ChFiDS_Stripe)& S,
+                                         const Standard_Boolean Simul = Standard_False);
+  
+  Standard_EXPORT void PerformSetOfKPart (Handle(ChFiDS_Stripe)& S,
+                                          const Standard_Boolean Simul = Standard_False);
+  
+  Standard_EXPORT void PerformSetOfKGen (Handle(ChFiDS_Stripe)& S,
+                                         const Standard_Boolean Simul = Standard_False);
+  
+  Standard_EXPORT void Trunc (const Handle(ChFiDS_SurfData)& SD,
+                              const Handle(ChFiDS_Spine)& Spine,
+                              const Handle(Adaptor3d_HSurface)& S1,
+                              const Handle(Adaptor3d_HSurface)& S2,
+                              const Standard_Integer iedge,
+                              const Standard_Boolean isfirst,
+                              const Standard_Integer cntlFiOnS);
+  
+  Standard_EXPORT void CallPerformSurf (Handle(ChFiDS_Stripe)& Stripe,
+                                        const Standard_Boolean Simul,
+                                        ChFiDS_SequenceOfSurfData& SeqSD,
+                                        Handle(ChFiDS_SurfData)& SD,
+                                        const Handle(ChFiDS_HElSpine)& Guide,
+                                        const Handle(ChFiDS_Spine)& Spine,
+                                        const Handle(BRepAdaptor_HSurface)& HS1,
+                                        const Handle(BRepAdaptor_HSurface)& HS3,
+                                        const gp_Pnt2d& P1,
+                                        const gp_Pnt2d& P3,
+                                        const Handle(Adaptor3d_TopolTool)& I1,
+                                        const Handle(BRepAdaptor_HSurface)& HS2,
+                                        const Handle(BRepAdaptor_HSurface)& HS4,
+                                        const gp_Pnt2d& P2, const gp_Pnt2d& P4,
+                                        const Handle(Adaptor3d_TopolTool)& I2,
+                                        const Standard_Real MaxStep,
+                                        const Standard_Real Fleche,
+                                        const Standard_Real TolGuide,
+                                        Standard_Real& First,
+                                        Standard_Real& Last,
+                                        const Standard_Boolean Inside,
+                                        const Standard_Boolean Appro,
+                                        const Standard_Boolean Forward,
+                                        const Standard_Boolean RecOnS1,
+                                        const Standard_Boolean RecOnS2,
+                                        math_Vector& Soldep,
+                                        Standard_Integer& Intf,
+                                        Standard_Integer& Intl,
+                                        Handle(BRepAdaptor_HSurface)& Surf1,
+                                        Handle(BRepAdaptor_HSurface)& Surf2);
   
   //! Method, implemented in the inheritants, calculating
   //! elements of construction of the surface (fillet or
   //! chamfer).
-  Standard_EXPORT virtual Standard_Boolean PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, const math_Vector& Soldep, Standard_Integer& Intf, Standard_Integer& Intl) = 0;
+  Standard_EXPORT virtual Standard_Boolean PerformSurf (ChFiDS_SequenceOfSurfData& Data,
+                                                        const Handle(ChFiDS_HElSpine)& Guide,
+                                                        const Handle(ChFiDS_Spine)& Spine,
+                                                        const Standard_Integer Choix,
+                                                        const Handle(BRepAdaptor_HSurface)& S1,
+                                                        const Handle(Adaptor3d_TopolTool)& I1,
+                                                        const Handle(BRepAdaptor_HSurface)& S2,
+                                                        const Handle(Adaptor3d_TopolTool)& I2,
+                                                        const Standard_Real MaxStep,
+                                                        const Standard_Real Fleche,
+                                                        const Standard_Real TolGuide,
+                                                        Standard_Real& First,
+                                                        Standard_Real& Last,
+                                                        const Standard_Boolean Inside,
+                                                        const Standard_Boolean Appro,
+                                                        const Standard_Boolean Forward,
+                                                        const Standard_Boolean RecOnS1,
+                                                        const Standard_Boolean RecOnS2,
+                                                        const math_Vector& Soldep,
+                                                        Standard_Integer& Intf,
+                                                        Standard_Integer& Intl) = 0;
   
   //! Method, implemented  in inheritants, calculates
   //! the elements of construction of  the surface (fillet
   //! or chamfer) contact edge/face.
-  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const TopAbs_Orientation Or2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep);
+  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
+                                            const Handle(ChFiDS_HElSpine)& Guide,
+                                            const Handle(ChFiDS_Spine)& Spine,
+                                            const Standard_Integer Choix,
+                                            const Handle(BRepAdaptor_HSurface)& S1,
+                                            const Handle(Adaptor3d_TopolTool)& I1,
+                                            const Handle(BRepAdaptor_HCurve2d)& PC1,
+                                            const Handle(BRepAdaptor_HSurface)& Sref1,
+                                            const Handle(BRepAdaptor_HCurve2d)& PCref1,
+                                            Standard_Boolean& Decroch1,
+                                            const Handle(BRepAdaptor_HSurface)& S2,
+                                            const Handle(Adaptor3d_TopolTool)& I2,
+                                            const TopAbs_Orientation Or2,
+                                            const Standard_Real MaxStep,
+                                            const Standard_Real Fleche,
+                                            const Standard_Real TolGuide,
+                                            Standard_Real& First,
+                                            Standard_Real& Last,
+                                            const Standard_Boolean Inside,
+                                            const Standard_Boolean Appro,
+                                            const Standard_Boolean Forward,
+                                            const Standard_Boolean RecP,
+                                            const Standard_Boolean RecS,
+                                            const Standard_Boolean RecRst,
+                                            const math_Vector& Soldep);
   
   //! Method, implemented in  inheritants, calculates
   //! the elements of construction of  the surface (fillet
   //! or chamfer) contact edge/face.
-  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep);
+  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
+                                            const Handle(ChFiDS_HElSpine)& Guide,
+                                            const Handle(ChFiDS_Spine)& Spine,
+                                            const Standard_Integer Choix,
+                                            const Handle(BRepAdaptor_HSurface)& S1,
+                                            const Handle(Adaptor3d_TopolTool)& I1,
+                                            const TopAbs_Orientation Or1,
+                                            const Handle(BRepAdaptor_HSurface)& S2,
+                                            const Handle(Adaptor3d_TopolTool)& I2,
+                                            const Handle(BRepAdaptor_HCurve2d)& PC2,
+                                            const Handle(BRepAdaptor_HSurface)& Sref2,
+                                            const Handle(BRepAdaptor_HCurve2d)& PCref2,
+                                            Standard_Boolean& Decroch2,
+                                            const Standard_Real MaxStep,
+                                            const Standard_Real Fleche,
+                                            const Standard_Real TolGuide,
+                                            Standard_Real& First,
+                                            Standard_Real& Last,
+                                            const Standard_Boolean Inside,
+                                            const Standard_Boolean Appro,
+                                            const Standard_Boolean Forward,
+                                            const Standard_Boolean RecP,
+                                            const Standard_Boolean RecS,
+                                            const Standard_Boolean RecRst,
+                                            const math_Vector& Soldep);
   
   //! Method, implemented in inheritants, calculates
   //! the elements of construction of  the surface (fillet
   //! or chamfer) contact edge/edge.
-  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const TopAbs_Orientation Or2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP1, const Standard_Boolean RecRst1, const Standard_Boolean RecP2, const Standard_Boolean RecRst2, const math_Vector& Soldep);
+  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
+                                            const Handle(ChFiDS_HElSpine)& Guide,
+                                            const Handle(ChFiDS_Spine)& Spine,
+                                            const Standard_Integer Choix,
+                                            const Handle(BRepAdaptor_HSurface)& S1,
+                                            const Handle(Adaptor3d_TopolTool)& I1,
+                                            const Handle(BRepAdaptor_HCurve2d)& PC1,
+                                            const Handle(BRepAdaptor_HSurface)& Sref1,
+                                            const Handle(BRepAdaptor_HCurve2d)& PCref1,
+                                            Standard_Boolean& Decroch1,
+                                            const TopAbs_Orientation Or1,
+                                            const Handle(BRepAdaptor_HSurface)& S2,
+                                            const Handle(Adaptor3d_TopolTool)& I2,
+                                            const Handle(BRepAdaptor_HCurve2d)& PC2,
+                                            const Handle(BRepAdaptor_HSurface)& Sref2,
+                                            const Handle(BRepAdaptor_HCurve2d)& PCref2,
+                                            Standard_Boolean& Decroch2,
+                                            const TopAbs_Orientation Or2,
+                                            const Standard_Real MaxStep,
+                                            const Standard_Real Fleche,
+                                            const Standard_Real TolGuide,
+                                            Standard_Real& First,
+                                            Standard_Real& Last,
+                                            const Standard_Boolean Inside,
+                                            const Standard_Boolean Appro,
+                                            const Standard_Boolean Forward,
+                                            const Standard_Boolean RecP1,
+                                            const Standard_Boolean RecRst1,
+                                            const Standard_Boolean RecP2,
+                                            const Standard_Boolean RecRst2,
+                                            const math_Vector& Soldep);
   
   Standard_EXPORT virtual void PerformTwoCorner (const Standard_Integer Index) = 0;
   
   Standard_EXPORT virtual void PerformThreeCorner (const Standard_Integer Index) = 0;
   
-  Standard_EXPORT void PerformMoreThreeCorner (const Standard_Integer Index, const Standard_Integer nbcourb);
+  Standard_EXPORT void PerformMoreThreeCorner (const Standard_Integer Index,
+                                               const Standard_Integer nbcourb);
   
-  Standard_EXPORT virtual void ExtentOneCorner (const TopoDS_Vertex& V, const Handle(ChFiDS_Stripe)& S) = 0;
+  Standard_EXPORT virtual void ExtentOneCorner (const TopoDS_Vertex& V,
+                                                const Handle(ChFiDS_Stripe)& S) = 0;
   
-  Standard_EXPORT virtual void ExtentTwoCorner (const TopoDS_Vertex& V, const ChFiDS_ListOfStripe& LS) = 0;
+  Standard_EXPORT virtual void ExtentTwoCorner (const TopoDS_Vertex& V,
+                                                const ChFiDS_ListOfStripe& LS) = 0;
   
-  Standard_EXPORT virtual void ExtentThreeCorner (const TopoDS_Vertex& V, const ChFiDS_ListOfStripe& LS) = 0;
+  Standard_EXPORT virtual void ExtentThreeCorner (const TopoDS_Vertex& V,
+                                                  const ChFiDS_ListOfStripe& LS) = 0;
   
-  Standard_EXPORT virtual Standard_Boolean PerformFirstSection (const Handle(ChFiDS_Spine)& S, const Handle(ChFiDS_HElSpine)& HGuide, const Standard_Integer Choix, Handle(BRepAdaptor_HSurface)& S1, Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I1, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real Par, math_Vector& SolDep, TopAbs_State& Pos1, TopAbs_State& Pos2) const = 0;
+  Standard_EXPORT virtual Standard_Boolean PerformFirstSection (const Handle(ChFiDS_Spine)& S,
+                                                                const Handle(ChFiDS_HElSpine)& HGuide,
+                                                                const Standard_Integer Choix,
+                                                                Handle(BRepAdaptor_HSurface)& S1,
+                                                                Handle(BRepAdaptor_HSurface)& S2,
+                                                                const Handle(Adaptor3d_TopolTool)& I1,
+                                                                const Handle(Adaptor3d_TopolTool)& I2,
+                                                                const Standard_Real Par,
+                                                                math_Vector& SolDep,
+                                                                TopAbs_State& Pos1,
+                                                                TopAbs_State& Pos2) const = 0;
   
-  Standard_EXPORT Standard_Boolean SearchFace (const Handle(ChFiDS_Spine)& Sp, const ChFiDS_CommonPoint& Pc, const TopoDS_Face& FRef, TopoDS_Face& FVoi) const;
+  Standard_EXPORT Standard_Boolean SearchFace (const Handle(ChFiDS_Spine)& Sp,
+                                               const ChFiDS_CommonPoint& Pc,
+                                               const TopoDS_Face& FRef,
+                                               TopoDS_Face& FVoi) const;
   
-  Standard_EXPORT Standard_Boolean StripeOrientations (const Handle(ChFiDS_Spine)& Sp, TopAbs_Orientation& Or1, TopAbs_Orientation& Or2, Standard_Integer& ChoixConge) const;
+  Standard_EXPORT Standard_Boolean StripeOrientations (const Handle(ChFiDS_Spine)& Sp,
+                                                       TopAbs_Orientation& Or1,
+                                                       TopAbs_Orientation& Or2,
+                                                       Standard_Integer& ChoixConge) const;
   
   //! Calculates  a Line of contact face/face.
-  Standard_EXPORT Standard_Boolean ComputeData (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, Blend_Function& Func, Blend_FuncInv& FInv, const Standard_Real PFirst, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const math_Vector& Soldep, Standard_Integer& Intf, Standard_Integer& Intl, Standard_Boolean& Gd1, Standard_Boolean& Gd2, Standard_Boolean& Gf1, Standard_Boolean& Gf2, const Standard_Boolean RecOnS1 = Standard_False, const Standard_Boolean RecOnS2 = Standard_False);
+  Standard_EXPORT Standard_Boolean ComputeData (Handle(ChFiDS_SurfData)& Data,
+                                                const Handle(ChFiDS_HElSpine)& Guide,
+                                                const Handle(ChFiDS_Spine)& Spine,
+                                                Handle(BRepBlend_Line)& Lin,
+                                                const Handle(Adaptor3d_HSurface)& S1,
+                                                const Handle(Adaptor3d_TopolTool)& I1,
+                                                const Handle(Adaptor3d_HSurface)& S2,
+                                                const Handle(Adaptor3d_TopolTool)& I2,
+                                                Blend_Function& Func,
+                                                Blend_FuncInv& FInv,
+                                                const Standard_Real PFirst,
+                                                const Standard_Real MaxStep,
+                                                const Standard_Real Fleche,
+                                                const Standard_Real TolGuide,
+                                                Standard_Real& First,
+                                                Standard_Real& Last,
+                                                const Standard_Boolean Inside,
+                                                const Standard_Boolean Appro,
+                                                const Standard_Boolean Forward,
+                                                const math_Vector& Soldep,
+                                                Standard_Integer& Intf,
+                                                Standard_Integer& Intl,
+                                                Standard_Boolean& Gd1,
+                                                Standard_Boolean& Gd2,
+                                                Standard_Boolean& Gf1,
+                                                Standard_Boolean& Gf2,
+                                                const Standard_Boolean RecOnS1 = Standard_False,
+                                                const Standard_Boolean RecOnS2 = Standard_False);
   
   //! Calculates a Line of contact edge/face.
-  Standard_EXPORT Standard_Boolean ComputeData (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& HGuide, Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor2d_HCurve2d)& PC2, const Handle(Adaptor3d_TopolTool)& I2, Standard_Boolean& Decroch, Blend_SurfRstFunction& Func, Blend_FuncInv& FInv, Blend_SurfPointFuncInv& FInvP, Blend_SurfCurvFuncInv& FInvC, const Standard_Real PFirst, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const math_Vector& Soldep, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst);
+  Standard_EXPORT Standard_Boolean ComputeData (Handle(ChFiDS_SurfData)& Data,
+                                                const Handle(ChFiDS_HElSpine)& HGuide,
+                                                Handle(BRepBlend_Line)& Lin,
+                                                const Handle(Adaptor3d_HSurface)& S1,
+                                                const Handle(Adaptor3d_TopolTool)& I1,
+                                                const Handle(Adaptor3d_HSurface)& S2,
+                                                const Handle(Adaptor2d_HCurve2d)& PC2,
+                                                const Handle(Adaptor3d_TopolTool)& I2,
+                                                Standard_Boolean& Decroch,
+                                                Blend_SurfRstFunction& Func,
+                                                Blend_FuncInv& FInv,
+                                                Blend_SurfPointFuncInv& FInvP,
+                                                Blend_SurfCurvFuncInv& FInvC,
+                                                const Standard_Real PFirst,
+                                                const Standard_Real MaxStep,
+                                                const Standard_Real Fleche,
+                                                const Standard_Real TolGuide,
+                                                Standard_Real& First,
+                                                Standard_Real& Last,
+                                                const math_Vector& Soldep,
+                                                const Standard_Boolean Inside,
+                                                const Standard_Boolean Appro,
+                                                const Standard_Boolean Forward,
+                                                const Standard_Boolean RecP,
+                                                const Standard_Boolean RecS,
+                                                const Standard_Boolean RecRst);
   
   //! Calculates a Line of contact edge/edge.
-  Standard_EXPORT Standard_Boolean ComputeData (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& HGuide, Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor2d_HCurve2d)& PC1, const Handle(Adaptor3d_TopolTool)& I1, Standard_Boolean& Decroch1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Adaptor2d_HCurve2d)& PC2, const Handle(Adaptor3d_TopolTool)& I2, Standard_Boolean& Decroch2, Blend_RstRstFunction& Func, Blend_SurfCurvFuncInv& FInv1, Blend_CurvPointFuncInv& FInvP1, Blend_SurfCurvFuncInv& FInv2, Blend_CurvPointFuncInv& FInvP2, const Standard_Real PFirst, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const math_Vector& Soldep, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP1, const Standard_Boolean RecRst1, const Standard_Boolean RecP2, const Standard_Boolean RecRst2);
-  
-  Standard_EXPORT Standard_Boolean CompleteData (Handle(ChFiDS_SurfData)& Data, Blend_Function& Func, Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation Or1, const Standard_Boolean Gd1, const Standard_Boolean Gd2, const Standard_Boolean Gf1, const Standard_Boolean Gf2, const Standard_Boolean Reversed = Standard_False);
-  
-  Standard_EXPORT Standard_Boolean CompleteData (Handle(ChFiDS_SurfData)& Data, Blend_SurfRstFunction& Func, Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation Or, const Standard_Boolean Reversed);
-  
-  Standard_EXPORT Standard_Boolean CompleteData (Handle(ChFiDS_SurfData)& Data, Blend_RstRstFunction& Func, Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation Or);
-  
-  Standard_EXPORT Standard_Boolean StoreData (Handle(ChFiDS_SurfData)& Data, const AppBlend_Approx& Approx, const Handle(BRepBlend_Line)& Lin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Adaptor3d_HSurface)& S2, const TopAbs_Orientation Or1, const Standard_Boolean Gd1, const Standard_Boolean Gd2, const Standard_Boolean Gf1, const Standard_Boolean Gf2, const Standard_Boolean Reversed = Standard_False);
-  
-  Standard_EXPORT Standard_Boolean CompleteData (Handle(ChFiDS_SurfData)& Data, const Handle(Geom_Surface)& Surfcoin, const Handle(Adaptor3d_HSurface)& S1, const Handle(Geom2d_Curve)& PC1, const Handle(Adaptor3d_HSurface)& S2, const Handle(Geom2d_Curve)& PC2, const TopAbs_Orientation Or, const Standard_Boolean On1, const Standard_Boolean Gd1, const Standard_Boolean Gd2, const Standard_Boolean Gf1, const Standard_Boolean Gf2);
+  Standard_EXPORT Standard_Boolean ComputeData (Handle(ChFiDS_SurfData)& Data,
+                                                const Handle(ChFiDS_HElSpine)& HGuide,
+                                                Handle(BRepBlend_Line)& Lin,
+                                                const Handle(Adaptor3d_HSurface)& S1,
+                                                const Handle(Adaptor2d_HCurve2d)& PC1,
+                                                const Handle(Adaptor3d_TopolTool)& I1,
+                                                Standard_Boolean& Decroch1,
+                                                const Handle(Adaptor3d_HSurface)& S2,
+                                                const Handle(Adaptor2d_HCurve2d)& PC2,
+                                                const Handle(Adaptor3d_TopolTool)& I2,
+                                                Standard_Boolean& Decroch2,
+                                                Blend_RstRstFunction& Func,
+                                                Blend_SurfCurvFuncInv& FInv1,
+                                                Blend_CurvPointFuncInv& FInvP1,
+                                                Blend_SurfCurvFuncInv& FInv2,
+                                                Blend_CurvPointFuncInv& FInvP2,
+                                                const Standard_Real PFirst,
+                                                const Standard_Real MaxStep,
+                                                const Standard_Real Fleche,
+                                                const Standard_Real TolGuide,
+                                                Standard_Real& First,
+                                                Standard_Real& Last,
+                                                const math_Vector& Soldep,
+                                                const Standard_Boolean Inside,
+                                                const Standard_Boolean Appro,
+                                                const Standard_Boolean Forward,
+                                                const Standard_Boolean RecP1,
+                                                const Standard_Boolean RecRst1,
+                                                const Standard_Boolean RecP2,
+                                                const Standard_Boolean RecRst2);
+  
+  Standard_EXPORT Standard_Boolean CompleteData (Handle(ChFiDS_SurfData)& Data,
+                                                 Blend_Function& Func,
+                                                 Handle(BRepBlend_Line)& Lin,
+                                                 const Handle(Adaptor3d_HSurface)& S1,
+                                                 const Handle(Adaptor3d_HSurface)& S2,
+                                                 const TopAbs_Orientation Or1,
+                                                 const Standard_Boolean Gd1,
+                                                 const Standard_Boolean Gd2,
+                                                 const Standard_Boolean Gf1,
+                                                 const Standard_Boolean Gf2,
+                                                 const Standard_Boolean Reversed = Standard_False);
+  
+  Standard_EXPORT Standard_Boolean CompleteData (Handle(ChFiDS_SurfData)& Data,
+                                                 Blend_SurfRstFunction& Func,
+                                                 Handle(BRepBlend_Line)& Lin,
+                                                 const Handle(Adaptor3d_HSurface)& S1,
+                                                 const Handle(Adaptor3d_HSurface)& S2,
+                                                 const TopAbs_Orientation Or,
+                                                 const Standard_Boolean Reversed);
+  
+  Standard_EXPORT Standard_Boolean CompleteData (Handle(ChFiDS_SurfData)& Data,
+                                                 Blend_RstRstFunction& Func,
+                                                 Handle(BRepBlend_Line)& Lin,
+                                                 const Handle(Adaptor3d_HSurface)& S1,
+                                                 const Handle(Adaptor3d_HSurface)& S2,
+                                                 const TopAbs_Orientation Or);
+  
+  Standard_EXPORT Standard_Boolean StoreData (Handle(ChFiDS_SurfData)& Data,
+                                              const AppBlend_Approx& Approx,
+                                              const Handle(BRepBlend_Line)& Lin,
+                                              const Handle(Adaptor3d_HSurface)& S1,
+                                              const Handle(Adaptor3d_HSurface)& S2,
+                                              const TopAbs_Orientation Or1,
+                                              const Standard_Boolean Gd1,
+                                              const Standard_Boolean Gd2,
+                                              const Standard_Boolean Gf1,
+                                              const Standard_Boolean Gf2,
+                                              const Standard_Boolean Reversed = Standard_False);
+  
+  Standard_EXPORT Standard_Boolean CompleteData (Handle(ChFiDS_SurfData)& Data,
+                                                 const Handle(Geom_Surface)& Surfcoin,
+                                                 const Handle(Adaptor3d_HSurface)& S1,
+                                                 const Handle(Geom2d_Curve)& PC1,
+                                                 const Handle(Adaptor3d_HSurface)& S2,
+                                                 const Handle(Geom2d_Curve)& PC2,
+                                                 const TopAbs_Orientation Or,
+                                                 const Standard_Boolean On1,
+                                                 const Standard_Boolean Gd1,
+                                                 const Standard_Boolean Gd2,
+                                                 const Standard_Boolean Gf1,
+                                                 const Standard_Boolean Gf2);
 
 
   Standard_Real tolappangle;
@@ -311,6 +786,7 @@ protected:
   ChFiDS_ListOfStripe badstripes;
   TopTools_ListOfShape badvertices;
   TopTools_DataMapOfShapeListOfInteger myEVIMap;
+  TopTools_DataMapOfShapeShape myEdgeFirstFace;
   Standard_Boolean done;
   Standard_Boolean hasresult;
 
@@ -318,15 +794,22 @@ protected:
 private:
 
   
-  Standard_EXPORT Standard_Boolean FaceTangency (const TopoDS_Edge& E0, const TopoDS_Edge& E1, const TopoDS_Vertex& V) const;
+  Standard_EXPORT Standard_Boolean FaceTangency (const TopoDS_Edge& E0,
+                                                 const TopoDS_Edge& E1,
+                                                 const TopoDS_Vertex& V) const;
   
-  Standard_EXPORT void PerformSetOfSurfOnElSpine (const Handle(ChFiDS_HElSpine)& ES, Handle(ChFiDS_Stripe)& St, Handle(BRepTopAdaptor_TopolTool)& It1, Handle(BRepTopAdaptor_TopolTool)& It2, const Standard_Boolean Simul = Standard_False);
+  Standard_EXPORT void PerformSetOfSurfOnElSpine (const Handle(ChFiDS_HElSpine)& ES,
+                                                  Handle(ChFiDS_Stripe)& St,
+                                                  Handle(BRepTopAdaptor_TopolTool)& It1,
+                                                  Handle(BRepTopAdaptor_TopolTool)& It2,
+                                                  const Standard_Boolean Simul = Standard_False);
   
   Standard_EXPORT void PerformFilletOnVertex (const Standard_Integer Index);
   
   Standard_EXPORT void PerformSingularCorner (const Standard_Integer Index);
   
-  Standard_EXPORT void PerformOneCorner (const Standard_Integer Index, const Standard_Boolean PrepareOnSame = Standard_False);
+  Standard_EXPORT void PerformOneCorner (const Standard_Integer Index,
+                                         const Standard_Boolean PrepareOnSame = Standard_False);
   
   Standard_EXPORT void IntersectMoreCorner (const Standard_Integer Index);
   
@@ -336,17 +819,52 @@ private:
   
   Standard_EXPORT void ExtentAnalyse();
   
-  Standard_EXPORT Standard_Boolean FindFace (const TopoDS_Vertex& V, const ChFiDS_CommonPoint& P1, const ChFiDS_CommonPoint& P2, TopoDS_Face& Fv) const;
+  Standard_EXPORT Standard_Boolean FindFace (const TopoDS_Vertex& V,
+                                             const ChFiDS_CommonPoint& P1,
+                                             const ChFiDS_CommonPoint& P2,
+                                             TopoDS_Face& Fv) const;
   
-  Standard_EXPORT Standard_Boolean FindFace (const TopoDS_Vertex& V, const ChFiDS_CommonPoint& P1, const ChFiDS_CommonPoint& P2, TopoDS_Face& Fv, const TopoDS_Face& Favoid) const;
+  Standard_EXPORT Standard_Boolean FindFace (const TopoDS_Vertex& V,
+                                             const ChFiDS_CommonPoint& P1,
+                                             const ChFiDS_CommonPoint& P2,
+                                             TopoDS_Face& Fv,
+                                             const TopoDS_Face& Favoid) const;
   
   Standard_EXPORT Standard_Boolean MoreSurfdata (const Standard_Integer Index) const;
   
-  Standard_EXPORT Standard_Boolean StartSol (const Handle(ChFiDS_Spine)& Spine, Handle(BRepAdaptor_HSurface)& HS, gp_Pnt2d& P, Handle(BRepAdaptor_HCurve2d)& HC, Standard_Real& W, const Handle(ChFiDS_SurfData)& SD, const Standard_Boolean isFirst, const Standard_Integer OnS, Handle(BRepAdaptor_HSurface)& HSref, Handle(BRepAdaptor_HCurve2d)& HCref, Standard_Boolean& RecP, Standard_Boolean& RecS, Standard_Boolean& RecRst, Standard_Boolean& C1Obst, Handle(BRepAdaptor_HSurface)& HSbis, gp_Pnt2d& Pbis, const Standard_Boolean Decroch, const TopoDS_Vertex& Vref) const;
-  
-  Standard_EXPORT void StartSol (const Handle(ChFiDS_Stripe)& S, const Handle(ChFiDS_HElSpine)& HGuide, Handle(BRepAdaptor_HSurface)& HS1, Handle(BRepAdaptor_HSurface)& HS2, Handle(BRepTopAdaptor_TopolTool)& I1, Handle(BRepTopAdaptor_TopolTool)& I2, gp_Pnt2d& P1, gp_Pnt2d& P2, Standard_Real& First) const;
-  
-  Standard_EXPORT void ConexFaces (const Handle(ChFiDS_Spine)& Sp, const Standard_Integer IEdge, const Standard_Integer RefChoix, Handle(BRepAdaptor_HSurface)& HS1, Handle(BRepAdaptor_HSurface)& HS2) const;
+  Standard_EXPORT Standard_Boolean StartSol (const Handle(ChFiDS_Spine)& Spine,
+                                             Handle(BRepAdaptor_HSurface)& HS,
+                                             gp_Pnt2d& P,
+                                             Handle(BRepAdaptor_HCurve2d)& HC,
+                                             Standard_Real& W,
+                                             const Handle(ChFiDS_SurfData)& SD,
+                                             const Standard_Boolean isFirst,
+                                             const Standard_Integer OnS,
+                                             Handle(BRepAdaptor_HSurface)& HSref,
+                                             Handle(BRepAdaptor_HCurve2d)& HCref,
+                                             Standard_Boolean& RecP,
+                                             Standard_Boolean& RecS,
+                                             Standard_Boolean& RecRst,
+                                             Standard_Boolean& C1Obst,
+                                             Handle(BRepAdaptor_HSurface)& HSbis,
+                                             gp_Pnt2d& Pbis,
+                                             const Standard_Boolean Decroch,
+                                             const TopoDS_Vertex& Vref) const;
+  
+  Standard_EXPORT void StartSol (const Handle(ChFiDS_Stripe)& S,
+                                 const Handle(ChFiDS_HElSpine)& HGuide,
+                                 Handle(BRepAdaptor_HSurface)& HS1,
+                                 Handle(BRepAdaptor_HSurface)& HS2,
+                                 Handle(BRepTopAdaptor_TopolTool)& I1,
+                                 Handle(BRepTopAdaptor_TopolTool)& I2,
+                                 gp_Pnt2d& P1,
+                                 gp_Pnt2d& P2,
+                                 Standard_Real& First) const;
+  
+  Standard_EXPORT void ConexFaces (const Handle(ChFiDS_Spine)& Sp,
+                                   const Standard_Integer IEdge,
+                                   Handle(BRepAdaptor_HSurface)& HS1,
+                                   Handle(BRepAdaptor_HSurface)& HS2) const;
 
 
   TopoDS_Shape myShape;
index 8023ba6e55cbc76d41a7a2df5650d9343ed91e7a..1d92766f8e50922cc4251483216224976a5e0beb 100644 (file)
@@ -1713,6 +1713,7 @@ void  ChFi3d_ComputeArete(const ChFiDS_CommonPoint&   P1,
       Standard_Real umin,umax,vmin,vmax;
       Surf->Bounds(umin,umax,vmin,vmax);
       bs.Update(umin,vmin,umax,vmax);
+      bs.SetGap(Precision::PConfusion());
       Standard_Boolean aIN = Standard_True;
       for(Standard_Integer ii = 1; ii <= 4 && aIN; ii++) {
        if(bs.IsOut(Handle(Geom2d_BezierCurve)::DownCast (Pcurv)->Pole(ii))) {
@@ -3282,18 +3283,24 @@ Standard_Boolean ChFi3d_ComputeCurves(const Handle(Adaptor3d_HSurface)&   S1,
             Pc1 = new Geom2d_TrimmedCurve(Pc1,Uf,Ul);
             Pc2 = new Geom2d_TrimmedCurve(Pc2,Uf,Ul);
             //is it necesary to invert ?
-            Standard_Real distdeb = ptestdeb.Distance(pdeb);
-            Standard_Real distfin = ptestfin.Distance(pfin);
-            if(distdeb > distref || distfin > distref) {
+            Standard_Real DistDebToDeb = ptestdeb.Distance(pdeb);
+            Standard_Real DistDebToFin = ptestdeb.Distance(pfin);
+            Standard_Real DistFinToFin = ptestfin.Distance(pfin);
+            Standard_Real DistFinToDeb = ptestfin.Distance(pdeb);
+            
+            if (DistDebToDeb > DistDebToFin &&
+                DistFinToFin > DistFinToDeb)
+            {
               C3d->Reverse();
               Pc1->Reverse();
               Pc2->Reverse();
               ptestdeb = C3d->Value(C3d->FirstParameter());
               ptestfin = C3d->Value(C3d->LastParameter());
-              distdeb = ptestdeb.Distance(pdeb);
-              distfin = ptestfin.Distance(pfin);
+              DistDebToDeb = ptestdeb.Distance(pdeb);
+              DistFinToFin = ptestfin.Distance(pfin);
             }
-            if(distdeb < distref && distfin < distref) {
+            if(DistDebToDeb < distref && DistFinToFin < distref)
+            {
               Uf = C3d->FirstParameter();
               Ul = C3d->LastParameter();
               ChFi3d_ReparamPcurv(Uf,Ul,Pc1);
@@ -3910,10 +3917,11 @@ static Standard_Boolean GoodExt(const Handle(Geom_Curve)& C,
 //purpose  : 
 //=======================================================================
 Standard_EXPORT 
-  void ChFi3d_PerformElSpine(Handle(ChFiDS_HElSpine)& HES,
-  Handle(ChFiDS_Spine)&    Spine,
-  const GeomAbs_Shape      continuity,
-  const Standard_Real      tol) 
+void ChFi3d_PerformElSpine(Handle(ChFiDS_HElSpine)& HES,
+                           Handle(ChFiDS_Spine)&    Spine,
+                           const GeomAbs_Shape      continuity,
+                           const Standard_Real      tol,
+                           const Standard_Boolean   IsOffset)
 {
 
   Standard_Boolean periodic, Bof, checkdeb, cepadur,bIsSmooth;
@@ -3965,8 +3973,8 @@ Standard_EXPORT
   // derniere arete.
   // Traitment de la premiere arete
   cepadur = 0;
-  E=Spine->Edges(IF);
-  Bof=BRepLib::BuildCurve3d(E);
+  E = (IsOffset)? Spine->OffsetEdges(IF) : Spine->Edges(IF);
+  Bof = BRepLib::BuildCurve3d(E);
   const BRepAdaptor_Curve& edc = Spine->CurrentElementarySpine(IF);
   tolpared = edc.Resolution(tol);
   Cv = BRep_Tool::Curve(E, First, Last);
@@ -4089,7 +4097,7 @@ Standard_EXPORT
       iloc = (IEdge - 1)%nbed + 1;
     }
     //
-    E = Spine->Edges(iloc);
+    E = (IsOffset)? Spine->OffsetEdges(iloc) : Spine->Edges(iloc);
     if (BRep_Tool::Degenerated(E)) {
       continue;
     }
@@ -4362,6 +4370,11 @@ Standard_EXPORT
 
   // Le Resultat       
   ES.SetCurve(BSpline);
+
+  //Temporary
+  //gp_Pnt ptgui;
+  //gp_Vec d1gui;
+  //( HES->Curve() ).D1(HES->FirstParameter(),ptgui,d1gui);
 }
 
 //=======================================================================
index f6c6af404691ed0905a5da37f69283089eafab2f..315b4ade36e7fdff134cd37d85f36024dc6881a6 100644 (file)
@@ -505,7 +505,8 @@ void ChFi3d_TrimCurve(const Handle(Geom_Curve)& gc,
 Standard_EXPORT void ChFi3d_PerformElSpine(Handle(ChFiDS_HElSpine)& HES,
                                           Handle(ChFiDS_Spine)&    Spine,
                                           const GeomAbs_Shape      continuity,
-                                          const Standard_Real      tol);
+                                          const Standard_Real      tol,
+                                           const Standard_Boolean   IsOffset = Standard_False);
 
 TopoDS_Face ChFi3d_EnlargeFace(const Handle(ChFiDS_Spine)& Spine,
                               const Handle(BRepAdaptor_HSurface)&  HS,
index 37f4d2d642981b2b150f0c0a396bccb4e15dfec1..7bbbb6bafecb0b1dbe294f2820dadb634130b18d 100644 (file)
 #include <ChFiDS_SurfData.hxx>
 #include <Geom2d_Curve.hxx>
 #include <Geom_Surface.hxx>
+#include <Geom_OffsetSurface.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <GeomInt_IntSS.hxx>
+#include <Extrema_ExtPC.hxx>
+#include <GeomConvert_CompCurveToBSplineCurve.hxx>
+#include <Geom_BSplineCurve.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Pnt2d.hxx>
 #include <gp_Vec.hxx>
 #include <TopOpeBRepDS_Surface.hxx>
 #include <TopOpeBRepTool_TOOL.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <BRepLib_MakeEdge.hxx>
 
 #ifdef OCCT_DEBUG
 extern Standard_Boolean ChFi3d_GetcontextFORCEBLEND(); 
 #endif
 
+static void ReorderFaces(TopoDS_Face&         theF1,
+                         TopoDS_Face&         theF2,
+                         const TopoDS_Face&   theFirstFace,
+                         const TopoDS_Edge&   thePrevEdge,
+                         const TopoDS_Vertex& theCommonVertex)
+{
+  if (theF1.IsSame(theFirstFace))
+    return;
+  else if (theF2.IsSame(theFirstFace))
+  {
+    TopoDS_Face TmpFace = theF1; theF1 = theF2; theF2 = TmpFace;
+    return;
+  }
+
+  TopTools_IndexedDataMapOfShapeListOfShape VEmapFirst, VEmap;
+  TopExp::MapShapesAndAncestors(theFirstFace, TopAbs_VERTEX, TopAbs_EDGE, VEmapFirst);
+  TopExp::MapShapesAndAncestors(theF1, TopAbs_VERTEX, TopAbs_EDGE, VEmap);
+
+  const TopTools_ListOfShape& ElistFirst = VEmapFirst.FindFromKey(theCommonVertex);
+  const TopTools_ListOfShape& Elist      = VEmap.FindFromKey(theCommonVertex);
+  TopTools_ListIteratorOfListOfShape itlfirst(ElistFirst);
+  for (; itlfirst.More(); itlfirst.Next())
+  {
+    const TopoDS_Shape& anEdge = itlfirst.Value();
+    if (anEdge.IsSame(thePrevEdge))
+      continue;
+    TopTools_ListIteratorOfListOfShape itl(Elist);
+    for(; itl.More(); itl.Next())
+      if (anEdge.IsSame(itl.Value()))
+        return;
+  }
+
+  TopoDS_Face TmpFace = theF1; theF1 = theF2; theF2 = TmpFace;
+}
+
+static void ConcatCurves(TColGeom_SequenceOfCurve& theCurves,
+                         TColGeom_SequenceOfCurve& theNewCurves)
+{
+  while (!theCurves.IsEmpty())
+  {
+    GeomConvert_CompCurveToBSplineCurve Concat;
+    Standard_Boolean Success = Standard_False;
+    for (Standard_Integer i = 1; i <= theCurves.Length(); i++)
+    {
+      const Handle(Geom_Curve)& aCurve = theCurves(i);
+      Handle(Geom_BoundedCurve) aBoundedCurve = Handle(Geom_BoundedCurve)::DownCast(aCurve);
+      Success = Concat.Add(aBoundedCurve, 1.e-5, Standard_True);
+      if (!Success)
+        Success = Concat.Add(aBoundedCurve, 1.e-5, Standard_False);
+      if (Success)
+      {
+        theCurves.Remove(i);
+        i--;
+      }
+    }
+    Handle(Geom_Curve) aNewCurve = Concat.BSplineCurve();
+    theNewCurves.Append(aNewCurve);
+  }
+}
+
+static TopoDS_Edge MakeOffsetEdge(const TopoDS_Edge&         theEdge,
+                                  const Standard_Real        Distance,
+                                  const BRepAdaptor_Surface& S1,
+                                  const BRepAdaptor_Surface& S2)
+{
+  TopoDS_Edge OffsetEdge;
+  
+  TopoDS_Face F1 = S1.Face();
+  TopoDS_Face F2 = S2.Face();
+  Handle(Geom_Surface) GS1 = BRep_Tool::Surface(F1);
+  Handle(Geom_Surface) TrGS1 =
+    new Geom_RectangularTrimmedSurface(GS1,
+                                       S1.FirstUParameter(), S1.LastUParameter(),
+                                       S1.FirstVParameter(), S1.LastVParameter());
+  Standard_Real Offset = -Distance;
+  if (F1.Orientation() == TopAbs_REVERSED)
+    Offset = Distance;
+  Handle(Geom_OffsetSurface) MakeOffsetSurf = new Geom_OffsetSurface(TrGS1, Offset);
+  Handle(Geom_Surface) OffsetTrGS1 = MakeOffsetSurf->Surface();
+  if (OffsetTrGS1.IsNull())
+    OffsetTrGS1 = MakeOffsetSurf;
+  Handle(Geom_Surface) GS2 = BRep_Tool::Surface(F2);
+  Handle(Geom_Surface) TrGS2 =
+    new Geom_RectangularTrimmedSurface(GS2,
+                                       S2.FirstUParameter(), S2.LastUParameter(),
+                                       S2.FirstVParameter(), S2.LastVParameter());
+  GeomInt_IntSS Intersector(OffsetTrGS1, TrGS2, Precision::Confusion());
+  if (!Intersector.IsDone() || Intersector.NbLines() == 0)
+  {
+    return OffsetEdge;
+  }
+
+  Handle(Geom_Curve) IntCurve = Intersector.Line(1);
+  gp_Pnt Ends [2];
+  BRepAdaptor_Curve aBAcurve(theEdge);
+  Ends[0] = aBAcurve.Value(aBAcurve.FirstParameter());
+  Ends[1] = aBAcurve.Value(aBAcurve.LastParameter());
+
+  if (Intersector.NbLines() > 1)
+  {
+    TColGeom_SequenceOfCurve Curves, NewCurves;
+    for (Standard_Integer i = 1; i <= Intersector.NbLines(); i++)
+      Curves.Append(Intersector.Line(i));
+
+    ConcatCurves(Curves, NewCurves);
+
+    Standard_Real MinDist = RealLast();
+    Standard_Integer imin = 1;
+    for (Standard_Integer i = 1; i <= NewCurves.Length(); i++)
+    {
+      GeomAdaptor_Curve GAcurve(NewCurves(i));
+      Extrema_ExtPC Projector(Ends[0], GAcurve);
+      if (!Projector.IsDone() || Projector.NbExt() == 0)
+        continue;
+      for (Standard_Integer iext = 1; iext <= Projector.NbExt(); iext++)
+      {
+        Standard_Real aDist = Projector.SquareDistance(iext);
+        if (aDist < MinDist)
+        {
+          MinDist = aDist;
+          imin = i;
+        }
+      }
+    }
+    IntCurve = NewCurves(imin);
+  }
+  if (IntCurve.IsNull())
+  {
+    return OffsetEdge;
+  }
+  //Projection of extremities onto <IntCurve>
+  GeomAdaptor_Curve GAcurve(IntCurve);
+  Standard_Real Params [2];
+  for (Standard_Integer ind_end = 0; ind_end < 2; ind_end++)
+  {
+    if (ind_end == 1 && aBAcurve.IsClosed()/*HGuide->IsPeriodic()*//*HGuide->IsClosed()*/)
+      break;
+    Extrema_ExtPC Projector(Ends[ind_end], GAcurve);
+    Standard_Real param[4], dist[4];
+    gp_Pnt Pnt[4];
+    param[1] = GAcurve.FirstParameter();
+    param[2] = GAcurve.LastParameter();
+    Projector.TrimmedSquareDistances(dist[1], dist[2], Pnt[1], Pnt[2]);
+    dist[3] = RealLast();
+    if (Projector.IsDone() && Projector.NbExt() > 0)
+    {
+      Standard_Integer imin = 1;
+      for (Standard_Integer i = 2; i <= Projector.NbExt(); i++)
+        if (Projector.SquareDistance(i) < Projector.SquareDistance(imin))
+          imin = i;
+      param[3] = Projector.Point(imin).Parameter();
+      dist[3]  = Projector.SquareDistance(imin);
+      Pnt[3]   = Projector.Point(imin).Value();
+    }
+
+    Standard_Integer imin = 1;
+    for (Standard_Integer i = 2; i <= 3; i++)
+      if (dist[i] < dist[imin])
+        imin = i;
+    
+    Params[ind_end] = param[imin]; //Projector.Point(imin).Parameter();
+  }
+  if (aBAcurve.IsClosed()/*HGuide->IsPeriodic()*//*HGuide->IsClosed()*/)
+    Params[1] = GAcurve.LastParameter(); //temporary
+  if (Params[0] > Params[1])
+  {
+    Standard_Boolean IsClosed = Standard_False;
+    gp_Pnt fpnt = IntCurve->Value(IntCurve->FirstParameter());
+    gp_Pnt lpnt = IntCurve->Value(IntCurve->LastParameter());
+    if (fpnt.SquareDistance(lpnt) <= Precision::SquareConfusion())
+      IsClosed = Standard_True;
+    if (IsClosed)
+      Params[1] = IntCurve->LastParameter();
+    else
+    {
+      Standard_Real NewFirstPar = IntCurve->ReversedParameter(Params[0]);
+      Standard_Real NewLastPar  = IntCurve->ReversedParameter(Params[1]);
+      IntCurve->Reverse();
+      Params[0] = NewFirstPar;
+      Params[1] = NewLastPar;
+    }
+  }
+  if (aBAcurve.IsClosed()/*HGuide->IsPeriodic()*//*HGuide->IsClosed()*/) //check the direction of closed curve
+  {
+    gp_Pnt aPnt, anOffsetPnt;
+    gp_Vec Tangent, OffsetTangent;
+    aBAcurve.D1(aBAcurve.FirstParameter(), aPnt, Tangent);
+    IntCurve->D1(Params[0], anOffsetPnt, OffsetTangent);
+    if (Tangent*OffsetTangent < 0)
+      IntCurve->Reverse();
+  }
+
+  /*
+  Standard_Real ParTol = 1.e-5;
+  Standard_Real FirstDiff = aBAcurve.FirstParameter() - Params[0];
+  Standard_Real LastDiff  = aBAcurve.LastParameter()  - Params[1];
+  if (Abs(FirstDiff) > ParTol ||
+      Abs(LastDiff)  > ParTol)
+  {
+    Handle(Geom_BSplineCurve) BsplCurve = Handle(Geom_BSplineCurve)::DownCast(IntCurve);
+    TColStd_Array1OfReal aKnots(1, BsplCurve->NbKnots());
+    BsplCurve->Knots(aKnots);
+    BSplCLib::Reparametrize(aBAcurve.FirstParameter(), aBAcurve.LastParameter(), aKnots);
+    BsplCurve->SetKnots(aKnots);
+    if (aBAcurve.IsPeriodic() && !BsplCurve->IsPeriodic())
+      BsplCurve->SetPeriodic();
+    IntCurve = BsplCurve;
+  }
+  */
+  
+  OffsetEdge = BRepLib_MakeEdge(IntCurve, Params[0], Params[1]);
+  return OffsetEdge;
+}
+
 static TopOpeBRepDS_BuildTool mkbuildtool()
 {
   TopOpeBRepTool_GeomTool GT2(TopOpeBRepTool_BSPLINE1,
@@ -477,7 +698,7 @@ void ChFi3d_Builder::PerformExtremity (const Handle(ChFiDS_Spine)& Spine)
     }
     //Before all it is checked if the tangency is not dead.
     E[0] = Spine->Edges(iedge);
-    ConexFaces (Spine,iedge,0,hs1,hs2);
+    ConexFaces (Spine,iedge,hs1,hs2);
     if(TangentExtremity(V,E[0],hs1,hs2,angular)){
       Spine->SetTangencyExtremity(Standard_True, (ii == 1));
     }
@@ -576,7 +797,9 @@ void ChFi3d_Builder::PerformExtremity (const Handle(ChFiDS_Spine)& Spine)
 // the opposing faces were tangent.
 //=======================================================================
 
-Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spine) 
+Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spine,
+                                                const Standard_Real         Offset,
+                                                const TopoDS_Face&          theFirstFace)
 {
   Standard_Real ta = angular;
   TopTools_ListIteratorOfListOfShape It;
@@ -597,6 +820,23 @@ Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spin
 //if(BRep_Tool::Continuity(Ec,ff1,ff2) != GeomAbs_C0) return 0;
   if (ChFi3d_isTangentFaces(Ec,ff1,ff2)) return 0;
 //  Modified by Sergey KHROMOV - Fri Dec 21 17:46:24 2001 Begin
+
+  TopoDS_Face FirstFace = ff1;
+  if (!theFirstFace.IsNull() && ff2.IsSame(theFirstFace))
+  {
+    FirstFace = ff2;
+    ff2 = ff1; ff1 = FirstFace;
+  }
+  myEdgeFirstFace.Bind(Ec, FirstFace);
+  Standard_Boolean ToRestrict = (Offset > 0)? Standard_True : Standard_False;
+  BRepAdaptor_Surface Sb1(ff1, ToRestrict);
+  BRepAdaptor_Surface Sb2(ff2, ToRestrict);
+  if (Offset > 0)
+  {
+    TopoDS_Edge OffsetEdge = MakeOffsetEdge(Ec, Offset, Sb1, Sb2);
+    OffsetEdge.Orientation(Ec.Orientation());
+    Spine->SetOffsetEdges(OffsetEdge);
+  }
   
   BRepAdaptor_Curve CEc,CEv;
   TopAbs_Orientation curor = Ec.Orientation();
@@ -668,11 +908,26 @@ Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spin
          }
          if (OnAjoute) {
            Fini = Standard_False; // If this can be useful (Cf PRO14713)
+            TopoDS_Vertex CommonVertex;
+            TopExp::CommonVertex(Ec, Ev, CommonVertex);
+            TopoDS_Edge PrevEdge = Ec;
            Ec = Ev; 
 //         Ec = TopoDS::Edge(Ev); 
            Ec.Orientation(Or1);
            Wl = Wf; LVEc = LVEv; 
            Spine->SetEdges(Ec);
+            TopoDS_Face CurF1, CurF2;
+            ChFi3d_conexfaces(Ec,CurF1,CurF2,myEFMap);
+            ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex);
+            myEdgeFirstFace.Bind(Ec, CurF1);
+            if (Offset > 0)
+            {
+              BRepAdaptor_Surface CurSb1(CurF1), CurSb2(CurF2);
+              TopoDS_Edge anOffsetEdge = MakeOffsetEdge(Ec, Offset, CurSb1, CurSb2);
+              anOffsetEdge.Orientation(Or1);
+              Spine->SetOffsetEdges(anOffsetEdge);
+            }
+            FirstFace = CurF1;
            curor = Or1;
            if (VStart.IsSame(LVEv)) {
              if (FaceTangency(Ev,Spine->Edges(1),LVEv)) {
@@ -701,6 +956,7 @@ Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spin
     else {// Upstream progression
       Fini = Standard_False;
       Ec = Spine->Edges(1);
+      FirstFace = TopoDS::Face(myEdgeFirstFace(Ec));
       curor = Ec.Orientation();
       FVEc = VStart;
       while (!Fini) {
@@ -738,11 +994,26 @@ Standard_Boolean ChFi3d_Builder::PerformElement(const Handle(ChFiDS_Spine)& Spin
              OnAjoute=((!rev && av1v2 < ta) || (rev && (M_PI-av1v2) < ta));
            }
            if  (OnAjoute) {
+              TopoDS_Vertex CommonVertex;
+              TopExp::CommonVertex(Ec, Ev, CommonVertex);
+              TopoDS_Edge PrevEdge = Ec;
              Ec = Ev; 
 //           Ec = TopoDS::Edge(Ev); 
              Ec.Orientation(Or1);
              Wl = Wf; FVEc = FVEv; 
              Spine->PutInFirst(Ec);
+              TopoDS_Face CurF1, CurF2;
+              ChFi3d_conexfaces(Ec,CurF1,CurF2,myEFMap);
+              ReorderFaces(CurF1, CurF2, FirstFace, PrevEdge, CommonVertex);
+              myEdgeFirstFace.Bind(Ec, CurF1);
+              if (Offset > 0)
+              {
+                BRepAdaptor_Surface CurSb1(CurF1), CurSb2(CurF2);
+                TopoDS_Edge anOffsetEdge = MakeOffsetEdge(Ec, Offset, CurSb1, CurSb2);
+                anOffsetEdge.Orientation(Or1);
+                Spine->PutInFirstOffset(anOffsetEdge);
+              }
+              FirstFace = CurF1;
              curor = Or1;
              break;
            }
index c7d003f0c96e562625a5ce58d2fc2f3ef7213c7e..aac4206a57f4c41b30998bb3ea43af1e6501e971 100644 (file)
@@ -724,7 +724,11 @@ Standard_Boolean ChFi3d_Builder::StripeOrientations
   BRepAdaptor_Surface Sb1,Sb2;
   TopAbs_Orientation Of1,Of2;
   TopoDS_Face ff1,ff2;
-  ChFi3d_conexfaces(Spine->Edges(1),ff1,ff2,myEFMap);
+  TopoDS_Edge anEdge = Spine->Edges(1);
+  TopoDS_Face FirstFace = TopoDS::Face(myEdgeFirstFace(anEdge));
+  ChFi3d_conexfaces(anEdge,ff1,ff2,myEFMap);
+  if (ff2.IsSame(FirstFace))
+  { TopoDS_Face TmpFace = ff1; ff1 = ff2; ff2 = TmpFace; }
   Of1 = ff1.Orientation();
   ff1.Orientation(TopAbs_FORWARD);
   Sb1.Initialize(ff1);
@@ -747,7 +751,6 @@ Standard_Boolean ChFi3d_Builder::StripeOrientations
 
 void ChFi3d_Builder::ConexFaces (const Handle(ChFiDS_Spine)&   Spine,
                                 const Standard_Integer        IEdge,
-                                const Standard_Integer        RC,      
                                 Handle(BRepAdaptor_HSurface)& HS1,
                                 Handle(BRepAdaptor_HSurface)& HS2) const
 {
@@ -756,19 +759,16 @@ void ChFi3d_Builder::ConexFaces (const Handle(ChFiDS_Spine)&   Spine,
   BRepAdaptor_Surface& Sb1 = HS1->ChangeSurface();
   BRepAdaptor_Surface& Sb2 = HS2->ChangeSurface();
 
-  TopoDS_Face ff1,ff2;  
+  TopoDS_Face ff1,ff2;
+  TopoDS_Edge anEdge = Spine->Edges(IEdge);
   ChFi3d_conexfaces(Spine->Edges(IEdge),ff1,ff2,myEFMap);
 
+  TopoDS_Face FirstFace = TopoDS::Face(myEdgeFirstFace(anEdge));
+  if (ff2.IsSame(FirstFace))
+  { TopoDS_Face TmpFace = ff1; ff1 = ff2; ff2 = TmpFace; }
+
   Sb1.Initialize(ff1);
   Sb2.Initialize(ff2);
-  
-  TopAbs_Orientation Or1,Or2;
-  Standard_Integer Choix = ChFi3d::ConcaveSide(Sb1,Sb2,Spine->Edges(IEdge),
-                                              Or1,Or2);  
-  if (RC%2 != Choix%2) {
-    Sb1.Initialize(ff2);
-    Sb2.Initialize(ff1);
-  }
 }
 
 //=======================================================================
@@ -829,7 +829,7 @@ void ChFi3d_Builder::StartSol(const Handle(ChFiDS_Stripe)&      Stripe,
       iedge = ie;
       cured = Spine->Edges(iedge);
       TolE = BRep_Tool::Tolerance(cured);
-      ConexFaces(Spine,iedge,RC,HS1,HS2);
+      ConexFaces(Spine,iedge,HS1,HS2);
       f1 = HS1->ChangeSurface().Face();
       f2 = HS2->ChangeSurface().Face();
       Or1 = f1.Orientation();
@@ -896,7 +896,7 @@ void ChFi3d_Builder::StartSol(const Handle(ChFiDS_Stripe)&      Stripe,
     Standard_Real w = wf * (1. -t) + wl * t;
     iedge = Spine->Index(w);
     cured = Spine->Edges(iedge);
-    ConexFaces(Spine,iedge,RC,HS1,HS2);
+    ConexFaces(Spine,iedge,HS1,HS2);
     f1 = HS1->ChangeSurface().Face();
     f2 = HS2->ChangeSurface().Face();
     Or1 = f1.Orientation();
@@ -1864,8 +1864,29 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
 #ifdef OCCT_DEBUG
   OSD_Chronometer ch1;
 #endif 
+
+  //Temporary
+  //gp_Pnt ptgui;
+  //gp_Vec d1gui;
+  //( HGuide->Curve() ).D1(HGuide->FirstParameter(),ptgui,d1gui);
   
   ChFiDS_ElSpine& Guide = HGuide->ChangeCurve();
+
+  Handle(ChFiDS_HElSpine) OffsetHGuide;
+  Handle(ChFiDS_Spine)& Spine = Stripe->ChangeSpine();
+  if (Spine->Mode() == ChFiDS_ConstThroatWithPenetrationChamfer)
+  {
+    ChFiDS_ListOfHElSpine& ll = Spine->ChangeElSpines();
+    ChFiDS_ListOfHElSpine& ll_offset = Spine->ChangeOffsetElSpines();
+    ChFiDS_ListIteratorOfListOfHElSpine ILES(ll), ILES_offset(ll_offset);
+    for ( ; ILES.More(); ILES.Next(),ILES_offset.Next())
+    {
+      const Handle(ChFiDS_HElSpine)& aHElSpine = ILES.Value();
+      if (aHElSpine == HGuide)
+        OffsetHGuide = ILES_offset.Value();
+    }
+  }
+  
   Standard_Real wf = Guide.FirstParameter();
   Standard_Real wl = Guide.LastParameter();
   Standard_Real locfleche = (wl - wf) * fleche;
@@ -1876,8 +1897,13 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
     Standard_Real prab = 0.01;
     Guide.FirstParameter(wf-prab*(wl-wf));
     Guide.LastParameter (wl+prab*(wl-wf));
+    if (!OffsetHGuide.IsNull())
+    {
+      OffsetHGuide->ChangeCurve().FirstParameter(wf-prab*(wl-wf));
+      OffsetHGuide->ChangeCurve().LastParameter (wl+prab*(wl-wf));
+    }
   }
-  Handle(ChFiDS_Spine)&  Spine = Stripe->ChangeSpine();
+  //Handle(ChFiDS_Spine)&  Spine = Stripe->ChangeSpine();
   Standard_Integer ii, nbed = Spine->NbEdges();
   Standard_Real lastedlastp = Spine->LastParameter(nbed);
   
@@ -1935,6 +1961,13 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
       Guide.FirstParameter(Last);
       Guide.SaveLastParameter();
       Guide.LastParameter (First * 1.1);//Extension to help rsnld.
+      if (!OffsetHGuide.IsNull())
+      {
+        OffsetHGuide->ChangeCurve().SaveFirstParameter();
+        OffsetHGuide->ChangeCurve().FirstParameter(Last);
+        OffsetHGuide->ChangeCurve().SaveLastParameter();
+        OffsetHGuide->ChangeCurve().LastParameter (First * 1.1);//Extension to help rsnld.
+      }
     }
   }
   else{
@@ -1970,8 +2003,18 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
     
     
     if(Ok1 == 1 && Ok2 == 1) {
-      if(forward) Guide.FirstParameter(wf);
-      else Guide.LastParameter(wl);
+      if(forward)
+      {
+        Guide.FirstParameter(wf);
+        if (!OffsetHGuide.IsNull())
+          OffsetHGuide->ChangeCurve().FirstParameter(wf);
+      }
+      else
+      {
+        Guide.LastParameter(wl);
+        if (!OffsetHGuide.IsNull())
+          OffsetHGuide->ChangeCurve().LastParameter(wl);
+      }
     }
   }
   Standard_Boolean      fini     = Standard_False;
@@ -2009,6 +2052,8 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
       if(Spine->IsTangencyExtremity(Standard_True)){
        intf = 4;
        Guide.FirstParameter(wfsav);
+        if (!OffsetHGuide.IsNull())
+          OffsetHGuide->ChangeCurve().FirstParameter(wfsav);
       }
       if(wl - lastedlastp > -tolesp){
        if(Spine->LastStatus() == ChFiDS_OnSame) intl = 2;
@@ -2017,6 +2062,8 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
       if(Spine->IsTangencyExtremity(Standard_False)){
        intl = 4;
        Guide.LastParameter(wlsav);
+        if (!OffsetHGuide.IsNull())
+          OffsetHGuide->ChangeCurve().LastParameter(wlsav);
       }
     }
     if(intf && !forward) Vref = Spine->FirstVertex();
@@ -2048,8 +2095,18 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
        if (!Ok2) ChFi3d_BuildPlane (DStr,HS2,pp2,ref,!forward,2);      
        if(intf) intf = 5;
        else if(intl) intl = 5;
-       if(forward) Guide.FirstParameter(wf);
-       else Guide.LastParameter(wl);
+       if(forward)
+        {
+          Guide.FirstParameter(wf);
+          if (!OffsetHGuide.IsNull())
+            OffsetHGuide->ChangeCurve().FirstParameter(wf);
+        }
+       else
+        {
+          Guide.LastParameter(wl);
+          if (!OffsetHGuide.IsNull())
+            OffsetHGuide->ChangeCurve().LastParameter(wl);
+        }
       }
       else throw Standard_Failure("PerformSetOfSurfOnElSpine : Chaining is impossible.");
     }
@@ -2284,6 +2341,11 @@ void ChFi3d_Builder::PerformSetOfSurfOnElSpine
   if(!Guide.IsPeriodic()){
     Guide.FirstParameter(wfsav);
     Guide.LastParameter (wlsav);
+    if (!OffsetHGuide.IsNull())
+    {
+      OffsetHGuide->ChangeCurve().FirstParameter(wfsav);
+      OffsetHGuide->ChangeCurve().LastParameter (wlsav);
+    }
   }
 
 }
@@ -2321,10 +2383,14 @@ void ChFi3d_Builder::PerformSetOfKPart(Handle(ChFiDS_Stripe)& Stripe,
   gp_Pnt PFirst,PLast,PEndPeriodic;
   Standard_Boolean intf = Standard_False, intl = Standard_False;
   
-  Handle(ChFiDS_HElSpine) CurrentHE = new ChFiDS_HElSpine();
+  ChFiDS_ElSpine anElSpine, anOffsetElSpine;
+  Handle(ChFiDS_HElSpine) CurrentHE = new ChFiDS_HElSpine(anElSpine);
+  Handle(ChFiDS_HElSpine) CurrentOffsetHE = new ChFiDS_HElSpine(anOffsetElSpine);
   Spine->D1(Spine->FirstParameter(),PFirst,TFirst);
   CurrentHE->ChangeCurve().FirstParameter(Spine->FirstParameter());
   CurrentHE->ChangeCurve().SetFirstPointAndTgt(PFirst,TFirst);
+  CurrentOffsetHE->ChangeCurve().FirstParameter(Spine->FirstParameter());
+  CurrentOffsetHE->ChangeCurve().SetFirstPointAndTgt(PFirst,TFirst);
   
   Standard_Boolean YaKPart = Standard_False;
   Standard_Integer iedgelastkpart = 0;
@@ -2337,7 +2403,7 @@ void ChFi3d_Builder::PerformSetOfKPart(Handle(ChFiDS_Stripe)& Stripe,
   
   for (Standard_Integer iedge = 1; iedge <= Spine->NbEdges(); iedge++){
     
-    ConexFaces(Spine,iedge,RefChoix,HS1,HS2);
+    ConexFaces(Spine,iedge,HS1,HS2);
     
     if (ChFi3d_KParticular(Spine,iedge,HS1->ChangeSurface(),HS2->ChangeSurface())) {
       intf = ((iedge == 1) && !Spine->IsPeriodic());
@@ -2434,10 +2500,19 @@ void ChFi3d_Builder::PerformSetOfKPart(Handle(ChFiDS_Stripe)& Stripe,
            Spine->AppendElSpine(CurrentHE);
            CurrentHE->ChangeCurve().ChangeNext() = LSD.Value(j);
            CurrentHE =  new ChFiDS_HElSpine();
+
+            CurrentOffsetHE->ChangeCurve().LastParameter (WFirst);
+           CurrentOffsetHE->ChangeCurve().SetLastPointAndTgt(PFirst,TFirst);
+           Spine->AppendOffsetElSpine(CurrentOffsetHE);
+           CurrentOffsetHE->ChangeCurve().ChangeNext() = LSD.Value(j);
+           CurrentOffsetHE =  new ChFiDS_HElSpine();
          }
          CurrentHE->ChangeCurve().FirstParameter(WLast);
          CurrentHE->ChangeCurve().SetFirstPointAndTgt(PLast,TLast);
          CurrentHE->ChangeCurve().ChangePrevious() = LSD.Value(j);
+         CurrentOffsetHE->ChangeCurve().FirstParameter(WLast);
+         CurrentOffsetHE->ChangeCurve().SetFirstPointAndTgt(PLast,TLast);
+         CurrentOffsetHE->ChangeCurve().ChangePrevious() = LSD.Value(j);
          YaKPart = Standard_True;
        }
        else {
@@ -2448,10 +2523,19 @@ void ChFi3d_Builder::PerformSetOfKPart(Handle(ChFiDS_Stripe)& Stripe,
            Spine->AppendElSpine(CurrentHE);
            CurrentHE->ChangeCurve().ChangeNext() = LSD.Value(j);
            CurrentHE = new ChFiDS_HElSpine();
+            
+           CurrentOffsetHE->ChangeCurve().LastParameter(WFirst);
+           CurrentOffsetHE->ChangeCurve().SetLastPointAndTgt(PFirst,TFirst);
+           Spine->AppendOffsetElSpine(CurrentOffsetHE);
+           CurrentOffsetHE->ChangeCurve().ChangeNext() = LSD.Value(j);
+           CurrentOffsetHE = new ChFiDS_HElSpine();
          }
          CurrentHE->ChangeCurve().FirstParameter(WLast);
          CurrentHE->ChangeCurve().SetFirstPointAndTgt(PLast,TLast);
          CurrentHE->ChangeCurve().ChangePrevious() = LSD.Value(j);
+         CurrentOffsetHE->ChangeCurve().FirstParameter(WLast);
+         CurrentOffsetHE->ChangeCurve().SetFirstPointAndTgt(PLast,TLast);
+         CurrentOffsetHE->ChangeCurve().ChangePrevious() = LSD.Value(j);
        }
       }
       if(!li.IsEmpty()) myEVIMap.Bind(Spine->Edges(iedge),li);
@@ -2468,6 +2552,11 @@ void ChFi3d_Builder::PerformSetOfKPart(Handle(ChFiDS_Stripe)& Stripe,
        CurrentHE->ChangeCurve().SetLastPointAndTgt(PEndPeriodic,TEndPeriodic);
        if(!YaKPart) CurrentHE->ChangeCurve().SetPeriodic(Standard_True);
        Spine->AppendElSpine(CurrentHE);
+
+       CurrentOffsetHE->ChangeCurve().LastParameter(WEndPeriodic);
+       CurrentOffsetHE->ChangeCurve().SetLastPointAndTgt(PEndPeriodic,TEndPeriodic);
+       if(!YaKPart) CurrentOffsetHE->ChangeCurve().SetPeriodic(Standard_True);
+       Spine->AppendOffsetElSpine(CurrentOffsetHE);
       }
     }
     else{
@@ -2478,6 +2567,10 @@ void ChFi3d_Builder::PerformSetOfKPart(Handle(ChFiDS_Stripe)& Stripe,
        CurrentHE->ChangeCurve().LastParameter(Spine->LastParameter());
        CurrentHE->ChangeCurve().SetLastPointAndTgt(PLast,TLast);
        Spine->AppendElSpine(CurrentHE);
+
+       CurrentOffsetHE->ChangeCurve().LastParameter(Spine->LastParameter());
+       CurrentOffsetHE->ChangeCurve().SetLastPointAndTgt(PLast,TLast);
+       Spine->AppendOffsetElSpine(CurrentOffsetHE);
       }
     }
   }
@@ -2493,6 +2586,12 @@ void ChFi3d_Builder::PerformSetOfKPart(Handle(ChFiDS_Stripe)& Stripe,
     if(ChFi3d_GettraceCHRON()) { elspine.Stop(); }
 #endif
   }
+  if (Spine->Mode() == ChFiDS_ConstThroatWithPenetrationChamfer)
+  {
+    ChFiDS_ListOfHElSpine& offsetll = Spine->ChangeOffsetElSpines();
+    for (ILES.Initialize(offsetll); ILES.More(); ILES.Next())
+      ChFi3d_PerformElSpine(ILES.Value(),Spine,myConti,tolesp,Standard_True);
+  }
   Spine->SplitDone(Standard_True);
 }
 
index 54cdd6f8f3dceae57d421fdee03fcc01bb391c87..a43192a558e34d63542647935977f1a21ef83950 100644 (file)
@@ -1488,6 +1488,22 @@ Standard_Boolean ChFi3d_Builder::ComputeData
  const Standard_Boolean RecOnS1,
  const Standard_Boolean RecOnS2)
 {
+  //Get offset guide if exists
+  Handle(ChFiDS_HElSpine) OffsetHGuide;
+  if (!Spine.IsNull() &&
+      Spine->Mode() == ChFiDS_ConstThroatWithPenetrationChamfer)
+  {
+    ChFiDS_ListOfHElSpine& ll = Spine->ChangeElSpines();
+    ChFiDS_ListOfHElSpine& ll_offset = Spine->ChangeOffsetElSpines();
+    ChFiDS_ListIteratorOfListOfHElSpine ILES(ll), ILES_offset(ll_offset);
+    for ( ; ILES.More(); ILES.Next(),ILES_offset.Next())
+    {
+      const Handle(ChFiDS_HElSpine)& aHElSpine = ILES.Value();
+      if (aHElSpine == HGuide)
+        OffsetHGuide = ILES_offset.Value();
+    }
+  }
+  
   //The extrensions are created in case of output of two domains
   //directly and not by path ( too hasardous ).
   Data->FirstExtensionValue(0);
@@ -1617,6 +1633,12 @@ Standard_Boolean ChFi3d_Builder::ComputeData
       HGuide->ChangeCurve().FirstParameter(SpFirst);
       HGuide->ChangeCurve().LastParameter (SpLast );
       HGuide->ChangeCurve().SetOrigin(SpFirst);
+      if (!OffsetHGuide.IsNull())
+      {
+        OffsetHGuide->ChangeCurve().FirstParameter(SpFirst);
+        OffsetHGuide->ChangeCurve().LastParameter (SpLast );
+        OffsetHGuide->ChangeCurve().SetOrigin(SpFirst);
+      }
     }
     Standard_Boolean complmnt = Standard_True;
     if (Inside)  complmnt = TheWalk.Complete(Func,FInv,SpLast);
@@ -2076,6 +2098,7 @@ Standard_Boolean ChFi3d_Builder::ComputeData
 Standard_Boolean ChFi3d_Builder::SimulData
 (Handle(ChFiDS_SurfData)& /*Data*/,
  const Handle(ChFiDS_HElSpine)& HGuide,
+ const Handle(ChFiDS_HElSpine)& AdditionalHGuide,
  Handle(BRepBlend_Line)& Lin,
  const Handle(Adaptor3d_HSurface)& S1,
  const Handle(Adaptor3d_TopolTool)& I1,
@@ -2158,6 +2181,11 @@ Standard_Boolean ChFi3d_Builder::SimulData
        SpLast  = SpFirst + HGuide->Period();
        HGuide->ChangeCurve().FirstParameter(SpFirst);
        HGuide->ChangeCurve().LastParameter (SpLast );
+        if (!AdditionalHGuide.IsNull())
+        {
+          AdditionalHGuide->ChangeCurve().FirstParameter(SpFirst);
+          AdditionalHGuide->ChangeCurve().LastParameter (SpLast );
+        }
       }
       Standard_Boolean complmnt = Standard_True;
       if (Inside)  complmnt = TheWalk.Complete(Func,FInv,SpLast);
index 688ae807870272cf4e494f62ad04a5ed37a5e774..170f95026790e65fd37d341ad0944ca43e4f0215 100644 (file)
 #include <BRepAdaptor_Surface.hxx>
 #include <BRepBlend_Chamfer.hxx>
 #include <BRepBlend_ChamfInv.hxx>
+#include <BRepBlend_ConstThroat.hxx>
+#include <BRepBlend_ConstThroatInv.hxx>
+#include <BRepBlend_ConstThroatWithPenetration.hxx>
+#include <BRepBlend_ConstThroatWithPenetrationInv.hxx>
 #include <BRepBlend_ChAsym.hxx>
 #include <BRepBlend_ChAsymInv.hxx>
 #include <BRepBlend_Line.hxx>
 #include <TopOpeBRepBuild_HBuilder.hxx>
 #include <TopOpeBRepDS_HDataStructure.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <memory>
 
 #ifdef OCCT_DEBUG
 extern Standard_Boolean ChFi3d_GettraceCHRON();
 #endif
 
+
 //=======================================================================
 //function : SearchCommonFaces
 //purpose  : search the 2 common faces <F1> and <F2> of the edge <E>
@@ -180,6 +186,7 @@ ChFi3d_ChBuilder::ChFi3d_ChBuilder(const TopoDS_Shape& S,
                                   const Standard_Real Ta) : 
                                          ChFi3d_Builder(S, Ta)
 {
+  myMode = ChFiDS_ClassicChamfer;
 }
 
 
@@ -191,7 +198,8 @@ ChFi3d_ChBuilder::ChFi3d_ChBuilder(const TopoDS_Shape& S,
 
 void  ChFi3d_ChBuilder::Add(const TopoDS_Edge& E)
 {
-
+  TopoDS_Face dummy;
+  
   if(!Contains(E) && myEFMap.Contains(E)){
     Handle(ChFiDS_Stripe) Stripe = new ChFiDS_Stripe();
     Handle(ChFiDS_Spine)& Sp = Stripe->ChangeSpine();
@@ -201,7 +209,7 @@ void  ChFi3d_ChBuilder::Add(const TopoDS_Edge& E)
     TopoDS_Edge E_wnt = E;
     E_wnt.Orientation(TopAbs_FORWARD);
     Spine->SetEdges(E_wnt);
-    if(PerformElement(Spine)){
+    if(PerformElement(Spine, -1, dummy)) {
       PerformExtremity(Spine);
       Spine->Load();
       myListStripe.Append(Stripe);
@@ -219,43 +227,31 @@ void  ChFi3d_ChBuilder::Add(const TopoDS_Edge& E)
 //=======================================================================
 
 void  ChFi3d_ChBuilder::Add(const Standard_Real Dis,
-                           const TopoDS_Edge& E,
-                           const TopoDS_Face& F)
+                           const TopoDS_Edge& E)
 {
   if (!Contains(E)  && myEFMap.Contains(E)) {
      
-    // Take the 2 common faces of the egde <E>
-    TopoDS_Face F1,F2;
-    SearchCommonFaces(myEFMap,E,F1,F2);
+    TopoDS_Face dummy;
 
-    if (! F1.IsSame(F) && F2.IsSame(F) ) {
-      F2 = F1;
-      F1 = F;
-    }
-
-    if ( F1.IsSame(F)) {
-      TopoDS_Edge E_wnt = E;
-      E_wnt.Orientation(TopAbs_FORWARD);
-      BRepAdaptor_Surface Sb1,Sb2;
-      Sb1.Initialize(F1);
-      Sb2.Initialize(F2);
-      TopAbs_Orientation Or1,Or2;
-      ChFi3d::ConcaveSide(Sb1,Sb2,E_wnt,Or1,Or2); 
-      Handle(ChFiDS_Stripe) Stripe = new ChFiDS_Stripe();
-      Handle(ChFiDS_Spine)& Sp = Stripe->ChangeSpine();
-      Sp = new ChFiDS_ChamfSpine(tolesp);
-      Handle(ChFiDS_ChamfSpine) 
-        Spine = Handle(ChFiDS_ChamfSpine)::DownCast(Sp);
-
-      Spine->SetEdges(E_wnt);
-      if(PerformElement(Spine)){
-       Spine->Load();
-       myListStripe.Append(Stripe);
-       
-       Spine->SetDist(Dis);
-
-       PerformExtremity(Spine);
-      }
+    TopoDS_Edge E_wnt = E;
+    E_wnt.Orientation(TopAbs_FORWARD);
+    
+    Handle(ChFiDS_Stripe) Stripe = new ChFiDS_Stripe();
+    Handle(ChFiDS_Spine)& Sp = Stripe->ChangeSpine();
+    Sp = new ChFiDS_ChamfSpine(tolesp);
+    Handle(ChFiDS_ChamfSpine) 
+      Spine = Handle(ChFiDS_ChamfSpine)::DownCast(Sp);
+    
+    Spine->SetMode(myMode);
+    
+    Spine->SetEdges(E_wnt);
+    if(PerformElement(Spine, -1, dummy)) {
+      Spine->Load();
+      myListStripe.Append(Stripe);
+      
+      Spine->SetDist(Dis);
+      
+      PerformExtremity(Spine);
     }
   }
 }
@@ -335,54 +331,29 @@ void  ChFi3d_ChBuilder::Add(const Standard_Real Dis1,
                            const TopoDS_Face& F)
 {
   if (!Contains(E)  && myEFMap.Contains(E)) {
-     
-    // Take the 2 common faces of the egde <E>
-    TopoDS_Face F1,F2;
-    SearchCommonFaces(myEFMap,E,F1,F2);
 
-    if (! F1.IsSame(F) && F2.IsSame(F) ) {
-      F2 = F1;
-      F1 = F;
-    }
-
-    if ( F1.IsSame(F)) {
-      TopoDS_Edge E_wnt = E;
-      E_wnt.Orientation(TopAbs_FORWARD);
-      BRepAdaptor_Surface Sb1,Sb2;
-      Sb1.Initialize(F1);
-      Sb2.Initialize(F2);
-      TopAbs_Orientation Or1,Or2;
-      Standard_Integer Choix = ChFi3d::ConcaveSide(Sb1,Sb2,E_wnt,Or1,Or2); 
-
-      Handle(ChFiDS_Stripe) Stripe = new ChFiDS_Stripe();
-      Handle(ChFiDS_Spine)& Sp = Stripe->ChangeSpine();
-      Sp = new ChFiDS_ChamfSpine(tolesp);
-      Handle(ChFiDS_ChamfSpine) 
-        Spine = Handle(ChFiDS_ChamfSpine)::DownCast(Sp);
-
-      Spine->SetEdges(E_wnt);
-      if(PerformElement(Spine)){
-       Spine->Load();
-       myListStripe.Append(Stripe);
-       
-       Standard_Integer ChoixConge;
-       SearchCommonFaces(myEFMap,Spine->Edges(1),F1,F2);
-       Sb1.Initialize(F1);
-       Sb2.Initialize(F2);
-       ChoixConge = ChFi3d::ConcaveSide(Sb1,Sb2,
-                                        Spine->Edges(1),
-                                        Or1,Or2);
-
-
-       // compare the 2 computed choices to know how to set the 
-       // distances of the Spine according to the choice done 
-       // on the added edge <e>
-       if ( ChoixConge%2 != Choix%2 )
-         Spine->SetDists(Dis2, Dis1);
-       else Spine->SetDists(Dis1, Dis2);
-
-       PerformExtremity(Spine);
-      }
+    TopoDS_Edge E_wnt = E;
+    E_wnt.Orientation(TopAbs_FORWARD);
+    
+    Handle(ChFiDS_Stripe) Stripe = new ChFiDS_Stripe();
+    Handle(ChFiDS_Spine)& Sp = Stripe->ChangeSpine();
+    Sp = new ChFiDS_ChamfSpine(tolesp);
+    Handle(ChFiDS_ChamfSpine) 
+      Spine = Handle(ChFiDS_ChamfSpine)::DownCast(Sp);
+    
+    Spine->SetMode(myMode);
+    Standard_Real Offset = -1;
+    if (myMode == ChFiDS_ConstThroatWithPenetrationChamfer)
+      Offset = Min(Dis1,Dis2);;
+    
+    Spine->SetEdges(E_wnt);
+    if(PerformElement(Spine, Offset, F)){
+      Spine->Load();
+      myListStripe.Append(Stripe);
+      
+      Spine->SetDists(Dis1, Dis2);
+      
+      PerformExtremity(Spine);
     }
   }
 }
@@ -477,56 +448,24 @@ void  ChFi3d_ChBuilder::AddDA(const Standard_Real Dis1,
                              const TopoDS_Face& F)
 {
   if (!Contains(E)  && myEFMap.Contains(E)) {
-     
-    // Take the 2 common faces of the egde <E>
-    TopoDS_Face F1,F2;
-    SearchCommonFaces(myEFMap,E,F1,F2);
-    if (! F1.IsSame(F) && F2.IsSame(F) ) {
-      F2 = F1;
-      F1 = F;
-    }
 
-    if ( F1.IsSame(F)) {
-      TopoDS_Edge E_wnt = E;
-      E_wnt.Orientation(TopAbs_FORWARD);
-      BRepAdaptor_Surface Sb1,Sb2;
-      Sb1.Initialize(F1);
-      Sb2.Initialize(F2);
-      TopAbs_Orientation Or1,Or2;
-      Standard_Integer Choix = ChFi3d::ConcaveSide(Sb1,Sb2,E_wnt,Or1,Or2); 
-
-      Handle(ChFiDS_Stripe) Stripe = new ChFiDS_Stripe();
-      Handle(ChFiDS_Spine)& Sp = Stripe->ChangeSpine();
-      Sp = new ChFiDS_ChamfSpine(tolesp);
-      Handle(ChFiDS_ChamfSpine) 
-        Spine = Handle(ChFiDS_ChamfSpine)::DownCast(Sp);
-
-      Spine->SetEdges(E_wnt);
-      if(PerformElement(Spine)){
-       Spine->Load();
-       myListStripe.Append(Stripe);
-       
-       Standard_Integer ChoixConge;
-       SearchCommonFaces(myEFMap,Spine->Edges(1),F1,F2);
-       Sb1.Initialize(F1);
-       Sb2.Initialize(F2);
-       ChoixConge = ChFi3d::ConcaveSide(Sb1,Sb2,
-                                        Spine->Edges(1),
-                                        Or1,Or2);
-
-       // compare the 2 computed choices to know how to set the 
-       // distances of the Spine according to the choice done 
-       // on the added edge <e>
-       if ( ChoixConge%2 != Choix%2 ) {
-          Spine->SetDistAngle(Dis1, Angle, Standard_False);
-        }
-       else { 
-          Spine->SetDistAngle(Dis1, Angle, Standard_True);
-        }
-       
-       PerformExtremity(Spine);
-      }
+    TopoDS_Edge E_wnt = E;
+    E_wnt.Orientation(TopAbs_FORWARD);
+    
+    Handle(ChFiDS_Stripe) Stripe = new ChFiDS_Stripe();
+    Handle(ChFiDS_Spine)& Sp = Stripe->ChangeSpine();
+    Sp = new ChFiDS_ChamfSpine(tolesp);
+    Handle(ChFiDS_ChamfSpine) 
+      Spine = Handle(ChFiDS_ChamfSpine)::DownCast(Sp);
+    
+    Spine->SetEdges(E_wnt);
+    if(PerformElement(Spine, -1, F)) {
+      Spine->Load();
+      myListStripe.Append(Stripe);
+      
+      Spine->SetDistAngle(Dis1, Angle);
+      
+      PerformExtremity(Spine);
     }
   }
 }
@@ -549,12 +488,9 @@ void  ChFi3d_ChBuilder::SetDistAngle(const Standard_Real    Dis,
 
     // Search the first edge which has a common face equal to F
     TopoDS_Face F1,F2,FirstF1,FirstF2;
-    TopAbs_Orientation Or1,Or2;
-    Standard_Integer Choix, ChoixConge;
     BRepAdaptor_Surface Sb1,Sb2;
     Standard_Integer i = 1;
     Standard_Boolean Found = Standard_False;
-//    Standard_Boolean DisOnF1 = Standard_True;
 
     while ( (i <= csp->NbEdges()) && (!Found) ) {
       SearchCommonFaces(myEFMap,csp->Edges(i),F1,F2);
@@ -565,7 +501,7 @@ void  ChFi3d_ChBuilder::SetDistAngle(const Standard_Real    Dis,
       Found = ( F1.IsSame(F) || F2.IsSame(F) );
       i++;
     }
-
+    
     if (Found) {
       if ( F2.IsSame(F) ) {
        F2 = F1;
@@ -573,20 +509,9 @@ void  ChFi3d_ChBuilder::SetDistAngle(const Standard_Real    Dis,
       }
       Sb1.Initialize(F1);
       Sb2.Initialize(F2);
-      Choix = ChFi3d::ConcaveSide(Sb1,Sb2,
-                                 csp->Edges(i-1),
-                                 Or1,Or2);
       Sb1.Initialize(FirstF1);
       Sb2.Initialize(FirstF2);
-      ChoixConge = ChFi3d::ConcaveSide(Sb1,Sb2,
-                                      csp->Edges(1),
-                                      Or1,Or2);
-      if ( ChoixConge%2 != Choix%2 ) {
-       csp->SetDistAngle(Dis, Angle, Standard_False);
-      }
-      else {
-        csp->SetDistAngle(Dis, Angle, Standard_True);
-      }
+      csp->SetDistAngle(Dis, Angle);
     }
     else
       throw Standard_DomainError("the face is not common to any edges of the contour");
@@ -602,12 +527,21 @@ void  ChFi3d_ChBuilder::SetDistAngle(const Standard_Real    Dis,
 
 void ChFi3d_ChBuilder::GetDistAngle(const Standard_Integer  IC,
                                    Standard_Real&          Dis,
-                                   Standard_Real&          Angle,
-                                   Standard_Boolean&       DisOnFace1) const
+                                   Standard_Real&          Angle) const
 {
     Handle(ChFiDS_ChamfSpine) chsp = Handle(ChFiDS_ChamfSpine)::DownCast(Value(IC));
 
-    chsp->GetDistAngle(Dis, Angle, DisOnFace1);
+    chsp->GetDistAngle(Dis, Angle);
+}
+
+//=======================================================================
+//function : SetMode
+//purpose  : set the mode of chamfer
+//=======================================================================
+
+void  ChFi3d_ChBuilder::SetMode(const ChFiDS_ChamfMode theMode)
+{
+  myMode = theMode;
 }
 
 //=======================================================================
@@ -624,6 +558,15 @@ ChFiDS_ChamfMethod ChFi3d_ChBuilder::IsChamfer(const Standard_Integer  IC) const
 
 }
 
+//=======================================================================
+//function : Mode
+//purpose  : 
+//=======================================================================
+ChFiDS_ChamfMode ChFi3d_ChBuilder::Mode() const
+{
+  return myMode;
+}
+
 //=======================================================================
 //function : ResetContour
 //purpose  : 
@@ -836,6 +779,7 @@ ChFi3d_ChBuilder::SimulSurf(Handle(ChFiDS_SurfData)&            Data,
   if(intl) Last = chsp->LastParameter(chsp->NbEdges());
 
 
+  Handle(ChFiDS_HElSpine) OffsetHGuide;
 
   if (chsp->IsChamfer() == ChFiDS_Sym) {
     Standard_Real dis;
@@ -843,13 +787,28 @@ ChFi3d_ChBuilder::SimulSurf(Handle(ChFiDS_SurfData)&            Data,
     radius = Max(dis, radiusspine);
     locfleche = radius*1.e-2; //graphic criterion
 
-    BRepBlend_Chamfer Func(S1,S2,HGuide);
-    BRepBlend_ChamfInv FInv(S1,S2,HGuide); 
-    Func.Set(dis, dis, Choix);
-    FInv.Set(dis, dis, Choix);
+#if (defined(_MSC_VER) && (_MSC_VER < 1600))
+    std::auto_ptr<BlendFunc_GenChamfer>  pFunc;
+    std::auto_ptr<BlendFunc_GenChamfInv> pFInv;
+#else
+    std::unique_ptr<BlendFunc_GenChamfer>  pFunc;
+    std::unique_ptr<BlendFunc_GenChamfInv> pFInv;
+#endif  
+    if (chsp->Mode() == ChFiDS_ClassicChamfer)
+    {
+      pFunc.reset(new BRepBlend_Chamfer(S1,S2,HGuide));
+      pFInv.reset(new BRepBlend_ChamfInv(S1,S2,HGuide));
+    }
+    else
+    {
+      pFunc.reset(new BRepBlend_ConstThroat(S1,S2,HGuide));
+      pFInv.reset(new BRepBlend_ConstThroatInv(S1,S2,HGuide));
+    }
+    pFunc->Set(dis, dis, Choix);
+    pFInv->Set(dis, dis, Choix);
     
-    done = SimulData(Data,HGuide,lin,S1,I1,S2,I2,
-                    Func,FInv,PFirst,MaxStep,locfleche,
+    done = SimulData(Data,HGuide,OffsetHGuide,lin,S1,I1,S2,I2,
+                    *pFunc,*pFInv,PFirst,MaxStep,locfleche,
                     TolGuide,First,Last,Inside,Appro,Forward,
                     Soldep,4,RecOnS1,RecOnS2);
 
@@ -867,7 +826,7 @@ ChFi3d_ChBuilder::SimulSurf(Handle(ChFiDS_SurfData)&            Data,
       p.ParametersOnS1(u1,v1);
       p.ParametersOnS2(u2,v2);
       ww = p.Parameter();
-      Func.Section(ww,u1,v1,u2,v2,p1,p2,line); 
+      pFunc->Section(ww,u1,v1,u2,v2,p1,p2,line); 
       isec.Set(line,p1,p2);
       if(i == 1) {pf1.SetCoord(u1,v1); pf2.SetCoord(u2,v2);} 
       if(i == nbp) {pl1.SetCoord(u1,v1); pl2.SetCoord(u2,v2);} 
@@ -925,13 +884,46 @@ ChFi3d_ChBuilder::SimulSurf(Handle(ChFiDS_SurfData)&            Data,
     radius = Max(radius, radiusspine);
     locfleche = radius*1.e-2; //graphic criterion
 
-    BRepBlend_Chamfer Func(S1,S2,HGuide);
-    BRepBlend_ChamfInv FInv(S1,S2,HGuide); 
-    Func.Set(dis1,dis2,Choix);
-    FInv.Set(dis1,dis2,Choix);
+#if (defined(_MSC_VER) && (_MSC_VER < 1600))
+    std::auto_ptr<BlendFunc_GenChamfer>  pFunc;
+    std::auto_ptr<BlendFunc_GenChamfInv> pFInv;
+#else
+    std::unique_ptr<BlendFunc_GenChamfer>  pFunc;
+    std::unique_ptr<BlendFunc_GenChamfInv> pFInv;
+#endif  
+    if (chsp->Mode() == ChFiDS_ClassicChamfer)
+    {
+      pFunc.reset(new BRepBlend_Chamfer(S1,S2,HGuide));
+      pFInv.reset(new BRepBlend_ChamfInv(S1,S2,HGuide));
+      pFunc->Set(dis1,dis2,Choix);
+      pFInv->Set(dis1,dis2,Choix);
+    }
+    else
+    {
+      ChFiDS_ListOfHElSpine& ll = Spine->ChangeElSpines();
+      ChFiDS_ListOfHElSpine& ll_offset = Spine->ChangeOffsetElSpines();
+      ChFiDS_ListIteratorOfListOfHElSpine ILES(ll), ILES_offset(ll_offset);
+      for ( ; ILES.More(); ILES.Next(),ILES_offset.Next())
+      {
+        const Handle(ChFiDS_HElSpine)& aHElSpine = ILES.Value();
+        if (aHElSpine == HGuide)
+          OffsetHGuide = ILES_offset.Value();
+      }
+      
+      if (OffsetHGuide.IsNull())
+      {
+        cout<<endl<<"Construction of offset guide failed!"<<endl;
+        //exception
+      }
+      pFunc.reset(new BRepBlend_ConstThroatWithPenetration(S1,S2,OffsetHGuide));
+      pFInv.reset(new BRepBlend_ConstThroatWithPenetrationInv(S1,S2,OffsetHGuide));
+      Standard_Real Throat = Max(dis1,dis2);
+      pFunc->Set(Throat,Throat,Choix);
+      pFInv->Set(Throat,Throat,Choix);
+    }
     
-    done = SimulData(Data,HGuide,lin,S1,I1,S2,I2,
-                    Func,FInv,PFirst,MaxStep,locfleche,
+    done = SimulData(Data,HGuide,OffsetHGuide,lin,S1,I1,S2,I2,
+                    *pFunc,*pFInv,PFirst,MaxStep,locfleche,
                     TolGuide,First,Last,Inside,Appro,Forward,
                     Soldep,4,RecOnS1,RecOnS2);
 
@@ -949,7 +941,7 @@ ChFi3d_ChBuilder::SimulSurf(Handle(ChFiDS_SurfData)&            Data,
       p.ParametersOnS1(u1,v1);
       p.ParametersOnS2(u2,v2);
       ww = p.Parameter();
-      Func.Section(ww,u1,v1,u2,v2,p1,p2,line); 
+      pFunc->Section(ww,u1,v1,u2,v2,p1,p2,line); 
       isec.Set(line,p1,p2);
       if(i == 1) {pf1.SetCoord(u1,v1); pf2.SetCoord(u2,v2);} 
       if(i == nbp) {pl1.SetCoord(u1,v1); pl2.SetCoord(u2,v2);} 
@@ -1000,181 +992,92 @@ ChFi3d_ChBuilder::SimulSurf(Handle(ChFiDS_SurfData)&            Data,
       }
     }
   }
-  else  {
+  else  { //distance and angle
     Standard_Real dis, angle;
-    Standard_Boolean disonF1;  
-    chsp->GetDistAngle(dis, angle, disonF1);
+    chsp->GetDistAngle(dis, angle);
     radius = Max(dis, dis * tan(angle));
     radius = Max(radius, radiusspine);
     locfleche = radius*1.e-2; //graphic criterion
 
-    Standard_Integer Ch = FindChoiceDistAngle(Choix, disonF1);
-
-    if (disonF1)  {
-      BRepBlend_ChAsym    Func(S1,S2,HGuide);
-      BRepBlend_ChAsymInv FInv(S1,S2,HGuide); 
+    Standard_Integer Ch = Choix;
 
-      Func.Set(dis, angle, Ch);
-      FInv.Set(dis, angle, Ch);
-
-      done = SimulData(Data,HGuide,lin,S1,I1,S2,I2,
-                      Func,FInv,PFirst,MaxStep,locfleche,
-                      TolGuide,First,Last,Inside,Appro,Forward,
-                      Soldep,4,RecOnS1,RecOnS2);
+    BRepBlend_ChAsym    Func(S1,S2,HGuide);
+    BRepBlend_ChAsymInv FInv(S1,S2,HGuide); 
     
-      if ( !done ) return Standard_False;
-      Handle(ChFiDS_SecHArray1) sec;
-      gp_Pnt2d pf1,pl1,pf2,pl2;  
-      
-      Standard_Integer nbp = lin->NbPoints();
-      sec = new ChFiDS_SecHArray1(1,nbp);
-      for( i = 1; i <= nbp; i++ ){
-       ChFiDS_CircSection& isec = sec->ChangeValue(i);
-       Standard_Real u1,v1,u2,v2,ww,p1,p2;
-       gp_Lin line;
-       const Blend_Point& p = lin->Point(i);
-       p.ParametersOnS1(u1,v1);
-       p.ParametersOnS2(u2,v2);
-       ww = p.Parameter();
-       Func.Section(ww,u1,v1,u2,v2,p1,p2,line); 
-       isec.Set(line,p1,p2);
-       if(i == 1) {pf1.SetCoord(u1,v1); pf2.SetCoord(u2,v2);} 
-       if(i == nbp) {pl1.SetCoord(u1,v1); pl2.SetCoord(u2,v2);} 
-      }
+    Func.Set(dis, angle, Ch);
+    FInv.Set(dis, angle, Ch);
     
-      Data->SetSimul(sec);
-      Data->Set2dPoints(pf1,pl1,pf2,pl2);
-      ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
-                           Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
-      ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
-                           Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
-      ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
-                           Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
-      ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
-                           Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
-
-      Standard_Boolean reverse = (!Forward || Inside);
-      if(intf && reverse){
-       Standard_Boolean ok = Standard_False;
-       const ChFiDS_CommonPoint& cp1 = Data->VertexFirstOnS1();
-       if(cp1.IsOnArc()){
-         TopoDS_Face F1 = S1->ChangeSurface().Face();
-         TopoDS_Face bid;
-         intf = !SearchFace(Spine,cp1,F1,bid);
-         ok = intf != 0;
-       }
-       const ChFiDS_CommonPoint& cp2 = Data->VertexFirstOnS2();
-       if(cp2.IsOnArc() && !ok){
-         TopoDS_Face F2 = S2->ChangeSurface().Face();
-         TopoDS_Face bid;
-         intf = !SearchFace(Spine,cp2,F2,bid);
-       }
+    done = SimulData(Data,HGuide,OffsetHGuide,lin,S1,I1,S2,I2,
+                     Func,FInv,PFirst,MaxStep,locfleche,
+                     TolGuide,First,Last,Inside,Appro,Forward,
+                     Soldep,4,RecOnS1,RecOnS2);
+    
+    if ( !done ) return Standard_False;
+    Handle(ChFiDS_SecHArray1) sec;
+    gp_Pnt2d pf1,pl1,pf2,pl2;  
+    
+    Standard_Integer nbp = lin->NbPoints();
+    sec = new ChFiDS_SecHArray1(1,nbp);
+    for( i = 1; i <= nbp; i++ ){
+      ChFiDS_CircSection& isec = sec->ChangeValue(i);
+      Standard_Real u1,v1,u2,v2,ww,p1,p2;
+      gp_Lin line;
+      const Blend_Point& p = lin->Point(i);
+      p.ParametersOnS1(u1,v1);
+      p.ParametersOnS2(u2,v2);
+      ww = p.Parameter();
+      Func.Section(ww,u1,v1,u2,v2,p1,p2,line); 
+      isec.Set(line,p1,p2);
+      if(i == 1) {pf1.SetCoord(u1,v1); pf2.SetCoord(u2,v2);} 
+      if(i == nbp) {pl1.SetCoord(u1,v1); pl2.SetCoord(u2,v2);} 
+    }
+    
+    Data->SetSimul(sec);
+    Data->Set2dPoints(pf1,pl1,pf2,pl2);
+    ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
+                          Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
+    ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
+                          Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
+    ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
+                          Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
+    ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
+                          Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
+    
+    Standard_Boolean reverse = (!Forward || Inside);
+    if(intf && reverse){
+      Standard_Boolean ok = Standard_False;
+      const ChFiDS_CommonPoint& cp1 = Data->VertexFirstOnS1();
+      if(cp1.IsOnArc()){
+        TopoDS_Face F1 = S1->ChangeSurface().Face();
+        TopoDS_Face bid;
+        intf = !SearchFace(Spine,cp1,F1,bid);
+        ok = intf != 0;
       }
-      
-      if(intl){
-       Standard_Boolean ok = Standard_False;
-       const ChFiDS_CommonPoint& cp1 = Data->VertexLastOnS1();
-       if(cp1.IsOnArc()){
-         TopoDS_Face F1 = S1->ChangeSurface().Face();
-         TopoDS_Face bid;
-         intl = !SearchFace(Spine,cp1,F1,bid);
-         ok = intl != 0;
-       }
-       const ChFiDS_CommonPoint& cp2 = Data->VertexLastOnS2();
-       if(cp2.IsOnArc() && !ok){
-         TopoDS_Face F2 = S2->ChangeSurface().Face();
-         TopoDS_Face bid;
-         intl = !SearchFace(Spine,cp2,F2,bid);
-       }
+      const ChFiDS_CommonPoint& cp2 = Data->VertexFirstOnS2();
+      if(cp2.IsOnArc() && !ok){
+        TopoDS_Face F2 = S2->ChangeSurface().Face();
+        TopoDS_Face bid;
+        intf = !SearchFace(Spine,cp2,F2,bid);
       }
     }
-    else {
-      BRepBlend_ChAsym    Func(S2,S1,HGuide);
-      BRepBlend_ChAsymInv FInv(S2,S1,HGuide); 
-
-      Func.Set(dis, angle, Ch);
-      FInv.Set(dis, angle, Ch);
-
-      Standard_Real Rtemp;
-      Rtemp     = Soldep(1);
-      Soldep(1) = Soldep(3);
-      Soldep(3) = Rtemp;
-      Rtemp     = Soldep(2);
-      Soldep(2) = Soldep(4);
-      Soldep(4) = Rtemp;
-
-      done = SimulData(Data,HGuide,lin,S2,I2,S1,I1,
-                      Func,FInv,PFirst,MaxStep,locfleche,
-                      TolGuide,First,Last,Inside,Appro,Forward,
-                      Soldep,4,RecOnS2,RecOnS1);
-    
-      if ( !done ) return Standard_False;
-      Handle(ChFiDS_SecHArray1) sec;
-      gp_Pnt2d pf1,pl1,pf2,pl2;  
-      
-      Standard_Integer nbp = lin->NbPoints();
-      sec = new ChFiDS_SecHArray1(1,nbp);
-      for( i = 1; i <= nbp; i++ ){
-       ChFiDS_CircSection& isec = sec->ChangeValue(i);
-       Standard_Real u1,v1,u2,v2,ww,p1,p2;
-       gp_Lin line;
-       const Blend_Point& p = lin->Point(i);
-       p.ParametersOnS1(u1,v1);
-       p.ParametersOnS2(u2,v2);
-       ww = p.Parameter();
-       Func.Section(ww,u1,v1,u2,v2,p1,p2,line); 
-       isec.Set(line,p1,p2);
-       if(i == 1) {pf1.SetCoord(u1,v1); pf2.SetCoord(u2,v2);} 
-       if(i == nbp) {pl1.SetCoord(u1,v1); pl2.SetCoord(u2,v2);} 
-      }
     
-      Data->SetSimul(sec);
-      Data->Set2dPoints(pf1,pl1,pf2,pl2);
-      ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(),
-                           Standard_True, Data->ChangeVertexFirstOnS1(),tolesp);
-      ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(),
-                           Standard_False,Data->ChangeVertexLastOnS1(),tolesp);
-      ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(),
-                           Standard_True, Data->ChangeVertexFirstOnS2(),tolesp);
-      ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(),
-                           Standard_False, Data->ChangeVertexLastOnS2(),tolesp);
-
-      Standard_Boolean reverse = (!Forward || Inside);
-      if(intf && reverse){
-       Standard_Boolean ok = Standard_False;
-       const ChFiDS_CommonPoint& cp1 = Data->VertexFirstOnS1();
-       if(cp1.IsOnArc()){
-         TopoDS_Face F1 = S1->ChangeSurface().Face();
-         TopoDS_Face bid;
-         intf = !SearchFace(Spine,cp1,F1,bid);
-         ok = intf != 0;
-       }
-       const ChFiDS_CommonPoint& cp2 = Data->VertexFirstOnS2();
-       if(cp2.IsOnArc() && !ok){
-         TopoDS_Face F2 = S2->ChangeSurface().Face();
-         TopoDS_Face bid;
-         intf = !SearchFace(Spine,cp2,F2,bid);
-       }
+    if(intl){
+      Standard_Boolean ok = Standard_False;
+      const ChFiDS_CommonPoint& cp1 = Data->VertexLastOnS1();
+      if(cp1.IsOnArc()){
+        TopoDS_Face F1 = S1->ChangeSurface().Face();
+        TopoDS_Face bid;
+        intl = !SearchFace(Spine,cp1,F1,bid);
+        ok = intl != 0;
       }
-      
-      if(intl){
-       Standard_Boolean ok = Standard_False;
-       const ChFiDS_CommonPoint& cp1 = Data->VertexLastOnS1();
-       if(cp1.IsOnArc()){
-         TopoDS_Face F1 = S1->ChangeSurface().Face();
-         TopoDS_Face bid;
-         intl = !SearchFace(Spine,cp1,F1,bid);
-         ok = intl != 0;
-       }
-       const ChFiDS_CommonPoint& cp2 = Data->VertexLastOnS2();
-       if(cp2.IsOnArc() && !ok){
-         TopoDS_Face F2 = S2->ChangeSurface().Face();
-         TopoDS_Face bid;
-         intl = !SearchFace(Spine,cp2,F2,bid);
-       }
+      const ChFiDS_CommonPoint& cp2 = Data->VertexLastOnS2();
+      if(cp2.IsOnArc() && !ok){
+        TopoDS_Face F2 = S2->ChangeSurface().Face();
+        TopoDS_Face bid;
+        intl = !SearchFace(Spine,cp2,F2,bid);
       }
     }
-  }
+  } //distance and angle
   return Standard_True;
 }
 
@@ -1297,8 +1200,20 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
     Standard_Real dis;
     chsp->GetDist(dis);
     
-    BRepBlend_Chamfer Func(S1,S2,HGuide);
-    Func.Set(dis,dis,Choix);
+#if (defined(_MSC_VER) && (_MSC_VER < 1600))
+    std::auto_ptr<BlendFunc_GenChamfer>  pFunc;
+#else
+    std::unique_ptr<BlendFunc_GenChamfer>  pFunc;
+#endif  
+    if (chsp->Mode() == ChFiDS_ClassicChamfer)
+    {
+      pFunc.reset(new BRepBlend_Chamfer(S1,S2,HGuide));
+    }
+    else
+    {
+      pFunc.reset(new BRepBlend_ConstThroat(S1,S2,HGuide));
+    }
+    pFunc->Set(dis,dis,Choix);
     BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
     
     //calculate an approximate starting solution
@@ -1309,8 +1224,8 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
     ( HGuide->Curve() ).D1(Par,ptgui,d1gui);
     //  ptgui = (S1->Surface()).Value(SolDep(1),SolDep(2));
     
-    Func.Set(Par);
-    Func.Tangent(SolDep(1),SolDep(2),SolDep(3),SolDep(4),TgF,TgL,tmp1,tmp2);
+    pFunc->Set(Par);
+    pFunc->Tangent(SolDep(1),SolDep(2),SolDep(3),SolDep(4),TgF,TgL,tmp1,tmp2);
     
     Standard_Boolean rev1 = Standard_False;
     Standard_Boolean rev2 = Standard_False;
@@ -1350,15 +1265,45 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
       (proj2.Point()).Parameter(SolDep(3),SolDep(4)); 
     }
     
-    return TheWalk.PerformFirstSection(Func,Par,SolDep,
+    return TheWalk.PerformFirstSection(*pFunc,Par,SolDep,
                                       tolesp,TolGuide,Pos1,Pos2);
   }
   else if (chsp->IsChamfer() == ChFiDS_TwoDist)  {
     Standard_Real dis1, dis2;
     chsp->Dists(dis1, dis2);
     
-    BRepBlend_Chamfer Func(S1,S2,HGuide);
-    Func.Set(dis1,dis2,Choix);
+#if (defined(_MSC_VER) && (_MSC_VER < 1600))
+    std::auto_ptr<BlendFunc_GenChamfer>  pFunc;
+#else
+    std::unique_ptr<BlendFunc_GenChamfer>  pFunc;
+#endif  
+    if (chsp->Mode() == ChFiDS_ClassicChamfer)
+    {
+      pFunc.reset(new BRepBlend_Chamfer(S1,S2,HGuide));
+      pFunc->Set(dis1,dis2,Choix);
+    }
+    else
+    {
+      Handle(ChFiDS_HElSpine) OffsetHGuide;
+      ChFiDS_ListOfHElSpine& ll = Spine->ChangeElSpines();
+      ChFiDS_ListOfHElSpine& ll_offset = Spine->ChangeOffsetElSpines();
+      ChFiDS_ListIteratorOfListOfHElSpine ILES(ll), ILES_offset(ll_offset);
+      for ( ; ILES.More(); ILES.Next(),ILES_offset.Next())
+      {
+        const Handle(ChFiDS_HElSpine)& aHElSpine = ILES.Value();
+        if (aHElSpine == HGuide)
+          OffsetHGuide = ILES_offset.Value();
+      }
+      
+      if (OffsetHGuide.IsNull())
+      {
+        cout<<endl<<"Construction of offset guide failed!"<<endl;
+        //exception
+      }
+      pFunc.reset(new BRepBlend_ConstThroatWithPenetration(S1,S2,OffsetHGuide));
+      Standard_Real Throat = Max(dis1,dis2);
+      pFunc->Set(Throat,Throat,Choix); //dis2?
+    }
     BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
     
     //calculate an approximate starting solution
@@ -1369,8 +1314,8 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
     ( HGuide->Curve() ).D1(Par,ptgui,d1gui);
     //  ptgui = (S1->Surface()).Value(SolDep(1),SolDep(2));
     
-    Func.Set(Par);
-    Func.Tangent(SolDep(1),SolDep(2),SolDep(3),SolDep(4),TgF,TgL,tmp1,tmp2);
+    pFunc->Set(Par);
+    pFunc->Tangent(SolDep(1),SolDep(2),SolDep(3),SolDep(4),TgF,TgL,tmp1,tmp2);
     
     Standard_Boolean rev1 = Standard_False;
     Standard_Boolean rev2 = Standard_False;
@@ -1390,10 +1335,26 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
       TgF.Reverse();
     if( rev2 )
       TgL.Reverse();
+
+    Standard_Real aDist1 = dis1, aDist2 = dis2;
+    if (chsp->Mode() == ChFiDS_ConstThroatWithPenetrationChamfer)
+    {
+      /*
+      Standard_Real Alpha = TgF.Angle(TgL);
+      Standard_Real SinAlpha = Sin(Alpha);
+      Standard_Real CosAlpha = Cos(Alpha);
+      Standard_Real TanAlpha = Tan(Alpha);
+      Standard_Real dis1dis1 = dis1*dis1, dis2dis2 = dis2*dis2;
+      aDist2 = sqrt(dis1dis1 - dis2dis2) - dis2/TanAlpha;
+      Standard_Real CosBeta = sqrt(1-dis2dis2/dis1dis1)*CosAlpha + dis2/dis1*SinAlpha;
+      Standard_Real FullDist1 = dis1/CosBeta;
+      aDist1 = FullDist1 - dis2/SinAlpha;
+      */
+    }
     
-    temp = (TgF.XYZ()).Multiplied(dis1);
+    temp = (TgF.XYZ()).Multiplied(aDist1);
     pt1.SetXYZ( (ptgui.XYZ()).Added(temp) );
-    temp = (TgL.XYZ()).Multiplied(dis2);
+    temp = (TgL.XYZ()).Multiplied(aDist2);
     pt2.SetXYZ( (ptgui.XYZ()).Added(temp) );
     
     Standard_Real tol = tolesp*1.e2;
@@ -1411,158 +1372,77 @@ Standard_Boolean ChFi3d_ChBuilder::PerformFirstSection
       (proj2.Point()).Parameter(SolDep(3),SolDep(4)); 
     }
     
-    return TheWalk.PerformFirstSection(Func,Par,SolDep,
+    return TheWalk.PerformFirstSection(*pFunc,Par,SolDep,
                                       tolesp,TolGuide,Pos1,Pos2);
   }
-  else {
+  else { //distance and angle
     Standard_Real dis1, angle;
-    Standard_Boolean disonF1; 
-    chsp->GetDistAngle(dis1, angle, disonF1);
+    chsp->GetDistAngle(dis1, angle);
     
-    Standard_Integer Ch = FindChoiceDistAngle(Choix, disonF1);
+    Standard_Integer Ch = Choix;
     
-    if (disonF1)  {
-      BRepBlend_ChAsym Func(S1,S2,HGuide);
-      Func.Set(dis1, angle, Ch);
-      BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
+    BRepBlend_ChAsym Func(S1,S2,HGuide);
+    Func.Set(dis1, angle, Ch);
+    BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide);
     
     //calculate an approximate starting solution
-      gp_Vec TgF, TgL, tmp1, tmp2, d1gui;
-      gp_Pnt pt1, pt2, ptgui;
-      gp_XYZ temp;
-      
-      ( HGuide->Curve() ).D1(Par,ptgui,d1gui);
-      //  ptgui = (S1->Surface()).Value(SolDep(1),SolDep(2));
-      
-      Func.Set(Par);
-      Func.Tangent(SolDep(1),SolDep(2),SolDep(3),SolDep(4),TgF,TgL,tmp1,tmp2);
-      
-      Standard_Boolean rev1 = Standard_False;
-      Standard_Boolean rev2 = Standard_False;
-      Standard_Real    sign = (TgF.Crossed(d1gui)).Dot(TgL);
-      
-      if( Ch%2 == 1 )
-       rev1 = Standard_True;
-      else
-       rev2 = Standard_True;
-      
-      if( sign < 0. ){
-       rev1 = !rev1;
-       rev2 = !rev2;
-      }
-      
-      if( rev1 )
-       TgF.Reverse();
-      if( rev2 )
-       TgL.Reverse();
-  
-      temp = (TgF.XYZ()).Multiplied(dis1);
-      pt1.SetXYZ( (ptgui.XYZ()).Added(temp) );
-      
-      Standard_Real dis2, tmpcos, tmpsin;
-      tmpcos = TgF.Dot(TgL);
-      tmpsin = sqrt(1. - tmpcos * tmpcos);  
-      
-      dis2   = dis1 / (tmpcos + tmpsin / tan(angle)); 
-      
-      temp = (TgL.XYZ()).Multiplied(dis2);
-      pt2.SetXYZ( (ptgui.XYZ()).Added(temp) );
-      
-      Standard_Real tol = tolesp*1.e2;
-//      Standard_Real u,v;
-      Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
-      proj1.Perform(pt1, SolDep(1), SolDep(2));
-      Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
-      proj2.Perform(pt2, SolDep(3), SolDep(4));
-      if( proj1.IsDone() ){
-       (proj1.Point()).Parameter(SolDep(1),SolDep(2)); 
-      }
-      if( proj2.IsDone() ){
-       (proj2.Point()).Parameter(SolDep(3),SolDep(4)); 
-      }
-      
-      return TheWalk.PerformFirstSection(Func,Par,SolDep,
-                                        tolesp,TolGuide,Pos1,Pos2);
+    gp_Vec TgF, TgL, tmp1, tmp2, d1gui;
+    gp_Pnt pt1, pt2, ptgui;
+    gp_XYZ temp;
+    
+    ( HGuide->Curve() ).D1(Par,ptgui,d1gui);
+    //  ptgui = (S1->Surface()).Value(SolDep(1),SolDep(2));
+    
+    Func.Set(Par);
+    Func.Tangent(SolDep(1),SolDep(2),SolDep(3),SolDep(4),TgF,TgL,tmp1,tmp2);
+    
+    Standard_Boolean rev1 = Standard_False;
+    Standard_Boolean rev2 = Standard_False;
+    Standard_Real    sign = (TgF.Crossed(d1gui)).Dot(TgL);
+    
+    if( Ch%2 == 1 )
+      rev1 = Standard_True;
+    else
+      rev2 = Standard_True;
+    
+    if( sign < 0. ){
+      rev1 = !rev1;
+      rev2 = !rev2;
     }
-    else {
-      Standard_Real Rtemp;
-      BRepBlend_ChAsym Func(S2,S1,HGuide);
-      Func.Set(dis1, angle, Ch);
-      BRepBlend_Walking TheWalk(S2,S1,I2,I1,HGuide);
     
-    //calculate an approximate starting solution
-      gp_Vec TgF, TgL, tmp1, tmp2, d1gui;
-      gp_Pnt pt1, pt2, ptgui;
-      gp_XYZ temp;
-      
-      ( HGuide->Curve() ).D1(Par,ptgui,d1gui);
-      //  ptgui = (S1->Surface()).Value(SolDep(1),SolDep(2));
-      Rtemp     = SolDep(1);
-      SolDep(1) = SolDep(3);
-      SolDep(3) = Rtemp;
-      Rtemp     = SolDep(2);
-      SolDep(2) = SolDep(4);
-      SolDep(4) = Rtemp;      
-      Func.Set(Par);
-
-      Func.Tangent(SolDep(1),SolDep(2),SolDep(3),SolDep(4),TgF,TgL,tmp1,tmp2);
-      
-      Standard_Boolean rev1 = Standard_False;
-      Standard_Boolean rev2 = Standard_False;
-      Standard_Real    sign = (TgF.Crossed(d1gui)).Dot(TgL);
-      
-      if( Ch%2 == 1 )
-       rev1 = Standard_True;
-      else
-       rev2 = Standard_True;
-      
-      if( sign < 0. ){
-       rev1 = !rev1;
-       rev2 = !rev2;
-      }
-      
-      if( rev1 )
-       TgF.Reverse();
-      if( rev2 )
-       TgL.Reverse();
-  
-      temp = (TgF.XYZ()).Multiplied(dis1);
-      pt1.SetXYZ( (ptgui.XYZ()).Added(temp) );
-      
-      Standard_Real dis2, tmpcos, tmpsin;
-      tmpcos = TgF.Dot(TgL);
-      tmpsin = sqrt(1. - tmpcos * tmpcos);  
-      
-      dis2   = dis1 / (tmpcos + tmpsin / tan(angle)); 
-      
-      temp = (TgL.XYZ()).Multiplied(dis2);
-      pt2.SetXYZ( (ptgui.XYZ()).Added(temp) );
-      
-      Standard_Real tol = tolesp*1.e2;
-//      Standard_Real u,v;
-      Extrema_GenLocateExtPS proj1(S2->Surface(), tol, tol);
-      proj1.Perform(pt1, SolDep(1), SolDep(2));
-      Extrema_GenLocateExtPS proj2(S1->Surface(), tol, tol);
-      proj2.Perform(pt2, SolDep(3), SolDep(4));
-      if( proj1.IsDone() ) {
-       (proj1.Point()).Parameter(SolDep(1),SolDep(2)); 
-      }
-      if( proj2.IsDone() ){
-       (proj2.Point()).Parameter(SolDep(3),SolDep(4)); 
-      }
-      
-      Standard_Boolean RetWalk =  TheWalk.PerformFirstSection(Func,Par,SolDep,
-                                                             tolesp,TolGuide,Pos2,Pos1);
-      Rtemp     = SolDep(1);
-      SolDep(1) = SolDep(3);
-      SolDep(3) = Rtemp;
-      Rtemp     = SolDep(2);
-      SolDep(2) = SolDep(4);
-      SolDep(4) = Rtemp;
-
-      return RetWalk;
+    if( rev1 )
+      TgF.Reverse();
+    if( rev2 )
+      TgL.Reverse();
+    
+    temp = (TgF.XYZ()).Multiplied(dis1);
+    pt1.SetXYZ( (ptgui.XYZ()).Added(temp) );
+    
+    Standard_Real dis2, tmpcos, tmpsin;
+    tmpcos = TgF.Dot(TgL);
+    tmpsin = sqrt(1. - tmpcos * tmpcos);  
+    
+    dis2   = dis1 / (tmpcos + tmpsin / tan(angle)); 
+    
+    temp = (TgL.XYZ()).Multiplied(dis2);
+    pt2.SetXYZ( (ptgui.XYZ()).Added(temp) );
+    
+    Standard_Real tol = tolesp*1.e2;
+    //      Standard_Real u,v;
+    Extrema_GenLocateExtPS proj1(S1->Surface(), tol, tol);
+    proj1.Perform(pt1, SolDep(1), SolDep(2));
+    Extrema_GenLocateExtPS proj2(S2->Surface(), tol, tol);
+    proj2.Perform(pt2, SolDep(3), SolDep(4));
+    if( proj1.IsDone() ){
+      (proj1.Point()).Parameter(SolDep(1),SolDep(2)); 
     }
-  }
+    if( proj2.IsDone() ){
+      (proj2.Point()).Parameter(SolDep(3),SolDep(4)); 
+    }
+    
+    return TheWalk.PerformFirstSection(Func,Par,SolDep,
+                                       tolesp,TolGuide,Pos1,Pos2);
+  } //distance and angle
 }
 
 
@@ -1610,94 +1490,112 @@ ChFi3d_ChBuilder::PerformSurf(ChFiDS_SequenceOfSurfData&          SeqData,
   if(intl) Last = chsp->LastParameter(chsp->NbEdges());
 
   if (chsp->IsChamfer() == ChFiDS_Sym) {
-    BRepBlend_Chamfer  Func(S1,S2,HGuide);
-    BRepBlend_ChamfInv FInv(S1,S2,HGuide);
+    
+#if (defined(_MSC_VER) && (_MSC_VER < 1600))
+    std::auto_ptr<BlendFunc_GenChamfer>  pFunc;
+    std::auto_ptr<BlendFunc_GenChamfInv> pFInv;
+#else
+    std::unique_ptr<BlendFunc_GenChamfer>  pFunc;
+    std::unique_ptr<BlendFunc_GenChamfInv> pFInv;
+#endif  
+    if (chsp->Mode() == ChFiDS_ClassicChamfer)
+    {
+      pFunc.reset(new BRepBlend_Chamfer(S1,S2,HGuide));
+      pFInv.reset(new BRepBlend_ChamfInv(S1,S2,HGuide));
+    }
+    else
+    {
+      pFunc.reset(new BRepBlend_ConstThroat(S1,S2,HGuide));
+      pFInv.reset(new BRepBlend_ConstThroatInv(S1,S2,HGuide));
+    }
     Standard_Real dis;
     chsp->GetDist(dis);
-    Func.Set(dis, dis, Choix);
-    FInv.Set(dis, dis, Choix);
+    pFunc->Set(dis, dis, Choix);
+    pFInv->Set(dis, dis, Choix);
       
-    done = ComputeData(Data,HGuide,Spine,lin,S1,I1,S2,I2,Func,FInv,
+    done = ComputeData(Data,HGuide,Spine,lin,S1,I1,S2,I2,*pFunc,*pFInv,
                       PFirst,MaxStep,Fleche,TolGuide,First,Last,
                       Inside,Appro,Forward,Soldep,intf,intl,
                       gd1,gd2,gf1,gf2,RecOnS1,RecOnS2);
     if(!done) return Standard_False; // ratrappage possible PMN 14/05/1998
-    done = CompleteData(Data,Func,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
+    done = CompleteData(Data,*pFunc,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
     if(!done) throw Standard_Failure("PerformSurf : Fail of approximation!");
   }
   else if (chsp->IsChamfer() == ChFiDS_TwoDist) {
-    BRepBlend_Chamfer  Func(S1,S2,HGuide);
-    BRepBlend_ChamfInv FInv(S1,S2,HGuide);
     Standard_Real d1, d2;
     chsp->Dists(d1,d2);
-    Func.Set(d1,d2,Choix);
-    FInv.Set(d1,d2,Choix);
     
-    done = ComputeData(Data,HGuide,Spine,lin,S1,I1,S2,I2,Func,FInv,
+#if (defined(_MSC_VER) && (_MSC_VER < 1600))
+    std::auto_ptr<BlendFunc_GenChamfer>  pFunc;
+    std::auto_ptr<BlendFunc_GenChamfInv> pFInv;
+#else
+    std::unique_ptr<BlendFunc_GenChamfer>  pFunc;
+    std::unique_ptr<BlendFunc_GenChamfInv> pFInv;
+#endif  
+    if (chsp->Mode() == ChFiDS_ClassicChamfer)
+    {
+      pFunc.reset(new BRepBlend_Chamfer(S1,S2,HGuide));
+      pFInv.reset(new BRepBlend_ChamfInv(S1,S2,HGuide));
+      pFunc->Set(d1,d2,Choix);
+      pFInv->Set(d1,d2,Choix);
+    }
+    else
+    {
+      Handle(ChFiDS_HElSpine) OffsetHGuide;
+      ChFiDS_ListOfHElSpine& ll = Spine->ChangeElSpines();
+      ChFiDS_ListOfHElSpine& ll_offset = Spine->ChangeOffsetElSpines();
+      ChFiDS_ListIteratorOfListOfHElSpine ILES(ll), ILES_offset(ll_offset);
+      for ( ; ILES.More(); ILES.Next(),ILES_offset.Next())
+      {
+        const Handle(ChFiDS_HElSpine)& aHElSpine = ILES.Value();
+        if (aHElSpine == HGuide)
+          OffsetHGuide = ILES_offset.Value();
+      }
+      
+      if (OffsetHGuide.IsNull())
+      {
+        cout<<endl<<"Construction of offset guide failed!"<<endl;
+        //exception
+      }
+      pFunc.reset(new BRepBlend_ConstThroatWithPenetration(S1,S2,OffsetHGuide));
+      pFInv.reset(new BRepBlend_ConstThroatWithPenetrationInv(S1,S2,OffsetHGuide));
+      Standard_Real Throat = Max(d1,d2);
+      pFunc->Set(Throat,Throat,Choix);
+      pFInv->Set(Throat,Throat,Choix);
+    }
+    
+    done = ComputeData(Data,HGuide,Spine,lin,S1,I1,S2,I2,*pFunc,*pFInv,
                       PFirst,MaxStep,Fleche,TolGuide,First,Last,
                       Inside,Appro,Forward,Soldep,intf,intl,
                       gd1,gd2,gf1,gf2,RecOnS1,RecOnS2);
     if(!done) return Standard_False; // ratrappage possible PMN 14/05/1998
-    done = CompleteData(Data,Func,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
+    done = CompleteData(Data,*pFunc,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
     if(!done) throw Standard_Failure("PerformSurf : Fail of approximation!");
   }
-  else {
+  else { //distance and angle
     Standard_Real d1, angle;
-    Standard_Boolean disonF1;
-    chsp->GetDistAngle(d1, angle, disonF1);
+    chsp->GetDistAngle(d1, angle);
     
-    Standard_Integer Ch = FindChoiceDistAngle(Choix, disonF1);
+    Standard_Integer Ch = Choix;
 
-    if (disonF1) {
-      BRepBlend_ChAsym  Func(S1,S2,HGuide);
-      BRepBlend_ChAsymInv FInv(S1,S2,HGuide);
-      Func.Set(d1, angle, Ch);
-      FInv.Set(d1, angle, Ch);
+    BRepBlend_ChAsym  Func(S1,S2,HGuide);
+    BRepBlend_ChAsymInv FInv(S1,S2,HGuide);
+    Func.Set(d1, angle, Ch);
+    FInv.Set(d1, angle, Ch);
     
-      done = ComputeData(Data,HGuide,Spine,lin,S1,I1,S2,I2,Func,FInv,
-                        PFirst,MaxStep,Fleche,TolGuide,First,Last,
-                        Inside,Appro,Forward,Soldep,intf,intl,
-                        gd1,gd2,gf1,gf2,RecOnS1,RecOnS2);
-
-      if(!done) return Standard_False; // ratrappage possible PMN 14/05/1998
-      done = CompleteData(Data,Func,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
-      if(!done) throw Standard_Failure("PerformSurf : Fail of approximation!");
-    }
-    else {
-      Standard_Real Rtemp;
-      BRepBlend_ChAsym  Func(S2, S1, HGuide);
-      BRepBlend_ChAsymInv FInv(S2, S1,HGuide);
-      Func.Set(d1, angle, Ch);
-      FInv.Set(d1, angle, Ch);
-
-      Rtemp     = Soldep(1);
-      Soldep(1) = Soldep(3);
-      Soldep(3) = Rtemp;
-      Rtemp     = Soldep(2);
-      Soldep(2) = Soldep(4);
-      Soldep(4) = Rtemp;
-
-      TopAbs_Orientation Or2 = S2->ChangeSurface().Face().Orientation();
-
-      done = ComputeData(Data,HGuide,Spine,lin,S2,I2,S1,I1,Func,FInv,
-                        PFirst,MaxStep,Fleche,TolGuide,First,Last,
-                        Inside,Appro,Forward,Soldep,intf,intl,
-                        gd2,gd1,gf2,gf1,RecOnS2,RecOnS1);
-
-      ChFiDS_CommonPoint tmp = Data->VertexFirstOnS1();
-      Data->ChangeVertexFirstOnS1() = Data->VertexFirstOnS2();
-      Data->ChangeVertexFirstOnS2() = tmp;
-      tmp = Data->VertexLastOnS1();
-      Data->ChangeVertexLastOnS1() = Data->VertexLastOnS2();
-      Data->ChangeVertexLastOnS2() = tmp;
-      if(!done) return Standard_False; // ratrappage possible PMN 14/05/1998
-      done = CompleteData(Data,Func,lin,S1,S2,Or2,gd1,gd2,gf1,gf2, Standard_True);
-      if(!done) throw Standard_Failure("PerformSurf : Fail of approximation!");
-    }      
-
+    done = ComputeData(Data,HGuide,Spine,lin,S1,I1,S2,I2,Func,FInv,
+                       PFirst,MaxStep,Fleche,TolGuide,First,Last,
+                       Inside,Appro,Forward,Soldep,intf,intl,
+                       gd1,gd2,gf1,gf2,RecOnS1,RecOnS2);
+    
+    if(!done) return Standard_False; // ratrappage possible PMN 14/05/1998
+    done = CompleteData(Data,Func,lin,S1,S2,Or,gd1,gd2,gf1,gf2);
+    if(!done) throw Standard_Failure("PerformSurf : Fail of approximation!");
   }
+  
   return Standard_True;
 }
+
 void  ChFi3d_ChBuilder::PerformSurf(ChFiDS_SequenceOfSurfData&          ,
                                  const Handle(ChFiDS_HElSpine)&      , 
                                  const Handle(ChFiDS_Spine)&         , 
@@ -1946,8 +1844,6 @@ void ChFi3d_ChBuilder::ExtentTwoCorner(const TopoDS_Vertex&        V,
   Standard_Integer j;
   TopoDS_Face F[4];
   Standard_Real tmpang, tmd;
-  Standard_Boolean disonF1;
-
 
   for (i=0, j=0; i<2; i++, j += 2) {
     chsp[i] = Handle(ChFiDS_ChamfSpine)::DownCast(Spine[i]);
@@ -1961,17 +1857,10 @@ void ChFi3d_ChBuilder::ExtentTwoCorner(const TopoDS_Vertex&        V,
       chsp[i]->Dists(d[j],d[j+1]); 
     }
     else {
-      chsp[i]->GetDistAngle(tmd, tmpang, disonF1);
+      chsp[i]->GetDistAngle(tmd, tmpang);
       // an approximate calculation of distance 2 is done
-      if (disonF1) {
-       d[j]   = tmd;
-       d[j+1] = tmd * tan(tmpang); 
-      }
-      else
-      {
-       d[j]   = tmd * tan(tmpang);
-       d[j+1] = tmd;
-      }
+      d[j]   = tmd;
+      d[j+1] = tmd * tan(tmpang); 
     }
 
   }
@@ -2066,7 +1955,6 @@ void ChFi3d_ChBuilder::ExtentThreeCorner(const TopoDS_Vertex& V,
   }
   
   Standard_Real d[3][2], tmd, tmpangle;
-  Standard_Boolean disonF1;
   Standard_Integer j;
   TopoDS_Face F[3][2];
 
@@ -2084,17 +1972,11 @@ void ChFi3d_ChBuilder::ExtentThreeCorner(const TopoDS_Vertex& V,
        chsp[i]->Dists(d[i][0],d[i][1]); 
     }
     else {
-      chsp[i]->GetDistAngle(tmd, tmpangle, disonF1);
+      chsp[i]->GetDistAngle(tmd, tmpangle);
       // an approximate calculation of distance 2 is done
 
-      if (disonF1) {
-       d[i][0] = tmd;
-       d[i][1] = tmd * tan(tmpangle); 
-      }
-      else {
-       d[i][0] = tmd * tan(tmpangle);
-       d[i][1] = tmd;
-      }     
+      d[i][0] = tmd;
+      d[i][1] = tmd * tan(tmpangle); 
     }
   }
 
@@ -2232,41 +2114,3 @@ void ChFi3d_ChBuilder::ConexFaces (const Handle(ChFiDS_Spine)&  Spine,
     F2 = f2;
   }
 }
-
-
-//=======================================================================
-//function : FindChoiceDistAngle
-//purpose  : F1, F2 connected to the edge so that F1 corresponds to distance
-//=======================================================================
-
-Standard_Integer ChFi3d_ChBuilder::FindChoiceDistAngle(const Standard_Integer Choice,
-                                                      const Standard_Boolean DisOnF1) const
-{
-  Standard_Integer ch = 0;  
-  if (!DisOnF1) {
-
-    switch (Choice) {
-      case 1 : ch = 2;
-               break;
-      case 2 : ch = 1;
-               break;
-      case 3 : ch = 8;
-               break;
-      case 4 : ch = 7;
-               break;
-      case 5 : ch = 6;
-               break;
-      case 6 : ch = 5;
-               break;
-      case 7 : ch = 4;
-               break;
-      case 8 : ch = 3;
-               break;
-    }
-
-  }
-  else
-    ch = Choice;
-  return ch;
-}
index c9662ac753d477c05df8d1a285cca7f232379587..c358c0c62b1b8ad489400bf86133a13055ca6f72 100644 (file)
@@ -26,6 +26,7 @@
 #include <Standard_Integer.hxx>
 #include <Standard_Boolean.hxx>
 #include <ChFiDS_ChamfMethod.hxx>
+#include <ChFiDS_ChamfMode.hxx>
 #include <ChFiDS_SecHArray1.hxx>
 #include <math_Vector.hxx>
 #include <TopAbs_Orientation.hxx>
@@ -70,13 +71,15 @@ public:
   //! (the next are found by propagation ), and  the
   //! distance <Dis>
   //! if the edge <E> has more than 2 adjacent faces
-  Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E, const TopoDS_Face& F);
+  Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E);
   
   //! set the distance <Dis> of the fillet
   //! contour of index <IC> in the DS with <Dis> on <F>.
   //! if the face <F> is not one of common faces
   //! of an edge of the contour <IC>
-  Standard_EXPORT void SetDist (const Standard_Real Dis, const Standard_Integer IC, const TopoDS_Face& F);
+  Standard_EXPORT void SetDist (const Standard_Real Dis,
+                                const Standard_Integer IC,
+                                const TopoDS_Face& F);
   
   //! gives the distances <Dis> of the fillet
   //! contour of index <IC> in the DS
@@ -86,37 +89,59 @@ public:
   //! (the next are found by propagation ), and  the
   //! distance <Dis1> and <Dis2>
   //! if the edge <E> has more than 2 adjacent faces
-  Standard_EXPORT void Add (const Standard_Real Dis1, const Standard_Real Dis2, const TopoDS_Edge& E, const TopoDS_Face& F);
+  Standard_EXPORT void Add (const Standard_Real Dis1,
+                            const Standard_Real Dis2,
+                            const TopoDS_Edge& E,
+                            const TopoDS_Face& F);
   
   //! set the distances <Dis1> and <Dis2> of the fillet
   //! contour of index <IC> in the DS with <Dis1> on <F>.
   //! if the face <F> is not one of common faces
   //! of an edge of the contour <IC>
-  Standard_EXPORT void SetDists (const Standard_Real Dis1, const Standard_Real Dis2, const Standard_Integer IC, const TopoDS_Face& F);
+  Standard_EXPORT void SetDists (const Standard_Real Dis1,
+                                 const Standard_Real Dis2,
+                                 const Standard_Integer IC,
+                                 const TopoDS_Face& F);
   
   //! gives the distances <Dis1> and <Dis2> of the fillet
   //! contour of index <IC> in the DS
-  Standard_EXPORT void Dists (const Standard_Integer IC, Standard_Real& Dis1, Standard_Real& Dis2) const;
+  Standard_EXPORT void Dists (const Standard_Integer IC,
+                              Standard_Real& Dis1,
+                              Standard_Real& Dis2) const;
   
   //! initializes a new contour with the edge <E> as first
   //! (the next are found by propagation ), and  the
   //! distance <Dis1> and <Angle>
   //! if the edge <E> has more than 2 adjacent faces
-  Standard_EXPORT void AddDA (const Standard_Real Dis, const Standard_Real Angle, const TopoDS_Edge& E, const TopoDS_Face& F);
+  Standard_EXPORT void AddDA (const Standard_Real Dis,
+                              const Standard_Real Angle,
+                              const TopoDS_Edge& E,
+                              const TopoDS_Face& F);
   
   //! set the distance <Dis> and <Angle> of the fillet
   //! contour of index <IC> in the DS with <Dis> on <F>.
   //! if the face <F> is not one of common faces
   //! of an edge of the contour <IC>
-  Standard_EXPORT void SetDistAngle (const Standard_Real Dis, const Standard_Real Angle, const Standard_Integer IC, const TopoDS_Face& F);
+  Standard_EXPORT void SetDistAngle (const Standard_Real Dis,
+                                     const Standard_Real Angle,
+                                     const Standard_Integer IC,
+                                     const TopoDS_Face& F);
   
   //! gives the distances <Dis> and <Angle> of the fillet
   //! contour of index <IC> in the DS
-  Standard_EXPORT void GetDistAngle (const Standard_Integer IC, Standard_Real& Dis, Standard_Real& Angle, Standard_Boolean& DisOnFace1) const;
+  Standard_EXPORT void GetDistAngle (const Standard_Integer IC,
+                                     Standard_Real& Dis,
+                                     Standard_Real& Angle) const;
+  
+  //! set the mode of shamfer
+  Standard_EXPORT void SetMode (const ChFiDS_ChamfMode theMode);
   
   //! renvoi la methode des chanfreins utilisee
   Standard_EXPORT ChFiDS_ChamfMethod IsChamfer (const Standard_Integer IC) const;
   
+  //! returns the mode of chamfer used
+  Standard_EXPORT ChFiDS_ChamfMode Mode () const;
+  
   //! Reset tous rayons du contour IC.
   Standard_EXPORT void ResetContour (const Standard_Integer IC);
   
@@ -124,36 +149,208 @@ public:
   
   Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const;
   
-  Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC, const Standard_Integer IS) const;
-  
-  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const TopAbs_Orientation Or2, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep) Standard_OVERRIDE;
-  
-  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep) Standard_OVERRIDE;
-  
-  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const TopAbs_Orientation Or2, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP1, const Standard_Boolean RecRst1, const Standard_Boolean RecP2, const Standard_Boolean RecRst2, const math_Vector& Soldep) Standard_OVERRIDE;
+  Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC,
+                                                  const Standard_Integer IS) const;
+  
+  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
+                                          const Handle(ChFiDS_HElSpine)& Guide,
+                                          const Handle(ChFiDS_Spine)& Spine,
+                                          const Standard_Integer Choix,
+                                          const Handle(BRepAdaptor_HSurface)& S1,
+                                          const Handle(Adaptor3d_TopolTool)& I1,
+                                          const Handle(BRepAdaptor_HCurve2d)& PC1,
+                                          const Handle(BRepAdaptor_HSurface)& Sref1,
+                                          const Handle(BRepAdaptor_HCurve2d)& PCref1,
+                                          Standard_Boolean& Decroch1,
+                                          const Handle(BRepAdaptor_HSurface)& S2,
+                                          const Handle(Adaptor3d_TopolTool)& I2,
+                                          const TopAbs_Orientation Or2,
+                                          const Standard_Real Fleche,
+                                          const Standard_Real TolGuide,
+                                          Standard_Real& First,
+                                          Standard_Real& Last,
+                                          const Standard_Boolean Inside,
+                                          const Standard_Boolean Appro,
+                                          const Standard_Boolean Forward,
+                                          const Standard_Boolean RecP,
+                                          const Standard_Boolean RecS,
+                                          const Standard_Boolean RecRst,
+                                          const math_Vector& Soldep) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
+                                          const Handle(ChFiDS_HElSpine)& Guide,
+                                          const Handle(ChFiDS_Spine)& Spine,
+                                          const Standard_Integer Choix,
+                                          const Handle(BRepAdaptor_HSurface)& S1,
+                                          const Handle(Adaptor3d_TopolTool)& I1,
+                                          const TopAbs_Orientation Or1,
+                                          const Handle(BRepAdaptor_HSurface)& S2,
+                                          const Handle(Adaptor3d_TopolTool)& I2,
+                                          const Handle(BRepAdaptor_HCurve2d)& PC2,
+                                          const Handle(BRepAdaptor_HSurface)& Sref2,
+                                          const Handle(BRepAdaptor_HCurve2d)& PCref2,
+                                          Standard_Boolean& Decroch2,
+                                          const Standard_Real Fleche,
+                                          const Standard_Real TolGuide,
+                                          Standard_Real& First,
+                                          Standard_Real& Last,
+                                          const Standard_Boolean Inside,
+                                          const Standard_Boolean Appro,
+                                          const Standard_Boolean Forward,
+                                          const Standard_Boolean RecP,
+                                          const Standard_Boolean RecS,
+                                          const Standard_Boolean RecRst,
+                                          const math_Vector& Soldep) Standard_OVERRIDE;
+  
+  Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
+                                          const Handle(ChFiDS_HElSpine)& Guide,
+                                          const Handle(ChFiDS_Spine)& Spine,
+                                          const Standard_Integer Choix,
+                                          const Handle(BRepAdaptor_HSurface)& S1,
+                                          const Handle(Adaptor3d_TopolTool)& I1,
+                                          const Handle(BRepAdaptor_HCurve2d)& PC1,
+                                          const Handle(BRepAdaptor_HSurface)& Sref1,
+                                          const Handle(BRepAdaptor_HCurve2d)& PCref1,
+                                          Standard_Boolean& Decroch1,
+                                          const TopAbs_Orientation Or1,
+                                          const Handle(BRepAdaptor_HSurface)& S2,
+                                          const Handle(Adaptor3d_TopolTool)& I2,
+                                          const Handle(BRepAdaptor_HCurve2d)& PC2,
+                                          const Handle(BRepAdaptor_HSurface)& Sref2,
+                                          const Handle(BRepAdaptor_HCurve2d)& PCref2,
+                                          Standard_Boolean& Decroch2,
+                                          const TopAbs_Orientation Or2,
+                                          const Standard_Real Fleche,
+                                          const Standard_Real TolGuide,
+                                          Standard_Real& First,
+                                          Standard_Real& Last,
+                                          const Standard_Boolean Inside,
+                                          const Standard_Boolean Appro,
+                                          const Standard_Boolean Forward,
+                                          const Standard_Boolean RecP1,
+                                          const Standard_Boolean RecRst1,
+                                          const Standard_Boolean RecP2,
+                                          const Standard_Boolean RecRst2,
+                                          const math_Vector& Soldep) Standard_OVERRIDE;
   
   //! Methode, implemented in inheritants, calculates
   //! the elements of construction of  the surface (fillet
   //! or chamfer).
-  Standard_EXPORT virtual Standard_Boolean PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, const math_Vector& Soldep, Standard_Integer& Intf, Standard_Integer& Intl) Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_Boolean PerformSurf (ChFiDS_SequenceOfSurfData& Data,
+                                                        const Handle(ChFiDS_HElSpine)& Guide,
+                                                        const Handle(ChFiDS_Spine)& Spine,
+                                                        const Standard_Integer Choix,
+                                                        const Handle(BRepAdaptor_HSurface)& S1,
+                                                        const Handle(Adaptor3d_TopolTool)& I1,
+                                                        const Handle(BRepAdaptor_HSurface)& S2,
+                                                        const Handle(Adaptor3d_TopolTool)& I2,
+                                                        const Standard_Real MaxStep,
+                                                        const Standard_Real Fleche,
+                                                        const Standard_Real TolGuide,
+                                                        Standard_Real& First,
+                                                        Standard_Real& Last,
+                                                        const Standard_Boolean Inside,
+                                                        const Standard_Boolean Appro,
+                                                        const Standard_Boolean Forward,
+                                                        const Standard_Boolean RecOnS1,
+                                                        const Standard_Boolean RecOnS2,
+                                                        const math_Vector& Soldep,
+                                                        Standard_Integer& Intf,
+                                                        Standard_Integer& Intl) Standard_OVERRIDE;
   
   //! Method, implemented in  the inheritants, calculates
   //! the elements of construction of  the surface (fillet
   //! or chamfer) contact edge/face.
-  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const TopAbs_Orientation Or2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep) Standard_OVERRIDE;
+  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
+                                            const Handle(ChFiDS_HElSpine)& Guide,
+                                            const Handle(ChFiDS_Spine)& Spine,
+                                            const Standard_Integer Choix,
+                                            const Handle(BRepAdaptor_HSurface)& S1,
+                                            const Handle(Adaptor3d_TopolTool)& I1,
+                                            const Handle(BRepAdaptor_HCurve2d)& PC1,
+                                            const Handle(BRepAdaptor_HSurface)& Sref1,
+                                            const Handle(BRepAdaptor_HCurve2d)& PCref1,
+                                            Standard_Boolean& Decroch1,
+                                            const Handle(BRepAdaptor_HSurface)& S2,
+                                            const Handle(Adaptor3d_TopolTool)& I2,
+                                            const TopAbs_Orientation Or2,
+                                            const Standard_Real MaxStep,
+                                            const Standard_Real Fleche,
+                                            const Standard_Real TolGuide,
+                                            Standard_Real& First,
+                                            Standard_Real& Last,
+                                            const Standard_Boolean Inside,
+                                            const Standard_Boolean Appro,
+                                            const Standard_Boolean Forward,
+                                            const Standard_Boolean RecP,
+                                            const Standard_Boolean RecS,
+                                            const Standard_Boolean RecRst,
+                                            const math_Vector& Soldep) Standard_OVERRIDE;
   
   //! Method, implemented in inheritants, calculates
   //! the elements of construction of  the surface (fillet
   //! or chamfer) contact edge/face.
-  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP, const Standard_Boolean RecS, const Standard_Boolean RecRst, const math_Vector& Soldep) Standard_OVERRIDE;
+  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
+                                            const Handle(ChFiDS_HElSpine)& Guide,
+                                            const Handle(ChFiDS_Spine)& Spine,
+                                            const Standard_Integer Choix,
+                                            const Handle(BRepAdaptor_HSurface)& S1,
+                                            const Handle(Adaptor3d_TopolTool)& I1,
+                                            const TopAbs_Orientation Or1,
+                                            const Handle(BRepAdaptor_HSurface)& S2,
+                                            const Handle(Adaptor3d_TopolTool)& I2,
+                                            const Handle(BRepAdaptor_HCurve2d)& PC2,
+                                            const Handle(BRepAdaptor_HSurface)& Sref2,
+                                            const Handle(BRepAdaptor_HCurve2d)& PCref2,
+                                            Standard_Boolean& Decroch2,
+                                            const Standard_Real MaxStep,
+                                            const Standard_Real Fleche,
+                                            const Standard_Real TolGuide,
+                                            Standard_Real& First,
+                                            Standard_Real& Last,
+                                            const Standard_Boolean Inside,
+                                            const Standard_Boolean Appro,
+                                            const Standard_Boolean Forward,
+                                            const Standard_Boolean RecP,
+                                            const Standard_Boolean RecS,
+                                            const Standard_Boolean RecRst,
+                                            const math_Vector& Soldep) Standard_OVERRIDE;
   
   //! Method, implemented in  inheritants, calculates
   //! the elements of construction of  the surface (fillet
   //! or chamfer) contact edge/edge.
-  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HCurve2d)& PC1, const Handle(BRepAdaptor_HSurface)& Sref1, const Handle(BRepAdaptor_HCurve2d)& PCref1, Standard_Boolean& Decroch1, const TopAbs_Orientation Or1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Handle(BRepAdaptor_HCurve2d)& PC2, const Handle(BRepAdaptor_HSurface)& Sref2, const Handle(BRepAdaptor_HCurve2d)& PCref2, Standard_Boolean& Decroch2, const TopAbs_Orientation Or2, const Standard_Real MaxStep, const Standard_Real Fleche, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecP1, const Standard_Boolean RecRst1, const Standard_Boolean RecP2, const Standard_Boolean RecRst2, const math_Vector& Soldep) Standard_OVERRIDE;
+  Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
+                                            const Handle(ChFiDS_HElSpine)& Guide,
+                                            const Handle(ChFiDS_Spine)& Spine,
+                                            const Standard_Integer Choix,
+                                            const Handle(BRepAdaptor_HSurface)& S1,
+                                            const Handle(Adaptor3d_TopolTool)& I1,
+                                            const Handle(BRepAdaptor_HCurve2d)& PC1,
+                                            const Handle(BRepAdaptor_HSurface)& Sref1,
+                                            const Handle(BRepAdaptor_HCurve2d)& PCref1,
+                                            Standard_Boolean& Decroch1,
+                                            const TopAbs_Orientation Or1,
+                                            const Handle(BRepAdaptor_HSurface)& S2,
+                                            const Handle(Adaptor3d_TopolTool)& I2,
+                                            const Handle(BRepAdaptor_HCurve2d)& PC2,
+                                            const Handle(BRepAdaptor_HSurface)& Sref2,
+                                            const Handle(BRepAdaptor_HCurve2d)& PCref2,
+                                            Standard_Boolean& Decroch2,
+                                            const TopAbs_Orientation Or2,
+                                            const Standard_Real MaxStep,
+                                            const Standard_Real Fleche,
+                                            const Standard_Real TolGuide,
+                                            Standard_Real& First,
+                                            Standard_Real& Last,
+                                            const Standard_Boolean Inside,
+                                            const Standard_Boolean Appro,
+                                            const Standard_Boolean Forward,
+                                            const Standard_Boolean RecP1,
+                                            const Standard_Boolean RecRst1,
+                                            const Standard_Boolean RecP2,
+                                            const Standard_Boolean RecRst2,
+                                            const math_Vector& Soldep) Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Integer FindChoiceDistAngle (const Standard_Integer Choice, const Standard_Boolean DisOnF1) const;
-
 
 
 
@@ -162,9 +359,37 @@ protected:
   
   Standard_EXPORT void SimulKPart (const Handle(ChFiDS_SurfData)& SD) const Standard_OVERRIDE;
   
-  Standard_EXPORT Standard_Boolean SimulSurf (Handle(ChFiDS_SurfData)& Data, const Handle(ChFiDS_HElSpine)& Guide, const Handle(ChFiDS_Spine)& Spine, const Standard_Integer Choix, const Handle(BRepAdaptor_HSurface)& S1, const Handle(Adaptor3d_TopolTool)& I1, const Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real TolGuide, Standard_Real& First, Standard_Real& Last, const Standard_Boolean Inside, const Standard_Boolean Appro, const Standard_Boolean Forward, const Standard_Boolean RecOnS1, const Standard_Boolean RecOnS2, const math_Vector& Soldep, Standard_Integer& Intf, Standard_Integer& Intl) Standard_OVERRIDE;
-  
-  Standard_EXPORT Standard_Boolean PerformFirstSection (const Handle(ChFiDS_Spine)& S, const Handle(ChFiDS_HElSpine)& HGuide, const Standard_Integer Choix, Handle(BRepAdaptor_HSurface)& S1, Handle(BRepAdaptor_HSurface)& S2, const Handle(Adaptor3d_TopolTool)& I1, const Handle(Adaptor3d_TopolTool)& I2, const Standard_Real Par, math_Vector& SolDep, TopAbs_State& Pos1, TopAbs_State& Pos2) const Standard_OVERRIDE;
+  Standard_EXPORT Standard_Boolean SimulSurf (Handle(ChFiDS_SurfData)& Data,
+                                              const Handle(ChFiDS_HElSpine)& Guide,
+                                              const Handle(ChFiDS_Spine)& Spine,
+                                              const Standard_Integer Choix,
+                                              const Handle(BRepAdaptor_HSurface)& S1,
+                                              const Handle(Adaptor3d_TopolTool)& I1,
+                                              const Handle(BRepAdaptor_HSurface)& S2,
+                                              const Handle(Adaptor3d_TopolTool)& I2,
+                                              const Standard_Real TolGuide,
+                                              Standard_Real& First,
+                                              Standard_Real& Last,
+                                              const Standard_Boolean Inside,
+                                              const Standard_Boolean Appro,
+                                              const Standard_Boolean Forward,
+                                              const Standard_Boolean RecOnS1,
+                                              const Standard_Boolean RecOnS2,
+                                              const math_Vector& Soldep,
+                                              Standard_Integer& Intf,
+                                              Standard_Integer& Intl) Standard_OVERRIDE;
+  
+  Standard_EXPORT Standard_Boolean PerformFirstSection (const Handle(ChFiDS_Spine)& S,
+                                                        const Handle(ChFiDS_HElSpine)& HGuide,
+                                                        const Standard_Integer Choix,
+                                                        Handle(BRepAdaptor_HSurface)& S1,
+                                                        Handle(BRepAdaptor_HSurface)& S2,
+                                                        const Handle(Adaptor3d_TopolTool)& I1,
+                                                        const Handle(Adaptor3d_TopolTool)& I2,
+                                                        const Standard_Real Par,
+                                                        math_Vector& SolDep,
+                                                        TopAbs_State& Pos1,
+                                                        TopAbs_State& Pos2) const Standard_OVERRIDE;
   
   //! computes  the  intersection of two chamfers on
   //! the vertex of index <Index> in myVDataMap.
@@ -176,15 +401,18 @@ protected:
   
   //! extends  the spine  of  the Stripe  <S> at  the
   //! extremity of the vertex <V>.
-  Standard_EXPORT void ExtentOneCorner (const TopoDS_Vertex& V, const Handle(ChFiDS_Stripe)& S) Standard_OVERRIDE;
+  Standard_EXPORT void ExtentOneCorner (const TopoDS_Vertex& V,
+                                        const Handle(ChFiDS_Stripe)& S) Standard_OVERRIDE;
   
   //! extends the spine of the 2 stripes of <LS> at the
   //! extremity of the vertex <V>
-  Standard_EXPORT void ExtentTwoCorner (const TopoDS_Vertex& V, const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
+  Standard_EXPORT void ExtentTwoCorner (const TopoDS_Vertex& V,
+                                        const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
   
   //! extends the spine of the 2 stripes of <LS> at the
   //! extremity of the vertex <V>
-  Standard_EXPORT void ExtentThreeCorner (const TopoDS_Vertex& V, const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
+  Standard_EXPORT void ExtentThreeCorner (const TopoDS_Vertex& V,
+                                          const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
   
   //! set the regularities
   Standard_EXPORT void SetRegul() Standard_OVERRIDE;
@@ -195,9 +423,12 @@ protected:
 private:
 
   
-  Standard_EXPORT void ConexFaces (const Handle(ChFiDS_Spine)& Sp, const Standard_Integer IEdge, TopoDS_Face& F1, TopoDS_Face& F2) const;
-
+  Standard_EXPORT void ConexFaces (const Handle(ChFiDS_Spine)& Sp,
+                                   const Standard_Integer IEdge,
+                                   TopoDS_Face& F1,
+                                   TopoDS_Face& F2) const;
 
+  ChFiDS_ChamfMode   myMode;
 
 
 };
index 675cdef1c97ae4c035843c478f8be1a16cfbe93d..af981b46cbb7d16b0549548fea7f118da5f1a4f0 100644 (file)
@@ -199,6 +199,8 @@ ChFi3d_FilletShape ChFi3d_FilBuilder::GetFilletShape() const
 
 void  ChFi3d_FilBuilder::Add(const TopoDS_Edge& E)
 {
+  TopoDS_Face dummy;
+  
   if(!Contains(E) && myEFMap.Contains(E)){
     Handle(ChFiDS_Stripe) Stripe = new ChFiDS_Stripe();
     Handle(ChFiDS_Spine)& Sp = Stripe->ChangeSpine();
@@ -208,7 +210,7 @@ void  ChFi3d_FilBuilder::Add(const TopoDS_Edge& E)
     TopoDS_Edge E_wnt = E;
     E_wnt.Orientation(TopAbs_FORWARD);
     Spine->SetEdges(E_wnt);
-    if(PerformElement(Spine)){
+    if(PerformElement(Spine, -1, dummy)){
       PerformExtremity(Spine);
       Spine->Load();
       myListStripe.Append(Stripe);
@@ -631,6 +633,8 @@ ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)&            Data,
   Handle(ChFiDS_SecHArray1) sec;
   gp_Pnt2d pf1,pl1,pf2,pl2;
 
+  Handle(ChFiDS_HElSpine) EmptyHGuide;
+
   Standard_Real PFirst = First;
   if(intf) First = fsp->FirstParameter(1);
   if(intl) Last = fsp->LastParameter(fsp->NbEdges());
@@ -640,7 +644,7 @@ ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)&            Data,
     Func.Set(fsp->Radius(),Choix);
     FInv.Set(fsp->Radius(),Choix);
     Func.Set(myShape);
-    done = SimulData(Data,HGuide,lin,S1,I1 ,
+    done = SimulData(Data,HGuide,EmptyHGuide,lin,S1,I1 ,
                     S2,I2,Func,FInv,PFirst,MaxStep,locfleche,
                     TolGuide,First,Last,Inside,Appro,Forward,
                     Soldep,4,RecOnS1,RecOnS2);
@@ -667,7 +671,7 @@ ChFi3d_FilBuilder::SimulSurf(Handle(ChFiDS_SurfData)&            Data,
     Func.Set(Choix);
     FInv.Set(Choix);
     Func.Set(myShape);
-    done = SimulData(Data,HGuide,lin,S1,I1 ,
+    done = SimulData(Data,HGuide,EmptyHGuide,lin,S1,I1 ,
                     S2,I2,Func,FInv,PFirst,MaxStep,locfleche,
                     TolGuide,First,Last,Inside,Appro,Forward,
                     Soldep,4,RecOnS1,RecOnS2);
diff --git a/src/ChFiDS/ChFiDS_ChamfMode.hxx b/src/ChFiDS/ChFiDS_ChamfMode.hxx
new file mode 100644 (file)
index 0000000..5269fca
--- /dev/null
@@ -0,0 +1,37 @@
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _ChFiDS_ChamfMode_HeaderFile
+#define _ChFiDS_ChamfMode_HeaderFile
+
+//! this enumeration defines several modes of chamfer
+enum ChFiDS_ChamfMode
+{
+  //! chamfer with constant distance from spine to one of the two surfaces
+  ChFiDS_ClassicChamfer,
+  
+  //! symmetric chamfer with constant throat
+  //! that is the height of isosceles triangle in section
+  ChFiDS_ConstThroatChamfer,
+  
+  //! chamfer with constant throat: the section of chamfer is right-angled triangle,
+  //! the first of two surfaces (where is the top of the chamfer)
+  //! is virtually moved inside the solid by offset operation,
+  //! the apex of the section is on the intersection curve between moved surface and second surface,
+  //! right angle is at the top of the chamfer,
+  //! the length of the leg from apex to top is constant - it is throat
+  ChFiDS_ConstThroatWithPenetrationChamfer
+};
+
+#endif // _ChFiDS_ChamfMode_HeaderFile
index 4cb49e9b099651afc32d119f8362ff5080723fb4..b948efa4786f87f461746d2f93c1dc133c4af9dd 100644 (file)
@@ -25,12 +25,16 @@ IMPLEMENT_STANDARD_RTTIEXT(ChFiDS_ChamfSpine,ChFiDS_Spine)
 //function : ChFiDS_ChamfSpine
 //purpose  : 
 //=======================================================================
-ChFiDS_ChamfSpine::ChFiDS_ChamfSpine(){}
+ChFiDS_ChamfSpine::ChFiDS_ChamfSpine()
+{
+  myMode = ChFiDS_ClassicChamfer;
+}
 
 ChFiDS_ChamfSpine::ChFiDS_ChamfSpine(const Standard_Real Tol):
 ChFiDS_Spine(Tol)
-{}
-
+{
+  myMode = ChFiDS_ClassicChamfer;
+}
 
 //=======================================================================
 //function : GetDist
@@ -92,13 +96,14 @@ void ChFiDS_ChamfSpine::SetDists(const Standard_Real Dis1,
 //=======================================================================
 
 void ChFiDS_ChamfSpine::GetDistAngle(Standard_Real& Dis,
-                                    Standard_Real& Angle,
-                                    Standard_Boolean& DisOnF1)const
+                                    Standard_Real& Angle) const
+//Standard_Boolean& DisOnF1)const
 {
-  if (mChamf != ChFiDS_DistAngle)  throw Standard_Failure("Chamfer is not a Two Dists Chamfer");
+  if (mChamf != ChFiDS_DistAngle)
+    throw Standard_Failure("Chamfer is not a Two Dists Chamfer");
   Dis     = d1;
   Angle   = angle;
-  DisOnF1 = dison1;
+  //DisOnF1 = dison1;
 }
 
 //=======================================================================
@@ -107,16 +112,25 @@ void ChFiDS_ChamfSpine::GetDistAngle(Standard_Real& Dis,
 //=======================================================================
 
 void ChFiDS_ChamfSpine::SetDistAngle(const Standard_Real Dis,
-                                    const Standard_Real Angle,
-                                    const Standard_Boolean DisOnF1)
+                                    const Standard_Real Angle)
+//const Standard_Boolean DisOnF1)
 {
   //isconstant->Init(Standard_True);
   mChamf = ChFiDS_DistAngle;
   d1     = Dis;
   angle  = Angle;
-  dison1 = DisOnF1;
+  //dison1 = DisOnF1;
 }
 
+//=======================================================================
+//function : SetMode
+//purpose  : 
+//=======================================================================
+
+void ChFiDS_ChamfSpine::SetMode(const ChFiDS_ChamfMode theMode)
+{
+  myMode = theMode;
+}
 
 //=======================================================================
 //function : IsChamfer
@@ -128,6 +142,3 @@ ChFiDS_ChamfMethod  ChFiDS_ChamfSpine::IsChamfer() const
 
   return mChamf;
 }
-
-
-
index c668e0a852a52dac06a31daac334877ea9879f52..be957da658cb9ef1dad718ab6d18c8c3293c6858 100644 (file)
@@ -23,6 +23,7 @@
 #include <Standard_Real.hxx>
 #include <Standard_Boolean.hxx>
 #include <ChFiDS_ChamfMethod.hxx>
+#include <ChFiDS_ChamfMode.hxx>
 #include <ChFiDS_Spine.hxx>
 
 
@@ -49,13 +50,17 @@ public:
   
   Standard_EXPORT void Dists (Standard_Real& Dis1, Standard_Real& Dis2) const;
   
-  Standard_EXPORT void GetDistAngle (Standard_Real& Dis, Standard_Real& Angle, Standard_Boolean& DisOnF1) const;
+  Standard_EXPORT void GetDistAngle (Standard_Real& Dis, Standard_Real& Angle) const;
   
-  Standard_EXPORT void SetDistAngle (const Standard_Real Dis, const Standard_Real Angle, const Standard_Boolean DisOnF1);
+  Standard_EXPORT void SetDistAngle (const Standard_Real Dis, const Standard_Real Angle);
+  
+  Standard_EXPORT void SetMode (const ChFiDS_ChamfMode theMode);
   
   //! Return the method of chamfers used
   Standard_EXPORT ChFiDS_ChamfMethod IsChamfer() const;
 
+  //! Return the mode of chamfers used
+  //Standard_EXPORT ChFiDS_ChamfMode Mode() const;
 
 
 
@@ -71,7 +76,7 @@ private:
 
   Standard_Real d1;
   Standard_Real d2;
-  Standard_Boolean dison1;
+  //Standard_Boolean dison1;
   Standard_Real angle;
   ChFiDS_ChamfMethod mChamf;
 
index b77b83288c5ed4aef2d0303756645292c2062cb2..9d6ef4aa03106c0f24cde0caa47955b1d349f439 100644 (file)
@@ -40,29 +40,35 @@ IMPLEMENT_STANDARD_RTTIEXT(ChFiDS_Spine,Standard_Transient)
 //function : ChFiDS_Spine
 //purpose  : 
 //=======================================================================
-ChFiDS_Spine::ChFiDS_Spine():
-       splitdone(Standard_False),
-       tolesp(Precision::Confusion()),
-       firstprolon(Standard_False), 
-       lastprolon(Standard_False),
-       firstistgt(Standard_False), 
-       lastistgt(Standard_False),
-       hasfirsttgt(Standard_False), 
-       haslasttgt(Standard_False),
-       hasref(Standard_False)
+ChFiDS_Spine::ChFiDS_Spine()
+: splitdone(Standard_False),
+  myMode(ChFiDS_ClassicChamfer),
+  tolesp(Precision::Confusion()),
+  firstprolon(Standard_False), 
+  lastprolon(Standard_False),
+  firstistgt(Standard_False), 
+  lastistgt(Standard_False),
+  hasfirsttgt(Standard_False), 
+  haslasttgt(Standard_False),
+  hasref(Standard_False)
 {
 }
 
-ChFiDS_Spine::ChFiDS_Spine(const Standard_Real Tol):
-       splitdone(Standard_False),
-       tolesp(Tol),
-       firstprolon(Standard_False), 
-       lastprolon(Standard_False),
-       firstistgt(Standard_False), 
-       lastistgt(Standard_False),
-       hasfirsttgt(Standard_False), 
-       haslasttgt(Standard_False),
-       hasref(Standard_False)
+//=======================================================================
+//function : ChFiDS_Spine
+//purpose  : 
+//=======================================================================
+ChFiDS_Spine::ChFiDS_Spine(const Standard_Real Tol)
+  : splitdone(Standard_False),
+    myMode(ChFiDS_ClassicChamfer),
+    tolesp(Tol),
+    firstprolon(Standard_False), 
+    lastprolon(Standard_False),
+    firstistgt(Standard_False), 
+    lastistgt(Standard_False),
+    hasfirsttgt(Standard_False), 
+    haslasttgt(Standard_False),
+    hasref(Standard_False)
 {
 }
 
@@ -76,6 +82,16 @@ void ChFiDS_Spine::AppendElSpine(const Handle(ChFiDS_HElSpine)& Els)
   elspines.Append(Els);
 }
 
+//=======================================================================
+//function : AppendOffsetElSpine
+//purpose  : 
+//=======================================================================
+
+void ChFiDS_Spine::AppendOffsetElSpine(const Handle(ChFiDS_HElSpine)& Els)
+{
+  offset_elspines.Append(Els);
+}
+
 //=======================================================================
 //function : ElSpine
 //purpose  : 
@@ -120,6 +136,16 @@ ChFiDS_ListOfHElSpine& ChFiDS_Spine::ChangeElSpines()
   return elspines;
 }
 
+//=======================================================================
+//function : ChangeOffsetElSpines
+//purpose  : 
+//=======================================================================
+
+ChFiDS_ListOfHElSpine& ChFiDS_Spine::ChangeOffsetElSpines() 
+{
+  return offset_elspines;
+}
+
 //=======================================================================
 //function : SplitDone
 //purpose  : 
index a6d438407271a6db28bb29bdce69154f70b3594c..7f37ed56d9d266dfca1480200378f44a212dd5b4 100644 (file)
@@ -33,6 +33,7 @@
 #include <ChFiDS_ErrorStatus.hxx>
 #include <Standard_Transient.hxx>
 #include <GeomAbs_CurveType.hxx>
+#include <ChFiDS_ChamfMode.hxx>
 class TopoDS_Edge;
 class ChFiDS_HElSpine;
 class gp_Lin;
@@ -83,13 +84,21 @@ public:
   //! store edges composing the guideline
     void SetEdges (const TopoDS_Edge& E);
   
+  //! store offset edges composing the offset guideline
+    void SetOffsetEdges (const TopoDS_Edge& E);
+  
   //! store the edge at the first position before all others
     void PutInFirst (const TopoDS_Edge& E);
   
+  //! store the offset edge at the first position before all others
+    void PutInFirstOffset (const TopoDS_Edge& E);
+  
     Standard_Integer NbEdges() const;
   
     const TopoDS_Edge& Edges (const Standard_Integer I) const;
   
+    const TopoDS_Edge& OffsetEdges (const Standard_Integer I) const;
+  
   //! stores if the start of a set of edges starts on a
   //! section of free border or forms  a closed contour
     void SetFirstStatus (const ChFiDS_State S);
@@ -100,6 +109,8 @@ public:
   
   Standard_EXPORT virtual void AppendElSpine (const Handle(ChFiDS_HElSpine)& Els);
   
+  Standard_EXPORT virtual void AppendOffsetElSpine (const Handle(ChFiDS_HElSpine)& Els);
+  
   Standard_EXPORT Handle(ChFiDS_HElSpine) ElSpine (const Standard_Integer IE) const;
   
   Standard_EXPORT Handle(ChFiDS_HElSpine) ElSpine (const TopoDS_Edge& E) const;
@@ -108,6 +119,8 @@ public:
   
   Standard_EXPORT ChFiDS_ListOfHElSpine& ChangeElSpines();
   
+  Standard_EXPORT ChFiDS_ListOfHElSpine& ChangeOffsetElSpines();
+  
   Standard_EXPORT virtual void Reset (const Standard_Boolean AllData = Standard_False);
   
   Standard_EXPORT Standard_Boolean SplitDone() const;
@@ -227,6 +240,8 @@ public:
   
   Standard_EXPORT ChFiDS_ErrorStatus ErrorStatus() const;
 
+  //! Return the mode of chamfers used
+  Standard_EXPORT ChFiDS_ChamfMode Mode() const;
 
 
 
@@ -237,6 +252,8 @@ protected:
 
   Standard_Boolean splitdone;
   ChFiDS_ListOfHElSpine elspines;
+  ChFiDS_ListOfHElSpine offset_elspines;
+  ChFiDS_ChamfMode   myMode;
 
 
 private:
@@ -245,11 +262,14 @@ private:
   Standard_EXPORT void Prepare (Standard_Real& L, Standard_Integer& Index) const;
 
   BRepAdaptor_Curve myCurve;
+  BRepAdaptor_Curve myOffsetCurve;
   Standard_Integer indexofcurve;
   ChFiDS_State firstState;
   ChFiDS_State lastState;
   TopTools_SequenceOfShape spine;
+  TopTools_SequenceOfShape offsetspine;
   Handle(TColStd_HArray1OfReal) abscissa;
+  Handle(TColStd_HArray1OfReal) offset_abscissa;
   Standard_Real tolesp;
   Standard_Real firstparam;
   Standard_Real lastparam;
index 8aa01184493c49edbc4fddbf951c70dba30ad950..3bc082e6348d98c7c164c8709edb754701a8bc78 100644 (file)
@@ -124,6 +124,16 @@ inline const TopoDS_Edge&  ChFiDS_Spine::Edges(const Standard_Integer I) const
   return TopoDS::Edge(spine.Value(I));
 }
 
+//=======================================================================
+//function : OffsetEdges
+//purpose  : 
+//=======================================================================
+
+inline const TopoDS_Edge&  ChFiDS_Spine::OffsetEdges(const Standard_Integer I) const 
+{
+  return TopoDS::Edge(offsetspine.Value(I));
+}
+
 //=======================================================================
 //function : SetEdges
 //purpose  : 
@@ -134,6 +144,16 @@ inline void  ChFiDS_Spine::SetEdges(const TopoDS_Edge& E)
   spine.Append(E);
 }
 
+//=======================================================================
+//function : SetOffsetEdges
+//purpose  : 
+//=======================================================================
+
+inline void  ChFiDS_Spine::SetOffsetEdges(const TopoDS_Edge& E)
+{
+  offsetspine.Append(E);
+}
+
 //=======================================================================
 //function : PutInFirst
 //purpose  : 
@@ -144,6 +164,16 @@ inline void  ChFiDS_Spine::PutInFirst(const TopoDS_Edge& E)
   spine.InsertBefore(1,E);
 }
 
+//=======================================================================
+//function : PutInFirstOffset
+//purpose  : 
+//=======================================================================
+
+inline void  ChFiDS_Spine::PutInFirstOffset(const TopoDS_Edge& E)
+{
+  offsetspine.InsertBefore(1,E);
+}
+
 //=======================================================================
 //function : CurrentIndexOfElementarySpine
 //purpose  : 
@@ -152,3 +182,14 @@ inline Standard_Integer ChFiDS_Spine::CurrentIndexOfElementarySpine() const
 {
   return indexofcurve;
 }
+
+//=======================================================================
+//function : Mode
+//purpose  : 
+//=======================================================================
+
+inline ChFiDS_ChamfMode  ChFiDS_Spine::Mode() const
+{
+
+  return myMode;
+}
index db033a62c36118c3372592f4c571da12f2155a08..3093415ae4def90685cce1d5b8ccf22001833dd9 100644 (file)
@@ -1,4 +1,5 @@
 ChFiDS_ChamfMethod.hxx
+ChFiDS_ChamfMode.hxx
 ChFiDS_ChamfSpine.cxx
 ChFiDS_ChamfSpine.hxx
 ChFiDS_CircSection.cxx
index 0d6c3a5273310fa34ae98ba51ad3a4003b212fa8..efd8213bfead484693e04adfd396922f2679eaf0 100644 (file)
     }
   }
   else if(!CSpine.IsNull()){
+    
+    ChFiDS_ChamfMode aMode = CSpine->Mode();
+    
     if (CSpine->IsChamfer() == ChFiDS_Sym) {
       Standard_Real dis;
       CSpine->GetDist(dis);
+      
       if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
-       surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Plane(), 
-                                     Or1,Or2,dis, dis,CSpine->Line(),
-                                     Wref,OrFace1);
+       surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                       S1->Plane(),S2->Plane(), 
+                                       Or1,Or2,dis, dis,CSpine->Line(),
+                                       Wref,OrFace1);
       }
       else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cylinder ){
        if (ctyp == GeomAbs_Circle)
-         surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
+         surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                         S1->Plane(),S2->Cylinder(),
                                         S2->FirstUParameter(),S2->LastUParameter(),
                                         Or1,Or2,dis,dis ,CSpine->Circle(),
                                         Wref,OrFace1,Standard_True);
        else
-         surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
+         surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                         S1->Plane(),S2->Cylinder(),
                                         S2->FirstUParameter(),S2->LastUParameter(),
                                         Or1,Or2,dis,dis,CSpine->Line(),
                                         Wref,OrFace1,Standard_True);
       }
       else if ( typ1 == GeomAbs_Cylinder && typ2 == GeomAbs_Plane ){
        if (ctyp == GeomAbs_Circle)
-         surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(), 
+         surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                         S2->Plane(),S1->Cylinder(), 
                                         S1->FirstUParameter(),S1->LastUParameter(),
                                         Or2,Or1,dis,dis,CSpine->Circle(),
                                         Wref,OrFace2,Standard_False);
        else
-         surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(), 
+         surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                         S2->Plane(),S1->Cylinder(), 
                                         S1->FirstUParameter(),S1->LastUParameter(),
                                         Or2,Or1,dis,dis,CSpine->Line(),
                                         Wref,OrFace2,Standard_False);
       }
       else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cone ){
-       surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cone(), 
+       surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                       S1->Plane(),S2->Cone(), 
                                       S2->FirstUParameter(),S2->LastUParameter(),
                                       Or1,Or2,dis,dis,CSpine->Circle(),
                                       Wref,OrFace1,Standard_True);
       }
       else if ( typ1 == GeomAbs_Cone && typ2 == GeomAbs_Plane ){
-       surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cone(), 
+       surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                       S2->Plane(),S1->Cone(), 
                                       S1->FirstUParameter(),S1->LastUParameter(),
                                       Or2,Or1,dis,dis,CSpine->Circle(),
                                       Wref,OrFace2,Standard_False); 
       Standard_Real dis1,dis2;
       CSpine->Dists(dis1,dis2);
       if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
-       surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Plane(), 
-                                     Or1,Or2,dis1,dis2,CSpine->Line(),
-                                     Wref,OrFace1);
+       surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                       S1->Plane(),S2->Plane(), 
+                                       Or1,Or2,dis1,dis2,CSpine->Line(),
+                                       Wref,OrFace1);
       }
       else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cylinder ){
        if (ctyp == GeomAbs_Circle)
-         surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
+         surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                         S1->Plane(),S2->Cylinder(),
                                         S2->FirstUParameter(),S2->LastUParameter(),
                                         Or1,Or2,dis1,dis2,CSpine->Circle(),
                                         Wref,OrFace1,Standard_True);
        else
-         surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
+         surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                         S1->Plane(),S2->Cylinder(),
                                         S2->FirstUParameter(),S2->LastUParameter(),
                                         Or1,Or2,dis1,dis2,CSpine->Line(),
                                         Wref,OrFace1,Standard_True);
       }
       else if ( typ1 == GeomAbs_Cylinder && typ2 == GeomAbs_Plane ){
        if (ctyp == GeomAbs_Circle)
-         surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(), 
+         surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                         S2->Plane(),S1->Cylinder(), 
                                         S1->FirstUParameter(),S1->LastUParameter(),
                                         Or2,Or1,dis2,dis1,CSpine->Circle(),
                                         Wref,OrFace2,Standard_False);
        else
-         surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(), 
+         surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                         S2->Plane(),S1->Cylinder(), 
                                         S1->FirstUParameter(),S1->LastUParameter(),
                                         Or2,Or1,dis2,dis1,CSpine->Line(),
                                         Wref,OrFace2,Standard_False);
       }
       else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cone ){
-       surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cone(), 
+       surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                       S1->Plane(),S2->Cone(), 
                                       S2->FirstUParameter(),S2->LastUParameter(),
                                       Or1,Or2,dis1,dis2,CSpine->Circle(),
                                       Wref,OrFace1,Standard_True);
       }
       else if ( typ1 == GeomAbs_Cone && typ2 == GeomAbs_Plane ){
-       surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cone(), 
+       surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
+                                       S2->Plane(),S1->Cone(), 
                                       S1->FirstUParameter(),S1->LastUParameter(),
-                                      Or2,Or1,dis2,dis1,CSpine->Circle(),
+                                      Or2,Or1,dis1,dis2,CSpine->Circle(),
                                       Wref,OrFace2,Standard_False); 
       }
       else{
     }
     else {
       Standard_Real dis, Angle;
-      Standard_Boolean DisOnP;
-      CSpine->GetDistAngle(dis, Angle, DisOnP);
+      Standard_Boolean DisOnP = Standard_True;
+      CSpine->GetDistAngle(dis, Angle);
       if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
        surfok = ChFiKPart_MakeChAsym(DStr,Data,S1->Plane(),S2->Plane(), 
                                      Or1,Or2, dis, Angle, CSpine->Line(),
index c1ee358ccc88c7179bf87b74032807fc3650c970..8830e61a5db52ef027a47182826fa43257cbf479 100644 (file)
 //=======================================================================
 Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
                                       const Handle(ChFiDS_SurfData)& Data, 
+                                       const ChFiDS_ChamfMode theMode,
                                       const gp_Pln& Pln, 
                                       const gp_Cone& Con, 
                                       const Standard_Real fu,
                                       const Standard_Real lu,
                                       const TopAbs_Orientation Or1,
                                       const TopAbs_Orientation Or2,
-                                      const Standard_Real Dis1, 
-                                      const Standard_Real Dis2,
+                                      const Standard_Real theDis1, 
+                                      const Standard_Real theDis2,
                                       const gp_Circ& Spine, 
                                       const Standard_Real First, 
                                       const TopAbs_Orientation Ofpl,
@@ -73,6 +74,26 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
 {
 
   Standard_Real angcon = Con.SemiAngle();
+
+  Standard_Real Dis1 = theDis1, Dis2 = theDis2;
+  Standard_Real Alpha = M_PI/2 - angcon;
+  Standard_Real CosHalfAlpha = Cos(Alpha/2);
+  if (theMode == ChFiDS_ConstThroatChamfer)
+    Dis1 = Dis2 = theDis1 / CosHalfAlpha;
+  else if (theMode == ChFiDS_ConstThroatWithPenetrationChamfer)
+  {
+    Standard_Real aDis1 = Min(theDis1, theDis2);
+    Standard_Real aDis2 = Max(theDis1, theDis2);
+    Standard_Real dis1dis1 = aDis1*aDis1, dis2dis2 = aDis2*aDis2;
+    Standard_Real SinAlpha = Sin(Alpha);
+    Standard_Real CosAlpha = Cos(Alpha);
+    Standard_Real CotanAlpha = CosAlpha/SinAlpha;
+    Dis1 = sqrt(dis2dis2 - dis1dis1) - aDis1*CotanAlpha;
+    Standard_Real CosBeta = sqrt(1-dis1dis1/dis2dis2)*CosAlpha + aDis1/aDis2*SinAlpha;
+    Standard_Real FullDist1 = aDis2/CosBeta;
+    Dis2 = FullDist1 - aDis1/SinAlpha;
+  }
+  
   Standard_Real sincon =Abs(Sin(angcon));
   Standard_Real angle;
   Standard_Boolean IsResol;
index 1c10a6cac06f8a679e8eb49134c38dd5c79a6c1d..aecf36309805612137dbed854a2d791a549cfc7b 100644 (file)
@@ -19,6 +19,7 @@
 
 Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
                                       const Handle(ChFiDS_SurfData)& Data, 
+                                       const ChFiDS_ChamfMode theMode,
                                       const gp_Pln& Pln, 
                                       const gp_Cone& Con, 
                                       const Standard_Real fu,
index 15341640ad954bb0cb1067380d76d449ca2a8442..8e2b1a88034ab2e1c5c7c72aa81b2a63a5e4cb18 100644 (file)
 //           False else
 //=======================================================================
 Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
-                                      const Handle(ChFiDS_SurfData)& Data, 
+                                      const Handle(ChFiDS_SurfData)& Data,
+                                       const ChFiDS_ChamfMode theMode,
                                       const gp_Pln& Pln, 
                                       const gp_Cylinder& Cyl, 
                                       const Standard_Real fu,
                                       const Standard_Real lu,
                                       const TopAbs_Orientation Or1,
                                       const TopAbs_Orientation Or2,
-                                      const Standard_Real Dis1, 
-                                      const Standard_Real Dis2,
+                                      const Standard_Real theDis1, 
+                                      const Standard_Real theDis2,
                                       const gp_Circ& Spine, 
                                       const Standard_Real First, 
                                       const TopAbs_Orientation Ofpl,
@@ -80,6 +81,17 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
 
   // compute the chamfer surface(cone)
 
+  Standard_Real Dis1 = theDis1, Dis2 = theDis2;
+  if (theMode == ChFiDS_ConstThroatChamfer)
+    Dis1 = Dis2 = theDis1 * sqrt(2.);
+  else if (theMode == ChFiDS_ConstThroatWithPenetrationChamfer)
+  {
+    Standard_Real aDis2 = Min(theDis1, theDis2);
+    Standard_Real aDis1 = Max(theDis1, theDis2);
+    Dis2 = sqrt(aDis1*aDis1 - aDis2*aDis2);
+    Dis1 = aDis1*aDis1/aDis2 - aDis2;
+  }
+
     // compute the normals to the plane surface & to the plane face
   gp_Ax3 PosPl = Pln.Position();
   gp_Dir Dpl = PosPl.XDirection().Crossed(PosPl.YDirection());
@@ -310,7 +322,8 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
 //=======================================================================
 
 Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
-                                     const Handle(ChFiDS_SurfData)& Data, 
+                                       const Handle(ChFiDS_SurfData)& Data, 
+                                       const ChFiDS_ChamfMode theMode,
                                       const gp_Pln& Pln, 
                                       const gp_Cylinder& Cyl, 
                                       const Standard_Real /*fu*/,
@@ -330,6 +343,9 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
   //        _|_          Ofpl is orientation of the plane face allowing
   //         |4          to determine the side of the material
 
+  if (theMode != ChFiDS_ClassicChamfer)
+    return Standard_False;
+  
   gp_Pnt OrSpine = ElCLib::Value(First,Spine);
   gp_Pnt POnCyl, POnPln, OrCyl;
 
index 90011543186ce7814e5406f16f06749392736a8e..71d98eb6216172a2e792c9bb750d8d405815a241 100644 (file)
@@ -18,7 +18,8 @@
 #define _ChFiKPart_ComputeData_ChPlnCyl_HeaderFile
 
 Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
-                                     const Handle(ChFiDS_SurfData)& Data, 
+                                       const Handle(ChFiDS_SurfData)& Data, 
+                                       const ChFiDS_ChamfMode theMode,
                                       const gp_Pln& Pln, 
                                       const gp_Cylinder& Cyl, 
                                       const Standard_Real fu,
@@ -39,6 +40,7 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
 
 Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
                                       const Handle(ChFiDS_SurfData)& Data, 
+                                       const ChFiDS_ChamfMode theMode,
                                       const gp_Pln& Pln, 
                                       const gp_Cylinder& Cyl, 
                                       const Standard_Real fu,
index 9c83f2750cb95877b7fa9fd08ae945d190bc53bd..ec66eb3f28ae7ec0d36a64b95960f22b8900790f 100644 (file)
 //=======================================================================
 Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
                                       const Handle(ChFiDS_SurfData)& Data, 
+                                       const ChFiDS_ChamfMode theMode,
                                       const gp_Pln& Pl1, 
                                       const gp_Pln& Pl2, 
                                       const TopAbs_Orientation Or1,
                                       const TopAbs_Orientation Or2,
-                                      const Standard_Real Dis1, 
-                                      const Standard_Real Dis2, 
+                                      const Standard_Real theDis1, 
+                                      const Standard_Real theDis2, 
                                       const gp_Lin& Spine, 
                                       const Standard_Real First, 
                                       const TopAbs_Orientation Of1)
@@ -95,6 +96,24 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
   if ( VecTransl2.Dot(D1) <=0. )
     VecTransl2.Reverse();
 
+  Standard_Real Dis1 = theDis1, Dis2 = theDis2;
+  Standard_Real Alpha = VecTransl1.Angle(VecTransl2);
+  Standard_Real CosHalfAlpha = Cos(Alpha/2);
+  if (theMode == ChFiDS_ConstThroatChamfer)
+    Dis1 = Dis2 = theDis1 / CosHalfAlpha;
+  else if (theMode == ChFiDS_ConstThroatWithPenetrationChamfer)
+  {
+    Standard_Real aDis1 = Min(theDis1, theDis2);
+    Standard_Real aDis2 = Max(theDis1, theDis2);
+    Standard_Real dis1dis1 = aDis1*aDis1, dis2dis2 = aDis2*aDis2;
+    Standard_Real SinAlpha = Sin(Alpha);
+    Standard_Real CosAlpha = Cos(Alpha);
+    Standard_Real CotanAlpha = CosAlpha/SinAlpha;
+    Dis1 = sqrt(dis2dis2 - dis1dis1) - aDis1*CotanAlpha;
+    Standard_Real CosBeta = sqrt(1-dis1dis1/dis2dis2)*CosAlpha + aDis1/aDis2*SinAlpha;
+    Standard_Real FullDist1 = aDis2/CosBeta;
+    Dis2 = FullDist1 - aDis1/SinAlpha;
+  }
 
     // Compute a point on the plane Pl1 and on the chamfer
   gp_Pnt P1( P.X()+Dis1*VecTransl1.X(),
index 2bb8c4a0fe9d12d2463a95b49e3c4d82a2aec5ee..48e57b7d44940bf4b05ebf9684d86a85ad1e3a33 100644 (file)
@@ -20,6 +20,7 @@
 
 Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
                                       const Handle(ChFiDS_SurfData)& Data, 
+                                       const ChFiDS_ChamfMode theMode,
                                       const gp_Pln& Pl1, 
                                       const gp_Pln& Pl2, 
                                       const TopAbs_Orientation Or1,
index 3a61290b576764ffb791a7254e55b04e41b1dcb1..ac8725e65f3a19a0f7476b7cd8da249919d34598 100644 (file)
@@ -331,6 +331,8 @@ Standard_Boolean
   if(!fsp->IsConstant()) throw Standard_ConstructionError("PerformSurf : no variable radiuses");
   // Standard_Boolean maybesingular; //pour scinder les Surfdata singulieres 
   
+  Handle(ChFiDS_HElSpine) EmptyGuide;
+
   BRepBlend_ConstRad Func(S1,S2,Guide);
   BRepBlend_ConstRadInv FInv(S1,S2,Guide);
   Func.Set(fsp->Radius(),Choix);
@@ -346,7 +348,7 @@ Standard_Boolean
     Func.Set(BlendFunc_Polynomial);
   }
   Standard_Real PFirst = First;
-  done = SimulData(Data,Guide,lin,S1,I1,
+  done = SimulData(Data,Guide,EmptyGuide,lin,S1,I1,
                   S2,I2,Func,FInv,PFirst,MaxStep,Fleche,
                   TolGuide,First,Last,Inside,Appro,Forward,Soldep,
                   20,RecOnS1,RecOnS2);
index 241951121c708d98c45860b15f555b9a66cffe11..e3b9e756f52bc33d426a67ea7bc40d99774302e5 100644 (file)
@@ -963,7 +963,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
             LevelOfEmptyInmyIntersectionOn2S=0;
             if(LevelOfIterWithoutAppend < 10)
             {
-              aStatus = TestDeflection(ChoixIso);
+              aStatus = TestDeflection(ChoixIso, aStatus);
             }                  
             else
             {
@@ -1755,7 +1755,7 @@ Standard_Boolean IntWalk_PWalking::ExtendLineInCommonZone(const IntImp_ConstIsop
         return bOutOfTangentZone;
       }
 
-      aStatus = TestDeflection(ChoixIso);
+      aStatus = TestDeflection(ChoixIso, aStatus);
 
       if(aStatus == IntWalk_OK) {
 
@@ -2996,7 +2996,8 @@ namespace {
   static const Standard_Real d = 7.0;
 }
 
-IntWalk_StatusDeflection  IntWalk_PWalking::TestDeflection(const IntImp_ConstIsoparametric choixIso)
+IntWalk_StatusDeflection  IntWalk_PWalking::TestDeflection(const IntImp_ConstIsoparametric choixIso,
+                                                           const IntWalk_StatusDeflection  theStatus)
 
 // test if vector is observed by calculating an increase of vector 
 //     or the previous point and its tangent, the new calculated point and its  
@@ -3391,7 +3392,8 @@ IntWalk_StatusDeflection  IntWalk_PWalking::TestDeflection(const IntImp_ConstIso
       const Standard_Real anInvSqAbsArcDeflMin = 4.0*anInvSqAbsArcDeflMax;
       const Standard_Real aSinB2Min = 1.0 - 2.0/(1.0 + anInvSqAbsArcDeflMin);
 
-      if((aSinB2Min < 0.0) || (aCosBetweenTangent >= 2.0 * aSinB2Min * aSinB2Min - 1.0))
+      if (theStatus != IntWalk_PasTropGrand &&
+          ((aSinB2Min < 0.0) || (aCosBetweenTangent >= 2.0 * aSinB2Min * aSinB2Min - 1.0)))
       {//Real deflection is less than tolconf/2.0
         aStatus = IntWalk_StepTooSmall;
       }
index e3ac4bbc3d8119ee8656aef6487a60cea055281b..fcadb1f24228ba5c6535e6d057dbc2026e6361eb 100644 (file)
@@ -66,7 +66,12 @@ public:
   //! border of one of the domains. If an open line
   //! stops at the middle of a domain, one stops at the tangent point.
   //! Epsilon is SquareTolerance of points confusion.
-  Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
+  Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1,
+                                   const Handle(Adaptor3d_HSurface)& Caro2,
+                                   const Standard_Real TolTangency,
+                                   const Standard_Real Epsilon,
+                                   const Standard_Real Deflection,
+                                   const Standard_Real Increment);
   
   //! Returns the intersection line containing the exact
   //! point Poin. This line is a polygonal line.
@@ -81,7 +86,16 @@ public:
   //! border of one of the domains. If an open line
   //! stops at the middle of a domain, one stops at the tangent point.
   //! Epsilon is SquareTolerance of points confusion.
-  Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2);
+  Standard_EXPORT IntWalk_PWalking(const Handle(Adaptor3d_HSurface)& Caro1,
+                                   const Handle(Adaptor3d_HSurface)& Caro2,
+                                   const Standard_Real TolTangency,
+                                   const Standard_Real Epsilon,
+                                   const Standard_Real Deflection,
+                                   const Standard_Real Increment,
+                                   const Standard_Real U1,
+                                   const Standard_Real V1,
+                                   const Standard_Real U2,
+                                   const Standard_Real V2);
   
   //! calculate the line of intersection
   Standard_EXPORT void Perform (const TColStd_Array1OfReal& ParDep);
@@ -91,10 +105,19 @@ public:
   //! v.  (if this data is not presented as in the
   //! previous method, the initial steps are calculated
   //! starting from min and max uv of faces).
-  Standard_EXPORT void Perform (const TColStd_Array1OfReal& ParDep, const Standard_Real u1min, const Standard_Real v1min, const Standard_Real u2min, const Standard_Real v2min, const Standard_Real u1max, const Standard_Real v1max, const Standard_Real u2max, const Standard_Real v2max);
+  Standard_EXPORT void Perform (const TColStd_Array1OfReal& ParDep,
+                                const Standard_Real u1min,
+                                const Standard_Real v1min,
+                                const Standard_Real u2min,
+                                const Standard_Real v2min,
+                                const Standard_Real u1max,
+                                const Standard_Real v1max,
+                                const Standard_Real u2max,
+                                const Standard_Real v2max);
   
   //! calculate the first point of a line of intersection
-  Standard_EXPORT Standard_Boolean PerformFirstPoint (const TColStd_Array1OfReal& ParDep, IntSurf_PntOn2S& FirstPoint);
+  Standard_EXPORT Standard_Boolean PerformFirstPoint (const TColStd_Array1OfReal& ParDep,
+                                                      IntSurf_PntOn2S& FirstPoint);
   
   //! Returns true if the calculus was successful.
     Standard_Boolean IsDone() const;
@@ -126,11 +149,16 @@ public:
   
     const gp_Dir& TangentAtLine (Standard_Integer& Index) const;
   
-  Standard_EXPORT   IntWalk_StatusDeflection TestDeflection (const IntImp_ConstIsoparametric ChoixIso) ;
+  Standard_EXPORT   IntWalk_StatusDeflection TestDeflection (const IntImp_ConstIsoparametric ChoixIso,
+                                                             const IntWalk_StatusDeflection  theStatus);
   
-  Standard_EXPORT Standard_Boolean TestArret (const Standard_Boolean DejaReparti, TColStd_Array1OfReal& Param, IntImp_ConstIsoparametric& ChoixIso);
+  Standard_EXPORT Standard_Boolean TestArret (const Standard_Boolean DejaReparti,
+                                              TColStd_Array1OfReal& Param,
+                                              IntImp_ConstIsoparametric& ChoixIso);
   
-  Standard_EXPORT void RepartirOuDiviser (Standard_Boolean& DejaReparti, IntImp_ConstIsoparametric& ChoixIso, Standard_Boolean& Arrive);
+  Standard_EXPORT void RepartirOuDiviser (Standard_Boolean& DejaReparti,
+                                          IntImp_ConstIsoparametric& ChoixIso,
+                                          Standard_Boolean& Arrive);
   
   //! Inserts thePOn2S in the end of line
   void AddAPoint (const IntSurf_PntOn2S& thePOn2S);
@@ -157,9 +185,12 @@ public:
     line->RemovePoint(anIdx);
   }
   
-  Standard_EXPORT Standard_Boolean PutToBoundary (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2);
+  Standard_EXPORT Standard_Boolean PutToBoundary (const Handle(Adaptor3d_HSurface)& theASurf1,
+                                                  const Handle(Adaptor3d_HSurface)& theASurf2);
   
-  Standard_EXPORT Standard_Boolean SeekAdditionalPoints (const Handle(Adaptor3d_HSurface)& theASurf1, const Handle(Adaptor3d_HSurface)& theASurf2, const Standard_Integer theMinNbPoints);
+  Standard_EXPORT Standard_Boolean SeekAdditionalPoints (const Handle(Adaptor3d_HSurface)& theASurf1,
+                                                         const Handle(Adaptor3d_HSurface)& theASurf2,
+                                                         const Standard_Integer theMinNbPoints);
 
   Standard_Real MaxStep(Standard_Integer theIndex)
   {
index 0aa8e8173cc47f85c499c23f3ef2a36dc41cb652..2d00c915d134f7ddace391d176733bde5584ee55 100755 (executable)
@@ -11,7 +11,7 @@ set BugNumber OCC20222
 restore [locate_data_file OCC20222.brep] s 
 explode s f
 explode s_10 e
-chamf result s s_10_3 s_10 S 50
+chamf result s s_10_3 50
 
 checkprops result -s 712126 
 checkshape result
index 6bbe3ce2027b5938c20133fe7c2ace37c78e9841..47d968a2230cfb85fa2d0f69a2e3f7fad5901577 100755 (executable)
@@ -1,3 +1,5 @@
+puts "TODO CR30351 Windows: Faulty OCC25199:  Bad tolerance edge generated by blend algorithm"
+
 puts "============"
 puts "OCC25199"
 puts "============"
@@ -20,7 +22,7 @@ explode result E
 regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance result_21] full MaxTol_1
 
 puts "MaxTolerance = $MaxTol_1"
-set MaxTol 0.001
+set MaxTol 5.e-7
 
 if { $MaxTol_1 > $MaxTol } {
     puts "Faulty OCC25199:  Bad tolerance edge generated by blend algorithm"
index 8a2a6d7c5dfcfbce28c8a13f823ebdcd9624fa22..3fa59ab79cb52c2e7b89aba8a2b00e8d1892197f 100644 (file)
@@ -15,15 +15,21 @@ cvalue c 0 x y z dx dy dz
 revol rev f $x $y $z $dx $dy $dz 360
 
 bcut r rev h
+savehistory hh
 
-explode r F
-explode r_9 E
-chamf r r r_9_1 r_9 0.1 0.1  r_9_2 r_9 0.1 0.1  r_9_3 r_9 0.1 0.1  r_9_4 r_9 0.1 0.1  r_9_5 r_9 0.1 0.1  r_9_6 r_9 0.1 0.1
+explode h f
+explode h_7 E
 
-explode r F
-explode r_4 E
-chamf result r r_4_1 r_4 0.1 0.1  r_4_2 r_4 0.1 0.1  r_4_3 r_4 0.1 0.1  r_4_4 r_4 0.1 0.1  r_4_5 r_4 0.1 0.1  r_4_6 r_4 0.1 0.1  r_4_8 r_4 0.1 0.1
+chamf r r h_7_1 0.1  h_7_2 0.1  h_7_3 0.1  h_7_4 0.1  h_7_5 0.1  h_7_6 0.1
+
+explode rev f
+modified ff hh rev_1
+explode ff e
+
+chamf result r ff_1 0.1  ff_2 0.1  ff_3 0.1  ff_4 0.1  ff_5 0.1  ff_6 0.1  ff_7 0.1
 
 checkshape result
-checknbshapes result -solid 1 -face 18 -edge 36 -vertex 22
-checkprops result -v 17158.1 -s 4073.25 
\ No newline at end of file
+checknbshapes result -solid 1 -face 27 -edge 54 -vertex 31
+checkprops result -v 17158.2 -s 4072.76 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug27711 b/tests/bugs/modalg_7/bug27711
deleted file mode 100644 (file)
index 32616b7..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-puts "TODO OCC27711 ALL: Error: tolerance"
-puts "========"
-puts "OCC27711"
-puts "========"
-puts ""
-#####################################
-# Blend-on-blend corrupts the shape
-#####################################
-
-smallview
-
-restore [locate_data_file bug27711.brep] s
-
-clear
-display s
-fit
-xwd $imagedir/${casename}_step_0.png
-
-explode s e
-blend result s 0.5 s_12 0.5 s_11
-set bug_info [string trim [checkshape result]]
-if {$bug_info != "This shape seems to be valid"} {
-  puts "ERROR: Problem of test case functionality. Should be additionally investigated."
-}
-clear
-display result
-xwd $imagedir/${casename}_step_1.png
-
-explode result e
-# The correct command format should be following:
-# blend res res 0.5 res_7 0.5 res_11
-# but it does not work properly on win64 vc 10
-# so for automated test case following command format was used:
-blend result result 0.5 result_11
-set bug_info [string trim [checkshape result]]
-if {$bug_info != "This shape seems to be valid"} {
-  puts "ERROR: Problem of test case functionality. Should be additionally investigated."
-}
-clear
-display result
-xwd $imagedir/${casename}_step_2.png
-
-explode result e
-blend result result 0.35 result_4 0.25 ressult_15 0.2 result_27
-set bug_info [string trim [checkshape result]]
-if {$bug_info != "This shape seems to be valid"} {
-  puts "ERROR: OCC27711 is reproduced. Result of blend operation is WRONG."
-}
-checkmaxtol result -min_tol 1.e-3
-clear
-display result
-xwd $imagedir/${casename}_step_3.png
diff --git a/tests/bugs/modalg_7/bug27711_1 b/tests/bugs/modalg_7/bug27711_1
new file mode 100644 (file)
index 0000000..88536bb
--- /dev/null
@@ -0,0 +1,39 @@
+puts "========"
+puts "OCC27711"
+puts "========"
+puts ""
+#####################################
+# Blend-on-blend corrupts the shape
+#####################################
+
+smallview
+
+restore [locate_data_file bug27711.brep] s
+
+clear
+display s
+fit
+xwd $imagedir/${casename}_step_0.png
+
+explode s e
+blend r1 s 0.5 s_12
+set bug_info [string trim [checkshape r1]]
+if {$bug_info != "This shape seems to be valid"} {
+  puts "ERROR: Problem of test case functionality. Should be additionally investigated."
+}
+clear
+display r1
+xwd $imagedir/${casename}_step_1.png
+
+explode r1 e
+blend result r1 0.2 r1_7
+set bug_info [string trim [checkshape result]]
+if {$bug_info != "This shape seems to be valid"} {
+  puts "ERROR: Problem of test case functionality. Should be additionally investigated."
+}
+
+checkprops result -v 135.134 -deps 1.e-7
+
+clear
+display result
+xwd $imagedir/${casename}_step_2.png
diff --git a/tests/bugs/modalg_7/bug27711_2 b/tests/bugs/modalg_7/bug27711_2
new file mode 100644 (file)
index 0000000..bc31a2e
--- /dev/null
@@ -0,0 +1,50 @@
+puts "TODO OCC27711 ALL: ERROR: OCC27711 is reproduced. Result of blend operation is WRONG."
+puts "TODO OCC27711 ALL: Error: tolerance"
+puts "TODO OCC27711 ALL: Faulty shapes in variables faulty_1 to faulty_"
+puts "========"
+puts "OCC27711"
+puts "========"
+puts ""
+#####################################
+# Blend-on-blend corrupts the shape
+#####################################
+
+smallview
+
+restore [locate_data_file bug27711.brep] s
+
+clear
+display s
+fit
+xwd $imagedir/${casename}_step_0.png
+
+explode s e
+blend r1 s 0.5 s_7 0.5 s_12
+set bug_info [string trim [checkshape r1]]
+if {$bug_info != "This shape seems to be valid"} {
+  puts "ERROR: Problem of test case functionality. Should be additionally investigated."
+}
+clear
+display r1
+xwd $imagedir/${casename}_step_1.png
+
+explode r1 e
+blend r1 r1 0.5 r1_1 0.5 r1_8
+set bug_info [string trim [checkshape r1]]
+if {$bug_info != "This shape seems to be valid"} {
+  puts "ERROR: Problem of test case functionality. Should be additionally investigated."
+}
+clear
+display r1
+xwd $imagedir/${casename}_step_2.png
+
+explode r1 e
+blend result r1 0.35 r1_4 0.25 r1_15 0.2 r1_27
+set bug_info [string trim [checkshape result]]
+if {$bug_info != "This shape seems to be valid"} {
+  puts "ERROR: OCC27711 is reproduced. Result of blend operation is WRONG."
+}
+checkmaxtol result -min_tol 1.e-3
+clear
+display result
+xwd $imagedir/${casename}_step_3.png
diff --git a/tests/bugs/modalg_7/bug27711_3 b/tests/bugs/modalg_7/bug27711_3
new file mode 100644 (file)
index 0000000..bf3a0af
--- /dev/null
@@ -0,0 +1,39 @@
+puts "TODO CR27711 Linux: Tcl Exception: tolerance ang : 0.01"
+puts "TODO CR27711 Linux: TEST INCOMPLETE"
+
+puts "========"
+puts "OCC27711"
+puts "========"
+puts ""
+#####################################
+# Blend-on-blend corrupts the shape
+#####################################
+
+smallview
+
+restore [locate_data_file bug27711.brep] s
+
+clear
+display s
+fit
+xwd $imagedir/${casename}_step_0.png
+
+explode s e
+blend r1 s 0.5 s_12 0.5 s_11
+set bug_info [string trim [checkshape r1]]
+if {$bug_info != "This shape seems to be valid"} {
+  puts "ERROR: Problem of test case functionality. Should be additionally investigated."
+}
+clear
+display r1
+xwd $imagedir/${casename}_step_1.png
+
+explode r1 e
+blend result r1 0.5 r1_7 0.5 r1_11
+set bug_info [string trim [checkshape result]]
+if {$bug_info != "This shape seems to be valid"} {
+  puts "ERROR: Problem of test case functionality. Should be additionally investigated."
+}
+clear
+display result
+xwd $imagedir/${casename}_step_2.png
diff --git a/tests/bugs/modalg_7/bug28828_1 b/tests/bugs/modalg_7/bug28828_1
new file mode 100644 (file)
index 0000000..50e6a1b
--- /dev/null
@@ -0,0 +1,33 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+pcylinder a1 10 50
+box a2 -20 -20 -20  40 40 40
+nurbsconvert ba2 a2
+bfuse b a1 ba2
+savehistory hh
+
+explode a1 f
+generated ee hh a1_1
+explode ee e
+explode a1 e
+
+donly b a1_1 ee_1
+
+chamf_throat result b  a1_1 1.  ee_1 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 10 -wire 11 -edge 19 -vertex 12 -shape 55
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.00014} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 73639.9 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_10 b/tests/bugs/modalg_7/bug28828_10
new file mode 100644 (file)
index 0000000..8ff7ce9
--- /dev/null
@@ -0,0 +1,27 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: plane + plane, symmetrical throat
+polyline b 0 0 0  20 0 0  20 0 20  10 0 20  20 0 40  0 0 40  0 0 0
+mkplane b b
+prism b b 0 20 0
+explode b e
+donly b b_8
+
+chamf_throat result b b_8 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 9 -edge 17 -vertex 9 -shape 47
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 14049.4 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_11 b/tests/bugs/modalg_7/bug28828_11
new file mode 100644 (file)
index 0000000..553594c
--- /dev/null
@@ -0,0 +1,28 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: plane + plane, penetrating throat
+polyline b 0 0 0  20 0 0  20 0 20  10 0 20  20 0 40  0 0 40  0 0 0
+mkplane b b
+prism b b 0 20 0
+explode b f
+explode b_4 e
+donly b b_4_1
+
+chamf_throat_with_penetration result b b_4_1 b_4 2. 4.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 9 -edge 17 -vertex 9 -shape 47
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 14056.4 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_12 b/tests/bugs/modalg_7/bug28828_12
new file mode 100644 (file)
index 0000000..9fc9c8d
--- /dev/null
@@ -0,0 +1,27 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: plane + plane, symmetrical throat
+polyline b 0 0 0  20 0 0  20 0 20  10 0 20  0 0 40  0 0 0
+mkplane b b
+prism b b 0 20 0
+explode b e
+donly b b_8
+
+chamf_throat result b b_8 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 8 -edge 15 -vertex 8 -shape 42
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 10129.4 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_13 b/tests/bugs/modalg_7/bug28828_13
new file mode 100644 (file)
index 0000000..17d1405
--- /dev/null
@@ -0,0 +1,28 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: plane + plane, penetrating throat
+polyline b 0 0 0  20 0 0  20 0 20  10 0 20  0 0 40  0 0 0
+mkplane b b
+prism b b 0 20 0
+explode b f
+explode b_4 e
+donly b b_4_1
+
+chamf_throat_with_penetration result b b_4_1 b_4 1. 1.5
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 8 -edge 15 -vertex 8 -shape 42
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 10066.4 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_14 b/tests/bugs/modalg_7/bug28828_14
new file mode 100644 (file)
index 0000000..2ddfa8c
--- /dev/null
@@ -0,0 +1,28 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: plane + plane, penetrating throat
+polyline b 0 0 0  20 0 0  20 0 20  10 0 20  10 0 40  0 0 40  0 0 0
+mkplane b b
+prism b b 0 20 0
+explode b f
+explode b_4 e
+donly b b_4_1
+
+chamf_throat_with_penetration result b b_4_1 b_4 1. 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 9 -edge 17 -vertex 9 -shape 47
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 12052 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_15 b/tests/bugs/modalg_7/bug28828_15
new file mode 100644 (file)
index 0000000..807b479
--- /dev/null
@@ -0,0 +1,32 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#non-KPart: cylinder + plane (intersection is line), symmetrical throat
+pcylinder a1 10 50
+box a2 -20 -20 -20  25 40 40
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+modified ff hh a1_1
+generated ee hh a1_1
+explode ee
+donly b ee_3
+
+chamf_throat result b ee_3 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 10 -wire 10 -edge 26 -vertex 18 -shape 67
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 50822.7 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_16 b/tests/bugs/modalg_7/bug28828_16
new file mode 100644 (file)
index 0000000..3fe9c00
--- /dev/null
@@ -0,0 +1,32 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#non-KPart: cylinder + plane (intersection is line), penetrating throat
+pcylinder a1 10 50
+box a2 -20 -20 -20  25 40 40
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+modified ff hh a1_1
+generated ee hh a1_1
+explode ee
+donly b ff ee_3 ee_4
+
+chamf_throat_with_penetration result b  ee_3 ff 1. 1.2  ee_4 ff 1. 1.2
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 11 -wire 11 -edge 31 -vertex 22 -shape 78
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 50702.4 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_17 b/tests/bugs/modalg_7/bug28828_17
new file mode 100644 (file)
index 0000000..9bbc17b
--- /dev/null
@@ -0,0 +1,30 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: cone + plane, symmetrical throat
+pcone a1 10 30 50
+box a2 -25 -25 -20  50 50 40
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+generated ee hh a1_1
+donly b ee
+
+chamf_throat result b ee 3.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 10 -edge 17 -vertex 11 -shape 50
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 1.001e-7} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 156170 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_18 b/tests/bugs/modalg_7/bug28828_18
new file mode 100644 (file)
index 0000000..536739c
--- /dev/null
@@ -0,0 +1,31 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: cone + plane, penetrating throat
+pcone a1 10 30 50
+box a2 -25 -25 -20  50 50 40
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+modified ff hh a1_1
+generated ee hh a1_1
+donly b ff ee
+
+chamf_throat_with_penetration result b ee ff 3. 6.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 10 -edge 17 -vertex 11 -shape 50
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 1.001e-7} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 156442 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_19 b/tests/bugs/modalg_7/bug28828_19
new file mode 100644 (file)
index 0000000..9563fa3
--- /dev/null
@@ -0,0 +1,30 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: cone + plane, symmetrical throat
+pcone a1 40 0 70
+box a2 -50 -50 -20  100 100 40
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+generated ee hh a1_1
+donly b ee
+
+chamf_throat result b ee 3.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 9 -edge 17 -vertex 11 -shape 48
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 1.001e-7} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 445625 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_2 b/tests/bugs/modalg_7/bug28828_2
new file mode 100644 (file)
index 0000000..7ae1995
--- /dev/null
@@ -0,0 +1,31 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+pcylinder a1 10 50
+ttranslate a1 0 -5 0
+box a2 -20 -20 -20  40 40 40
+trotate a2 0 0 0  1 0 0  20
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+generated ee hh a1_1
+donly b ee
+
+chamf_throat result b ee 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 10 -edge 17 -vertex 11 -shape 50
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 73885.9 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_20 b/tests/bugs/modalg_7/bug28828_20
new file mode 100644 (file)
index 0000000..440766f
--- /dev/null
@@ -0,0 +1,31 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: cone + plane, penetrating throat
+pcone a1 40 0 70
+box a2 -50 -50 -20  100 100 40
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+modified ff hh a1_1
+generated ee hh a1_1
+donly b ff ee
+
+chamf_throat_with_penetration result b ee ff 2. 3.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 9 -edge 17 -vertex 11 -shape 48
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 1.001e-7} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 446299 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_21 b/tests/bugs/modalg_7/bug28828_21
new file mode 100644 (file)
index 0000000..3b988b5
--- /dev/null
@@ -0,0 +1,29 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#non-KPart (nurbsconvert): cone + plane, penetrating throat
+pcone a1 40 0 70
+box a2 -50 -50 -20  100 100 40
+bfuse b a1 a2
+nurbsconvert b b
+explode b f
+explode b_1 e
+donly b b_1 b_1_2
+
+chamf_throat_with_penetration result b b_1_2 b_1 2. 3.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 9 -edge 17 -vertex 11 -shape 48
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 446298 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_3 b/tests/bugs/modalg_7/bug28828_3
new file mode 100644 (file)
index 0000000..f07f0eb
--- /dev/null
@@ -0,0 +1,28 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+restore [locate_data_file bug28828_b3.brep] b
+explode b
+bfuse a b_1 b_2
+savehistory hh
+
+explode b_2 e
+donly a b_2_1
+
+chamf_throat result a b_2_1 0.1
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 8 -wire 9 -edge 17 -vertex 11 -shape 48
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 1041.98 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_4 b/tests/bugs/modalg_7/bug28828_4
new file mode 100644 (file)
index 0000000..8aeabc0
--- /dev/null
@@ -0,0 +1,30 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+pcylinder a1 10 50
+plane pp 25 0 0  -1 0 0
+pcylinder a2 pp 15 50
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+generated ee hh a1_1
+donly b ee
+
+chamf_throat result b ee 1.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 6 -wire 7 -edge 8 -vertex 5 -shape 29
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0002} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 46724.8 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_6 b/tests/bugs/modalg_7/bug28828_6
new file mode 100644 (file)
index 0000000..d9ff478
--- /dev/null
@@ -0,0 +1,29 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#nurbsconvert all shape
+pcylinder a1 10 50
+box a2 -20 -20 -20  40 40 40
+bfuse a a1 a2
+nurbsconvert b a
+explode b f
+explode b_1 e
+donly b b_1 b_1_2
+
+chamf_throat_with_penetration result b b_1_2 b_1 1. 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 10 -edge 17 -vertex 11 -shape 50
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 73604.1 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_7 b/tests/bugs/modalg_7/bug28828_7
new file mode 100644 (file)
index 0000000..a665f1e
--- /dev/null
@@ -0,0 +1,33 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#big angle
+pcylinder a1 10 50
+ttranslate a1 0 -5 0
+box a2 -20 -20 -20  40 40 40
+trotate a2 0 0 0  1 0 0  20
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+modified ff hh a1_1
+generated ee hh a1_1
+donly b ff ee
+
+chamf_throat_with_penetration result b ee ff 1. 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 10 -edge 17 -vertex 11 -shape 50
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 0.0001} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 73900.4 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_8 b/tests/bugs/modalg_7/bug28828_8
new file mode 100644 (file)
index 0000000..90e2195
--- /dev/null
@@ -0,0 +1,30 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: cylinder + plane, symmetrical throat
+pcylinder a1 10 50
+box a2 -20 -20 -20  40 40 40
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+generated ee hh a1_1
+donly b ee
+
+chamf_throat result b ee 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 10 -edge 17 -vertex 11 -shape 50
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 1.001e-7} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 73699.8 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug28828_9 b/tests/bugs/modalg_7/bug28828_9
new file mode 100644 (file)
index 0000000..2599b37
--- /dev/null
@@ -0,0 +1,31 @@
+puts "===================================================================="
+puts "OCC28828: New functionalities of BRepFilletAPI_MakeChamfer algorithm"
+puts "===================================================================="
+puts ""
+
+#KPart: cylinder + plane, penetrating throat
+pcylinder a1 10 50
+box a2 -20 -20 -20  40 40 40
+bfuse b a1 a2
+savehistory hh
+
+explode a1 f
+modified ff hh a1_1
+generated ee hh a1_1
+donly b ff ee
+
+chamf_throat_with_penetration result b ee ff 1. 2.
+
+checkshape result
+
+checknbshapes result -solid 1 -shell 1 -face 9 -wire 10 -edge 17 -vertex 11 -shape 50
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 1.001e-7} {
+   puts "Error: bad tolerance of result"
+}
+
+checkprops result -v 73604.3 -deps 1.e-7
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
index 38b22299467e9854543db55dcc56842bf56e5eff..27d01bbbbaf5b2a64e7e96c9d5d2c430e204bc3b 100644 (file)
@@ -91,6 +91,7 @@ proc chamf_sequence { args } {
      set shape_edges [lindex $args 1]
      set shape_faces [lindex $args 2]
 
+     global group
      global chamf_edge_face
      global chamf_type
      global chamf_parameters
@@ -134,7 +135,9 @@ proc chamf_sequence { args } {
                       set y1 $y
                       set z1 $z
                    } else {
+                     if { [string compare $group "equal_dist"] != 0 } {
                       lappend chamf_current "\[get_element $name $x $y $z $x1 $y1 $z1\]"
+                      }
                    }
                 }
         }
@@ -150,7 +153,9 @@ proc chamf_sequence { args } {
 # Compute new name of EDGE
             lset chamf_current 2 [expr [lindex $chamf_current 2]]
 # Compute new name of FACE
+           if { [string compare $group "equal_dist"] != 0 } {
             lset chamf_current 3 [expr [lindex $chamf_current 3]]
+            }
 
             set str "chamf $chamf_current"
             puts $str
@@ -194,6 +199,7 @@ proc chamf_sequence { args } {
 # Compute chamfer at one command or sequentially
 proc compute_chamf { args } {
      global command
+     global group
      if { [string compare $command "chamf_sequence"] == 0 } {
        chamf_sequence $args
      } else {
@@ -217,7 +223,11 @@ proc compute_chamf { args } {
        for {set i 0} {$i < $len} {incr i} {
            set ef [lindex $chamf_edge_face  $i]
            set p  [lindex $chamf_parameters $i]
-           set chamf_str "${chamf_str} ${shape_edges}_[lindex $ef 0] ${shape_faces}_[lindex $ef 1] $chamf_type $p"
+           if { [string compare $group "equal_dist"] == 0 } {
+              set chamf_str "${chamf_str} ${shape_edges}_[lindex $ef 0] $p"
+           } else {
+              set chamf_str "${chamf_str} ${shape_edges}_[lindex $ef 0] ${shape_faces}_[lindex $ef 1] $chamf_type $p"
+           }
        }
 
        puts $chamf_str
index 203f25fe0f6ad64294de1583143968484629e2d2..31a1d89915b10d0ce3d48194ddf66391b3650d1a 100644 (file)
@@ -15,7 +15,7 @@ if { [string compare $group "dist_dist"] == 0 } {
    set chamf_parameters $chamf_dist_dist
 }
 if { [string compare $group "equal_dist"] == 0 } {
-   set chamf_type S
+   set chamf_type ""
    set chamf_parameters $chamf_equal_dist
 }