]> OCCT Git - occt-copy.git/commitdiff
0022769: Optimization of sewing algorithm
authorama <>
Fri, 2 Dec 2011 14:29:24 +0000 (14:29 +0000)
committerbugmaster <bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:31:17 +0000 (19:31 +0400)
src/BRepLib/BRepLib.cxx
src/ChFi3d/ChFi3d_Builder_C1.cxx
src/Geom2dAdaptor/Geom2dAdaptor_Curve.cdl
src/Geom2dAdaptor/Geom2dAdaptor_Curve.cxx
src/Geom2dAdaptor/Geom2dAdaptor_Curve.lxx
src/GeomAdaptor/GeomAdaptor_Curve.cdl
src/GeomAdaptor/GeomAdaptor_Curve.cxx
src/GeomAdaptor/GeomAdaptor_Curve.lxx
src/GeomAdaptor/GeomAdaptor_Surface.cdl
src/GeomAdaptor/GeomAdaptor_Surface.cxx
src/GeomAdaptor/GeomAdaptor_Surface.lxx

index 02a4511e4ddc6bb2e7f8990db55d58d84b357301..d3a1b84bca3408fd2544e4a46f0ab732ef24a29e 100755 (executable)
@@ -1625,9 +1625,15 @@ void BRepLib::EncodeRegularity(const TopoDS_Shape& S,
     }
     if(found){
       if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){
-       if(tgtfaces(E, F1, F2, TolAng, couture)){
-         B.Continuity(E,F1,F2,GeomAbs_G1);
-       }
+
+        try {
+               if(tgtfaces(E, F1, F2, TolAng, couture)){
+                 B.Continuity(E,F1,F2,GeomAbs_G1);
+          }
+        }
+        catch(Standard_Failure)
+        {
+        }
       }
     }
   }
@@ -1645,9 +1651,14 @@ void BRepLib::EncodeRegularity(TopoDS_Edge& E,
 {
   BRep_Builder B;
   if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){
-    if( tgtfaces(E, F1, F2, TolAng, F1.IsEqual(F2))) {
-     B.Continuity(E,F1,F2,GeomAbs_G1);
-   }
+    try {
+      if( tgtfaces(E, F1, F2, TolAng, F1.IsEqual(F2))) {
+        B.Continuity(E,F1,F2,GeomAbs_G1);
+      }
+    }
+    catch(Standard_Failure)
+    {
+    }
  }
 }
 
index 3ae4c9e21689d74eab05bdc1929b4aee61381df8..656b68b6a4503e31520c3f85712932c799d4f084 100755 (executable)
@@ -973,13 +973,21 @@ void ChFi3d_Builder::PerformOneCorner(const Standard_Integer Index,
        Geom2dAdaptor_Curve anOtherPCurve;
        if (IShape == aData->IndexOfS1())
        {
-         anOtherPCurve.Load (aData->InterferenceOnS1().PCurveOnFace(),
+    const Handle(Geom2d_Curve)& aPCurve = aData->InterferenceOnS1().PCurveOnFace();
+    if(aPCurve.IsNull())
+      continue;
+
+         anOtherPCurve.Load (aPCurve,
                              aData->InterferenceOnS1().FirstParameter(),
                              aData->InterferenceOnS1().LastParameter());
        }
        else if (IShape == aData->IndexOfS2())
        {
-         anOtherPCurve.Load (aData->InterferenceOnS2().PCurveOnFace(),
+    const Handle(Geom2d_Curve)& aPCurve = aData->InterferenceOnS2().PCurveOnFace();
+    if(aPCurve.IsNull())
+      continue;
+
+         anOtherPCurve.Load (aPCurve,
                              aData->InterferenceOnS2().FirstParameter(),
                              aData->InterferenceOnS2().LastParameter());
        }
index 5cf1a4b1385b74ad44a54670cc8c2b7507a38c67..ebc482a53a0af08436350ae4b144ce8f2db172c0 100755 (executable)
@@ -45,10 +45,12 @@ is
        ---Purpose: ConstructionError is raised if Ufirst>Ulast
    
     Load(me : in out; C : Curve from Geom2d);
+       ---C++: inline
    
     Load(me : in out; C : Curve from Geom2d; UFirst,ULast : Real)
     raises 
        ConstructionError from Standard;
+       ---C++: inline
        ---Purpose: ConstructionError is raised if Ufirst>Ulast
 
     Curve(me) returns Curve from Geom2d
@@ -228,6 +230,9 @@ is
     
     LocalContinuity(me; U1, U2 : Real) returns Shape from GeomAbs 
     is static private;
+
+    load(me : in out; C : Curve from Geom2d; UFirst,ULast : Real)
+    is private;
    
 fields 
 
index c893a34949a0e8ac1d6a9bd31bed5be5eaa1abb5..c95302ff333b297a2c8fb59eac7d1c9570edf490 100755 (executable)
@@ -34,6 +34,7 @@
 
 #include <Standard_OutOfRange.hxx>
 #include <Standard_NoSuchObject.hxx>
+#include <Standard_NullObject.hxx>
 #include <Standard_NotImplemented.hxx>
 
 #define myBspl (*((Handle(Geom2d_BSplineCurve)*)&myCurve))
@@ -109,6 +110,9 @@ GeomAbs_Shape Geom2dAdaptor_Curve::LocalContinuity(const Standard_Real U1,
 //=======================================================================
 
 Geom2dAdaptor_Curve::Geom2dAdaptor_Curve()
+ : myTypeCurve(GeomAbs_OtherCurve),
+   myFirst(0.),
+   myLast(0.)
 {
 }
 
@@ -117,8 +121,9 @@ Geom2dAdaptor_Curve::Geom2dAdaptor_Curve()
 //purpose  : 
 //=======================================================================
 
-Geom2dAdaptor_Curve::Geom2dAdaptor_Curve(const Handle(Geom2d_Curve)& C) {
-  Load(C,C->FirstParameter(),C->LastParameter());
+Geom2dAdaptor_Curve::Geom2dAdaptor_Curve(const Handle(Geom2d_Curve)& C) 
+{
+  Load(C);
 }
 
 //=======================================================================
@@ -128,29 +133,21 @@ Geom2dAdaptor_Curve::Geom2dAdaptor_Curve(const Handle(Geom2d_Curve)& C) {
 
 Geom2dAdaptor_Curve::Geom2dAdaptor_Curve(const Handle(Geom2d_Curve)& C,
                                         const Standard_Real UFirst,
-                                        const Standard_Real ULast) {
-  if ( UFirst > ULast) Standard_ConstructionError::Raise();
+                                        const Standard_Real ULast) 
+{
   Load(C,UFirst,ULast);
 }
 
-//=======================================================================
-//function : Load
-//purpose  : 
-//=======================================================================
-
-void Geom2dAdaptor_Curve::Load(const Handle(Geom2d_Curve)& C) {
-  Load(C,C->FirstParameter(),C->LastParameter());
-}
 
 //=======================================================================
 //function : Load
 //purpose  : 
 //=======================================================================
 
-void Geom2dAdaptor_Curve::Load(const Handle(Geom2d_Curve)& C,
-                              const Standard_Real UFirst,
-                              const Standard_Real ULast) {
-  if ( UFirst > ULast) Standard_ConstructionError::Raise();
+void Geom2dAdaptor_Curve::load(const Handle(Geom2d_Curve)& C,
+                                                const Standard_Real UFirst,
+                                                const Standard_Real ULast) 
+{
   myFirst = UFirst;
   myLast  = ULast;
 
index cf2c7de71cf32686e72a16bef73b8fa25f1cf27e..7a044593cdc595205cb845349fe01eaef7eeb58b 100755 (executable)
@@ -6,6 +6,8 @@
 
 #include <gp_Pnt2d.hxx>
 #include <Geom2d_Curve.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <Standard_NullObject.hxx>
 
 //=======================================================================
 //function : FirstParameter
@@ -47,3 +49,30 @@ inline GeomAbs_CurveType Geom2dAdaptor_Curve::GetType() const
   return myTypeCurve;
 }
 
+//=======================================================================
+//function : Load
+//purpose  : 
+//=======================================================================
+
+inline void Geom2dAdaptor_Curve::Load(const Handle(Geom2d_Curve)& C) 
+{
+  if ( C.IsNull()) Standard_NullObject::Raise();
+  
+  load(C,C->FirstParameter(),C->LastParameter());
+}
+
+//=======================================================================
+//function : Load
+//purpose  : 
+//=======================================================================
+
+inline void Geom2dAdaptor_Curve::Load(const Handle(Geom2d_Curve)& C,
+                                                 const Standard_Real UFirst,
+                                                 const Standard_Real ULast) 
+{
+  if ( C.IsNull()) Standard_NullObject::Raise();
+
+  if ( UFirst > ULast) Standard_ConstructionError::Raise();
+  
+  load(C,UFirst,ULast);
+}
\ No newline at end of file
index 1721972f57729b072f56361cd1d5d60ba22fb39d..ec745c4cb30af0199927522106cd2cf23cf2c49d 100755 (executable)
@@ -52,6 +52,7 @@ is
    Load(me : in out; C : Curve from Geom; UFirst,ULast : Real)
    raises 
        ConstructionError from Standard;
+        ---C++: inline
        ---Purpose: ConstructionError is raised if Ufirst>Ulast
 
    Curve(me) returns Curve from Geom
@@ -263,6 +264,9 @@ is
 
    LocalContinuity(me; U1, U2 : Real) returns Shape from GeomAbs 
    is static private;
+
+   load(me : in out; C : Curve from Geom; UFirst,ULast : Real)
+   is private;
    
 fields 
 
index a335bf269a0661cd29929a98dc58d2b0291c2b38..3c65a4998c6d29352132438ae814754ae04efeb7 100755 (executable)
@@ -34,6 +34,7 @@
 
 #include <Standard_OutOfRange.hxx>
 #include <Standard_NoSuchObject.hxx>
+#include <Standard_NullObject.hxx>
 #include <Standard_NotImplemented.hxx>
 #include <Geom_OffsetCurve.hxx>
 
@@ -109,11 +110,10 @@ GeomAbs_Shape GeomAdaptor_Curve::LocalContinuity(const Standard_Real U1,
 //purpose  : 
 //=======================================================================
 
-void GeomAdaptor_Curve::Load(const Handle(Geom_Curve)& C,
+void GeomAdaptor_Curve::load(const Handle(Geom_Curve)& C,
                              const Standard_Real UFirst,
                              const Standard_Real ULast)
 {
-  if ( UFirst > ULast) Standard_ConstructionError::Raise();
   myFirst = UFirst;
   myLast  = ULast;
 
index 1ba265cf6c2afa21509ba4c8b48a46c19f76551c..de95aa7634b96ce57970d20b2dffab11692cafca 100755 (executable)
@@ -5,6 +5,9 @@
 
 #include <gp_Pnt.hxx>
 #include <Geom_Curve.hxx>
+#include <Standard_NullObject.hxx>
+#include <Standard_ConstructionError.hxx>
+
 
 //=======================================================================
 //function : GeomAdaptor_Curve
@@ -12,6 +15,9 @@
 //=======================================================================
 
 inline GeomAdaptor_Curve::GeomAdaptor_Curve()
+ : myTypeCurve(GeomAbs_OtherCurve),
+   myFirst(0.),
+   myLast(0.)
 {
 }
 
@@ -22,7 +28,7 @@ inline GeomAdaptor_Curve::GeomAdaptor_Curve()
 
 inline GeomAdaptor_Curve::GeomAdaptor_Curve(const Handle(Geom_Curve)& C)
 {
-  Load(C,C->FirstParameter(),C->LastParameter());
+  Load(C);
 }
 
 //=======================================================================
@@ -34,7 +40,6 @@ inline GeomAdaptor_Curve::GeomAdaptor_Curve(const Handle(Geom_Curve)& C,
                                             const Standard_Real UFirst,
                                             const Standard_Real ULast)
 {
-  if (UFirst > ULast) Standard_ConstructionError::Raise();
   Load(C,UFirst,ULast);
 }
 
@@ -45,9 +50,28 @@ inline GeomAdaptor_Curve::GeomAdaptor_Curve(const Handle(Geom_Curve)& C,
 
 inline void GeomAdaptor_Curve::Load(const Handle(Geom_Curve)& C)
 {
-  Load(C,C->FirstParameter(),C->LastParameter());
+  if ( C.IsNull()) Standard_NullObject::Raise();
+  
+  load(C,C->FirstParameter(),C->LastParameter());
+}
+
+//=======================================================================
+//function : Load
+//purpose  : 
+//=======================================================================
+
+inline void GeomAdaptor_Curve::Load(const Handle(Geom_Curve)& C,
+                                    const Standard_Real UFirst,
+                                    const Standard_Real ULast)
+{
+  if ( C.IsNull()) Standard_NullObject::Raise();
+  
+  if ( UFirst > ULast) Standard_ConstructionError::Raise();
+  
+  load(C,UFirst,ULast);
 }
 
+
 //=======================================================================
 //function : FirstParameter
 //purpose  : 
index 87e14e12252b1b9cdd04ca367953b15b26e80786..fdc4666f0144e22833827107f6d4c00ba9af812a 100755 (executable)
@@ -59,7 +59,8 @@ is
                       TolU  :  Real  =  0.0; 
                       TolV  :  Real  =  0.0)
     raises ConstructionError from Standard;
-    ---Purpose: ConstructionError is raised if UFirst>ULast or VFirst>VLast
+       ---C++: inline
+        ---Purpose: ConstructionError is raised if UFirst>ULast or VFirst>VLast
 
     Surface(me) returns Surface from Geom
        ---C++: return const&
@@ -358,17 +359,22 @@ is
     is redefined static;
   
   
-     Span (me;Side :Integer; Ideb,Ifin:Integer; 
-                  OutIdeb,OutIfin:out Integer; 
-           NbKnots : Integer ) 
-     is  private; 
+    Span (me;Side :Integer; Ideb,Ifin:Integer; 
+            OutIdeb,OutIfin:out Integer; 
+            NbKnots : Integer ) 
+    is  private; 
 
     IfUVBound (me;U,V :Real;Ideb,Ifin,IVdeb,IVfin :out Integer; 
                  USide,VSide:  Integer)  
        returns  Boolean  from  Standard                                    
-    is  private; 
-     
+    is  private;
+    
+    load (me : in out; S : Surface from Geom; 
+                      UFirst,ULast,VFirst,VLast :  Real; 
+                       TolU  :  Real  =  0.0; 
+                       TolV  :  Real  =  0.0)
+    is private;
+
 fields
 
     mySurface            : Surface          from Geom;
index d56c8d591ac62e13d71661eba4cd1b3beb7fac3e..595637dc312a19828f0f071bdb94aca03ec0c493 100755 (executable)
@@ -43,6 +43,7 @@
 #include <BSplCLib.hxx>
 #include <Precision.hxx>
 #include <Standard_NoSuchObject.hxx>
+#include <Standard_NullObject.hxx>
 
 #define myBspl (*((Handle(Geom_BSplineSurface)*)&mySurface))
 #define myExtSurf (*((Handle(Geom_SurfaceOfLinearExtrusion)*)&mySurface))
@@ -97,7 +98,7 @@ GeomAbs_Shape LocalContinuity(Standard_Integer         Degree,
 //purpose  : 
 //=======================================================================
 
-void GeomAdaptor_Surface::Load(const Handle(Geom_Surface)& S,
+void GeomAdaptor_Surface::load(const Handle(Geom_Surface)& S,
                                const Standard_Real UFirst,
                                const Standard_Real ULast,
                                const Standard_Real VFirst,
@@ -105,9 +106,6 @@ void GeomAdaptor_Surface::Load(const Handle(Geom_Surface)& S,
                                const Standard_Real TolU,
                                const Standard_Real TolV)
 {
-  if(UFirst>ULast || VFirst>VLast)
-    Standard_ConstructionError::Raise("GeomAdaptor_Surface::Load");
-
   myTolU =  TolU;
   myTolV =  TolV;  
   myUFirst = UFirst;
index 862d3497fa9d778849385371fca147478ec221f0..5e86cbae670e55f487527959beeaa426ce3fcae8 100755 (executable)
@@ -4,6 +4,8 @@
 // Copyright: OPEN CASCADE 1993
 
 #include <Geom_Surface.hxx>
+#include <Standard_NullObject.hxx>
+#include <Standard_ConstructionError.hxx>
 
 //=======================================================================
 //function : GeomAdaptor_Surface
 //=======================================================================
 
 inline GeomAdaptor_Surface::GeomAdaptor_Surface()
- : myTolU(0.), myTolV(0.)
-{} 
+ : mySurfaceType(GeomAbs_OtherSurface), 
+   myUFirst(0.),
+   myULast(0.),
+   myVFirst(0.),
+   myVLast (0.),
+   myTolU(0.), 
+   myTolV(0.)
+{
+} 
 
 //=======================================================================
 //function : GeomAdaptor_Surface
@@ -48,11 +57,35 @@ inline GeomAdaptor_Surface::GeomAdaptor_Surface(const Handle(Geom_Surface)& S,
 
 inline void GeomAdaptor_Surface::Load(const Handle(Geom_Surface)& S)
 {
+  if ( S.IsNull()) Standard_NullObject::Raise("GeomAdaptor_Surface::Load");
+
   Standard_Real U1,U2,V1,V2;
   S->Bounds(U1,U2,V1,V2);
-  Load(S,U1,U2,V1,V2);
+  load(S,U1,U2,V1,V2);
+}
+
+//=======================================================================
+//function : Load
+//purpose  : 
+//=======================================================================
+
+inline void GeomAdaptor_Surface::Load(const Handle(Geom_Surface)& S,
+                               const Standard_Real UFirst,
+                               const Standard_Real ULast,
+                               const Standard_Real VFirst,
+                               const Standard_Real VLast,
+                               const Standard_Real TolU,
+                               const Standard_Real TolV)
+{
+  if ( S.IsNull()) Standard_NullObject::Raise("GeomAdaptor_Surface::Load");
+
+  if(UFirst>ULast || VFirst>VLast)
+    Standard_ConstructionError::Raise("GeomAdaptor_Surface::Load");
+
+  load(S,UFirst,ULast,VFirst,VLast,TolU,TolV);
 }
 
+
 //=======================================================================
 //function : Surface
 //purpose  :