]> OCCT Git - occt.git/commitdiff
0031805: Data Exchange, XT - Invalid shape on file translation CR31805_2
authoratereshi <andrey.tereshin@opencascade.com>
Tue, 29 Nov 2022 09:27:13 +0000 (12:27 +0300)
committeratereshi <andrey.tereshin@opencascade.com>
Tue, 29 Nov 2022 09:27:13 +0000 (12:27 +0300)
src/GeomInt/GeomInt_IntSS.hxx
src/GeomInt/GeomInt_IntSS.lxx
src/IntAna/IntAna_QuadQuadGeo.cxx
src/IntAna/IntAna_QuadQuadGeo.hxx
src/IntPatch/IntPatch_ImpImpIntersection.hxx
src/IntPatch/IntPatch_ImpImpIntersection.lxx
src/IntPatch/IntPatch_ImpImpIntersection_1.gxx
src/IntPatch/IntPatch_ImpImpIntersection_2.gxx
src/IntPatch/IntPatch_ImpImpIntersection_5.gxx
src/IntPatch/IntPatch_Intersection.cxx
src/IntPatch/IntPatch_Intersection.hxx

index 943a59bf279d88d85e7e6b0db90f62463e4c97a5..ed9531ea6aa6e7e63c93a47e909ed95194a14fc7 100644 (file)
@@ -90,6 +90,9 @@ public:
   
   Standard_EXPORT void TolFixTangents (Standard_Real& aTolCheck, Standard_Real& aTolAngCheck);
   
+  //! Set angular tolerance
+  Standard_EXPORT void SetAngularTolerance (Standard_Real theAngularTolerance);
+  
   //! converts RLine to Geom(2d)_Curve.
   Standard_EXPORT static void TreatRLine (const Handle(IntPatch_RLine)& theRL, const Handle(GeomAdaptor_Surface)& theHS1, const Handle(GeomAdaptor_Surface)& theHS2, Handle(Geom_Curve)& theC3d, Handle(Geom2d_Curve)& theC2d1, Handle(Geom2d_Curve)& theC2d2, Standard_Real& theTolReached);
   
index bb80020e6942d65aba42fecea08e53839448f5fe..4455cad1dd9aca789d4485bf0fad9fc2ea93d40c 100644 (file)
@@ -146,3 +146,12 @@ inline GeomInt_IntSS::GeomInt_IntSS ()
 {
   return myIntersector.Point(Index).Value();
 }
+
+//=======================================================================
+//function : SetAngularTolerance
+//purpose  : 
+//=======================================================================
+inline void GeomInt_IntSS::SetAngularTolerance (Standard_Real theAngularTolerance)
+{
+  myIntersector.SetAngularTolerance(theAngularTolerance);
+}
index 3ab50bcd85b268dd146678935d53922a16ada2a1..24ede661e3320b6927df4c5227e568356072d881 100644 (file)
@@ -254,24 +254,53 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D)
 //purpose  : Empty constructor
 //=======================================================================
 IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(void)
-    : done(Standard_False),
-      nbint(0),
-      typeres(IntAna_Empty),
-      pt1(0,0,0),
-      pt2(0,0,0),
-      pt3(0,0,0),
-      pt4(0,0,0),
-      param1(0),
-      param2(0),
-      param3(0),
-      param4(0),
-      param1bis(0),
-      param2bis(0),
-      myCommonGen(Standard_False),
-      myPChar(0,0,0)
+: done(Standard_False),
+  nbint(0),
+  typeres(IntAna_Empty),
+  pt1(0,0,0),
+  pt2(0,0,0),
+  pt3(0,0,0),
+  pt4(0,0,0),
+  param1(0),
+  param2(0),
+  param3(0),
+  param4(0),
+  param1bis(0),
+  param2bis(0),
+  myCommonGen(Standard_False),
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
+{
+  InitTolerances();
+}
+
+//=======================================================================
+//function : IntAna_QuadQuadGeo
+//purpose  : Constructor with angular tolerance
+//=======================================================================
+IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(Standard_Real theAngularTolerance, Standard_Boolean theUseAngularTolerance)
+: done(Standard_False),
+  nbint(0),
+  typeres(IntAna_Empty),
+  pt1(0,0,0),
+  pt2(0,0,0),
+  pt3(0,0,0),
+  pt4(0,0,0),
+  param1(0),
+  param2(0),
+  param3(0),
+  param4(0),
+  param1bis(0),
+  param2bis(0),
+  myCommonGen(Standard_False),
+  myPChar(0,0,0),
+  myAngularTolerance(theAngularTolerance),
+  myUseAngularTolerance(theUseAngularTolerance)
 {
   InitTolerances();
 }
+
 //=======================================================================
 //function : InitTolerances
 //purpose  : 
@@ -279,12 +308,20 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(void)
 void IntAna_QuadQuadGeo::InitTolerances()
 {
   myEPSILON_DISTANCE               = 1.0e-14;
-  myEPSILON_ANGLE_CONE             = Precision::Angular();
+  if (myUseAngularTolerance)
+  {
+    myEPSILON_ANGLE_CONE             = myAngularTolerance;
+  }
+  else
+  {
+    myEPSILON_ANGLE_CONE             = Precision::Angular();
+  }
   myEPSILON_MINI_CIRCLE_RADIUS     = 0.01*Precision::Confusion();
   myEPSILON_CYLINDER_DELTA_RADIUS  = 1.0e-13;
   myEPSILON_CYLINDER_DELTA_DISTANCE= Precision::Confusion();
   myEPSILON_AXES_PARA              = Precision::Angular();
 }
+
 //=======================================================================
 //function : IntAna_QuadQuadGeo
 //purpose  : Pln  Pln 
@@ -307,7 +344,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Pln& P1,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(P1,P2,TolAng,Tol);
@@ -652,7 +691,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo( const gp_Pln& P
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(P,Co,Tolang,Tol);
@@ -868,7 +909,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Pln& P,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(P,S);
@@ -937,7 +980,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl1,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Cyl1,Cyl2,Tol);
@@ -1222,7 +1267,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Cyl,Con,Tol);
@@ -1278,7 +1325,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Cyl,Sph,Tol);
@@ -1344,7 +1393,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Con1,Con2,Tol);
@@ -1800,7 +1851,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Sph,Con,Tol);
@@ -1912,7 +1965,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Sph1,Sph2,Tol);
@@ -2026,7 +2081,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Pln& Pln,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Pln,Tor,Tol);
@@ -2138,7 +2195,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Cyl,Tor,Tol);
@@ -2221,7 +2280,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cone& Con,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Con,Tor,Tol);
@@ -2359,7 +2420,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Sphere& Sph,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Sph,Tor,Tol);
@@ -2456,7 +2519,9 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Torus& Tor1,
   param1bis(0),
   param2bis(0),
   myCommonGen(Standard_False),
-  myPChar(0,0,0)
+  myPChar(0,0,0),
+  myAngularTolerance(0.0),
+  myUseAngularTolerance(Standard_False)
 {
   InitTolerances();
   Perform(Tor1,Tor2,Tol);
@@ -2692,6 +2757,7 @@ const gp_Pnt& IntAna_QuadQuadGeo::PChar() const
 {
   return myPChar;
 }
+
 //=======================================================================
 //function : RefineDir
 //purpose  : 
index 534a8ca5a6da5783d689381dcb3f826625bcd293..55b4bfa1ac141a9b8904554830db2dcf6da49d9a 100644 (file)
@@ -61,6 +61,9 @@ public:
   //! Empty constructor.
   Standard_EXPORT IntAna_QuadQuadGeo();
   
+  //! Constructor with angular tolerance
+  Standard_EXPORT IntAna_QuadQuadGeo(Standard_Real theAngularTolerance, Standard_Boolean theUseAngularTolerance);
+  
   //! Creates the intersection between two planes.
   //! TolAng is the angular tolerance used to determine
   //! if the planes are parallel.
@@ -261,7 +264,8 @@ protected:
   Standard_Real myEPSILON_AXES_PARA;
   Standard_Boolean myCommonGen;
   gp_Pnt myPChar;
-
+  Standard_Real myAngularTolerance;
+  Standard_Boolean myUseAngularTolerance;
 
 private:
 
index 4954470cf9306426e292f52e62352343c58f9b67..c6c7c65d1c8acd033eefb8ee1317366a64142ceb 100644 (file)
@@ -108,8 +108,8 @@ public:
   //! An exception is raised if Index<=0 or Index>NbLine.
     const Handle(IntPatch_Line)& Line (const Standard_Integer Index) const;
 
-
-
+  //! Sets the angular tolerance
+  void SetAngularTolerance (Standard_Real theAngularTolerance);
 
 protected:
 
@@ -128,7 +128,8 @@ private:
   IntPatch_SequenceOfPoint spnt;
   IntPatch_SequenceOfLine slin;
   IntPatch_TheSOnBounds solrst;
-
+  Standard_Real myAngularTolerance;
+  Standard_Boolean myUseAngularTolerance;
 
 };
 
index b43026b6815885e3fa46111957e8b164f7e7329e..5c2a5ec20f2839dc2b5c8eff088ab7dfa19e3eba 100644 (file)
@@ -71,3 +71,9 @@ inline const Handle(IntPatch_Line)& IntPatch_ImpImpIntersection::Line (const Sta
   if (!IsDone ()) { throw StdFail_NotDone(); }
   return slin(Index);
 }
+
+inline void IntPatch_ImpImpIntersection::SetAngularTolerance (Standard_Real theAngularTolerance)
+{
+  myAngularTolerance = theAngularTolerance;
+  myUseAngularTolerance = Standard_True;
+}
index 9ab3fd04c2f2cd262c184ffc8b2f1d7bac50e3cc..a27c86c1aa21c4e81956357073b7b02a072cba8d 100644 (file)
@@ -125,7 +125,9 @@ static Standard_Boolean IntCoCo(const IntSurf_Quadric&,
                                Standard_Boolean&,
                                Standard_Boolean&,
                                IntPatch_SequenceOfLine&,
-                               IntPatch_SequenceOfPoint&);
+                               IntPatch_SequenceOfPoint&,
+                               Standard_Boolean theUseAngularTolerance = Standard_False,
+                               Standard_Real theAngularTolerance = 0.0);
 
 //torus
 static Standard_Boolean IntPTo(const IntSurf_Quadric&,
index d2f25895cd33c5275b89da8bb4d60c710375677e..ddf122884b2835cc0ba28d6fa409e787a0003488 100644 (file)
@@ -29,7 +29,8 @@ IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection ():
 myDone(IntStatus_Fail),
 empt(Standard_True),
 tgte(Standard_False),
-oppo(Standard_False)
+oppo(Standard_False),
+myUseAngularTolerance(Standard_False)
 {
 }
 //=======================================================================
@@ -231,7 +232,7 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_Surface)&  S1,
     }
     //
     case 33: { // Cone/Cone
-      if (!IntCoCo(quad1, quad2, TolTang, empt, SameSurf, multpoint, slin, spnt)) {
+      if (!IntCoCo(quad1, quad2, TolTang, empt, SameSurf, multpoint, slin, spnt, myUseAngularTolerance, myAngularTolerance)) {
         return;
       }
       bEmpty = empt;
index bdbe126434390462838f02c30936c08906257c8f..36a9e75321cef6c7176a7710c8036effd85a1611 100644 (file)
@@ -27,7 +27,9 @@ Standard_Boolean IntCoCo(const IntSurf_Quadric& Quad1,
                         Standard_Boolean& Same,
                         Standard_Boolean& Multpoint,
                         IntPatch_SequenceOfLine& slin,
-                        IntPatch_SequenceOfPoint& spnt)
+                        IntPatch_SequenceOfPoint& spnt,
+                        Standard_Boolean theUseAngularTolerance,
+                        Standard_Real theAngularTolerance)
 
 {
   Standard_Integer i, NbSol;
@@ -38,7 +40,8 @@ Standard_Boolean IntCoCo(const IntSurf_Quadric& Quad1,
   gp_Cone Co1(Quad1.Cone());
   gp_Cone Co2(Quad2.Cone());
   //
-  IntAna_QuadQuadGeo inter(Co1,Co2,Tol);
+  IntAna_QuadQuadGeo inter(theAngularTolerance, theUseAngularTolerance);
+  inter.Perform(Co1,Co2,Tol);
   if (!inter.IsDone()) {
     return Standard_False;
   }
index b06c8513d146ab55a588f415b4ea132c138fcbd2..c243787514ab2182cc911f99b531167e87e7aa12 100644 (file)
@@ -53,7 +53,8 @@ IntPatch_Intersection::IntPatch_Intersection ()
    myU1Start(0.0),
    myV1Start(0.0),
    myU2Start(0.0),
-   myV2Start(0.0)
+   myV2Start(0.0),
+   myUseAngularTolerance(Standard_False)
 {
 }
 
@@ -76,7 +77,8 @@ IntPatch_Intersection::IntPatch_Intersection(const Handle(Adaptor3d_Surface)&  S
    myU1Start(0.0),
    myV1Start(0.0),
    myU2Start(0.0),
-   myV2Start(0.0)
+   myV2Start(0.0),
+   myUseAngularTolerance(Standard_False)
 {
   if(myTolArc<1e-8) myTolArc=1e-8;
   if(myTolTang<1e-8) myTolTang=1e-8;
@@ -102,7 +104,8 @@ IntPatch_Intersection::IntPatch_Intersection(const Handle(Adaptor3d_Surface)&  S
    myU1Start(0.0),
    myV1Start(0.0),
    myU2Start(0.0),
-   myV2Start(0.0)
+   myV2Start(0.0),
+   myUseAngularTolerance(Standard_False)
 {
   Perform(S1,D1,TolArc,TolTang);
 }
@@ -129,6 +132,12 @@ void IntPatch_Intersection::SetTolerances(const Standard_Real TolArc,
   if(myUVMaxStep>0.5) myUVMaxStep=0.5;
 }
 
+void IntPatch_Intersection::SetAngularTolerance (Standard_Real theAngularTolerance)
+{
+  myAngularTolerance = theAngularTolerance;
+  myUseAngularTolerance = Standard_True;
+}
+
 //======================================================================
 // function: Perform
 //======================================================================
@@ -1354,8 +1363,13 @@ void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_Surface)& theS
                                            const GeomAbs_SurfaceType theTyps2,
                                            const Standard_Boolean theIsReqToKeepRLine)
 {
-  IntPatch_ImpImpIntersection interii(theS1,theD1,theS2,theD2,
-                                      myTolArc,myTolTang, theIsReqToKeepRLine);
+  IntPatch_ImpImpIntersection interii;
+
+  if (myUseAngularTolerance)
+  {
+    interii.SetAngularTolerance(myAngularTolerance);
+  }
+  interii.Perform(theS1, theD1, theS2, theD2, myTolArc, myTolTang, theIsReqToKeepRLine);
 
   if (!interii.IsDone())
   {
index aeb80faf7bd3abbd07889dc92929de5899cdb891..5a59f0e2957032f1b72e6100ab0c1cd733bd4dbd 100644 (file)
@@ -62,6 +62,8 @@ public:
   //! points in their respective parametric spaces.
   Standard_EXPORT void SetTolerances (const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Real UVMaxStep, const Standard_Real Fleche);
   
+  Standard_EXPORT void SetAngularTolerance (Standard_Real theAngularTolerance);
+  
   //! Flag theIsReqToKeepRLine has been entered only for
   //! compatibility with TopOpeBRep package. It shall be deleted
   //! after deleting TopOpeBRep.
@@ -197,7 +199,8 @@ private:
   Standard_Real myV1Start;
   Standard_Real myU2Start;
   Standard_Real myV2Start;
-
+  Standard_Real myAngularTolerance;
+  Standard_Boolean myUseAngularTolerance;
 
 };