]> OCCT Git - occt-copy.git/commitdiff
0023881: BRepAlgoAPI_Section HasAncestorFaceOn1 returned False on the boundary(6...
authoremv <emv@opencascade.com>
Mon, 15 Apr 2013 14:19:01 +0000 (18:19 +0400)
committeremv <emv@opencascade.com>
Mon, 15 Apr 2013 14:19:01 +0000 (18:19 +0400)
The methods HasAncestorFaceOn1() and HasAncestorFaceOn1() return true only in the case when their first argument is the new edge built from intersection curve and not an existing common edge.
PCurveOn1() and PCurveOn2() have been removed.
Methods PCurveOn1() and PCurveOn2() removed from BRepAlgo_Section class.
Added test case bugs/modalg_5/bug23881

src/BRepAlgo/BRepAlgo_Section.cdl
src/BRepAlgo/BRepAlgo_Section.cxx
src/BRepAlgoAPI/BRepAlgoAPI_Section.cdl
src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx
tests/bugs/modalg_5/bug23881 [new file with mode: 0644]

index 78eec0fc0616bf1b185a4c905a6afc8521d3abf6..2583354c32514afaa15b0164c11e7452de60f180 100755 (executable)
@@ -337,41 +337,6 @@ is
        -- ancestor face: F is significant only if the returned
        -- Boolean value equals true.
 
- PCurveOn1(me; E : Shape from TopoDS)
- returns Curve from Geom2d;
-       ---Purpose: Returns the pcurve attached to section edge E, in the
-       -- parametric space of  the first part
-       -- on which this algorithm has previously performed the
-       -- computation of a section.
-       -- Warning
-       -- - No pcurve is attached to an elementary edge of the
-       --   resulting section, and the function returns a null
-       --   handle, unless the function ComputePCurveOn1
-       --   or ComputePCurveOn2 was previously used to
-       --   define this sort of option of computation.
-       -- - A null handle is also returned if the edge E does
-       --   not belong to the last computed intersection, that is,
-       --   if it is not one of the elementary edges of the
-       --   compound object returned by the function Shape.
-
-
- PCurveOn2(me; E : Shape from TopoDS)
- returns Curve from Geom2d;
-       ---Purpose: Returns the pcurve attached to section edge E, in the
-       -- parametric space of  the second part
-       -- on which this algorithm has previously performed the
-       -- computation of a section.
-       -- Warning
-       -- - No pcurve is attached to an elementary edge of the
-       --   resulting section, and the function returns a null
-       --   handle, unless the function ComputePCurveOn1
-       --   or ComputePCurveOn2 was previously used to
-       --   define this sort of option of computation.
-       -- - A null handle is also returned if the edge E does
-       --   not belong to the last computed intersection, that is,
-       --   if it is not one of the elementary edges of the
-       --   compound object returned by the function Shape.
-
  InitParameters(me : out)
  ---Level: Public
  ---Level: Private
index b70eb14228f51f09b7737576cbee6ffd7f6f1441..c80dc4704ebe5cb110faadd1440882cde743e530 100755 (executable)
@@ -320,51 +320,6 @@ static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& );
   return res;
 }
 
-//=======================================================================
-//function : PCurve1
-//purpose  : 
-//=======================================================================
-  Handle(Geom2d_Curve) BRepAlgo_Section::PCurveOn1(const TopoDS_Shape& E) const
-{
-  Handle(Geom2d_Curve) PC;
-  const TopOpeBRepTool_GeomTool& GT = myHBuilder->BuildTool().GetGeomTool();
-  if (!GT.CompPC1()) return PC;
-
-  TopoDS_Shape F1,F2; Standard_Integer iC;
-  Standard_Boolean res = myHBuilder->EdgeCurveAncestors(E,F1,F2,iC);
-  if ( !res ) return PC;
-
-  const TopoDS_Edge& EE = TopoDS::Edge(E);
-  const TopoDS_Face& FF = TopoDS::Face(F1);
-  Standard_Real f,l; PC = BRep_Tool::CurveOnSurface(EE,FF,f,l);
-  Handle(Geom2d_TrimmedCurve) TC = new Geom2d_TrimmedCurve(PC,f,l);
-
-  return TC;
-}
-
-//=======================================================================
-//function : PCurve2
-//purpose  : 
-//=======================================================================
-  Handle(Geom2d_Curve) BRepAlgo_Section::PCurveOn2(const TopoDS_Shape& E) const
-{
-  Handle(Geom2d_Curve) PC;
-  const TopOpeBRepTool_GeomTool& GT = myHBuilder->BuildTool().GetGeomTool();
-  if (!GT.CompPC2()) return PC;
-
-  TopoDS_Shape F1,F2;
-  Standard_Integer iC;
-  Standard_Boolean res = myHBuilder->EdgeCurveAncestors(E,F1,F2,iC);
-  if ( !res ) return PC;
-
-  const TopoDS_Edge& EE = TopoDS::Edge(E);
-  const TopoDS_Face& FF = TopoDS::Face(F2);
-  Standard_Real f,l; PC = BRep_Tool::CurveOnSurface(EE,FF,f,l);
-  Handle(Geom2d_TrimmedCurve) TC = new Geom2d_TrimmedCurve(PC,f,l);
-
-  return TC;
-}
-
 //=======================================================================
 //function : InitParameters
 //purpose  : initialize the fields of the class
index c4b03ef820df50d617f359fbda4604f65566b862..b5f7a0d77e4bdd2e05c9165d77599f34a66ea7d9 100755 (executable)
@@ -308,31 +308,6 @@ is
        -- Boolean value before using the ancestor face: F is significant
        -- only if the returned Boolean value equals true.
 
-    PCurveOn1(me; E : Shape from TopoDS)
-       returns Curve from Geom2d;
-       ---Level: Public
-       ---Purpose: returns the PCurve connected to section edge <E>
-       -- and lying on first part of Section.
-       -- N.B : PCurve on first part is computed only if Section is performed
-       -- after setting ComputePCurveOn1(Standard_True).
-
-    PCurveOn2(me; E : Shape from TopoDS)
-       returns Curve from Geom2d;
-       ---Level: Public
-       ---Purpose: returns the PCurve connected to section edge <E>
-       -- and lying on second part of Section.
-       -- N.B : PCurve on second part is computed only if Section is performed
-       -- after setting ComputePCurveOn2(Standard_True).
-       -- Warning No pcurve is attached to an elementary edge of the
-       --    resulting section, and the function returns a null
-       --    handle, unless the function ComputePCurveOn1 or
-       --    ComputePCurveOn2 was previously used to define
-       --    this sort of option of computation.
-       -- -      A null handle is also returned if the edge E does
-       --    not belong to the last computed intersection, that
-       --    is, if it is not one of the elementary edges of the
-       --    compound object returned by the function Shape.
-        
     InitParameters(me: out)
        ---Level: Private
        is private;
index a088e394d4dc010eb91885c40638d62a048ac999..ab752063e04524ab8983605d2ef99599c10efa57 100755 (executable)
@@ -388,56 +388,6 @@ Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2(const TopoDS_Shape& E,T
   return aResult;
 }
 
-//=======================================================================
-//function : PCurveOn1
-//purpose  : 
-//=======================================================================
-Handle(Geom2d_Curve) BRepAlgoAPI_Section::PCurveOn1(const TopoDS_Shape& E) const
-{
-  Handle(Geom2d_Curve) aResult;
-  
-  if(myComputePCurve1) {
-    TopoDS_Shape aShape;
-
-    if(HasAncestorFaceOn1(E, aShape)) {
-      const TopoDS_Edge& anEdge = TopoDS::Edge(E);
-      const TopoDS_Face& aFace  = TopoDS::Face(aShape);
-      Standard_Real f, l;
-      aResult = BRep_Tool::CurveOnSurface(anEdge, aFace, f, l);
-
-      if(!aResult->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) {
-        aResult = new Geom2d_TrimmedCurve(aResult, f, l);
-      }
-    }
-  }
-  return aResult;
-}
-
-//=======================================================================
-//function : PCurveOn2
-//purpose  : 
-//=======================================================================
-Handle(Geom2d_Curve) BRepAlgoAPI_Section::PCurveOn2(const TopoDS_Shape& E) const
-{
-  Handle(Geom2d_Curve) aResult;
-  
-  if(myComputePCurve2) {
-    TopoDS_Shape aShape;
-
-    if(HasAncestorFaceOn2(E, aShape)) {
-      const TopoDS_Edge& anEdge = TopoDS::Edge(E);
-      const TopoDS_Face& aFace  = TopoDS::Face(aShape);
-      Standard_Real f, l;
-      aResult = BRep_Tool::CurveOnSurface(anEdge, aFace, f, l);
-      
-      if(!aResult->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve))) {
-        aResult = new Geom2d_TrimmedCurve(aResult, f, l);
-      }
-    }
-  }
-  return aResult;
-}
-
 //=======================================================================
 //function : InitParameters
 //purpose  : 
@@ -460,18 +410,17 @@ static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
                                          TopoDS_Shape&            F1,
                                          TopoDS_Shape&            F2) {
 
-  Standard_Integer aNb, i, j, nE, nF1, nF2, aNbCurves;;
+  Standard_Integer aNb, i, j, nE, nF1, nF2, aNbCurves;
   //
   const BOPDS_PDS& pDS = theDSFiller->PDS();
   BOPDS_VectorOfInterfFF& aFFs=pDS->InterfFF();
   //
   aNb=aFFs.Extent();
-
+  //section edges
   for (i = 0; i < aNb; i++) {
     BOPDS_InterfFF& aFFi=aFFs(i);
     aFFi.Indices(nF1, nF2);
     //
-    //section edges
     const BOPDS_VectorOfCurve& aSeqOfCurve=aFFi.Curves();
     aNbCurves=aSeqOfCurve.Extent();
     for (j=0; j<aNbCurves; j++) {
@@ -494,22 +443,6 @@ static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
         }
       }
     }
-
-    //existing pave blocks
-    BOPCol_ListOfInteger aLSE;
-    BOPCol_ListIteratorOfListOfInteger aItLSE;
-    //
-    pDS->SharedEdges(nF1, nF2, aLSE, theDSFiller->Allocator());
-    aItLSE.Initialize(aLSE);
-    for (; aItLSE.More(); aItLSE.Next()) {
-      nE = aItLSE.Value();
-      //
-      if(E.IsSame(pDS->Shape(nE))) {
-        F1 = pDS->Shape(nF1);
-        F2 = pDS->Shape(nF2);
-        return Standard_True;
-      }
-    }
   }
   return Standard_False;
 }
diff --git a/tests/bugs/modalg_5/bug23881 b/tests/bugs/modalg_5/bug23881
new file mode 100644 (file)
index 0000000..15ca2a7
--- /dev/null
@@ -0,0 +1,32 @@
+puts "============"
+puts "OCC23881"
+puts "============"
+puts ""
+############################################################################
+# BRepAlgoAPI_Section HasAnsectorFaceOn1 returned False on the boundary
+############################################################################
+
+polyline w1 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 
+polyline w2 0 1 0 1 1 0 1 2 0 0 2 0 0 1 0
+mkplane f1 w1
+mkplane f2 w2
+sewing s1 0.0001 f1 f2
+
+plane pl 0 1 0 0 1 0
+mkface f3 pl
+
+bsection r s1 f3
+
+# check that section edge (r) is the edge from original shape (s1)
+compound r s1 c
+if { ! [regexp {EDGE\s*:\s*([0-9]+)} [nbshapes s1] str nbedges_s1] ||
+     ! [regexp {EDGE\s*:\s*([0-9]+)} [nbshapes c ] str nbedges_c] } {
+    error "Could not get number of edges from resulting shapes"
+}
+if { $nbedges_s1 != $nbedges_c } {
+    puts "Error: section does not share common edge with original shape"
+}
+
+renamevar r result
+set 2dviewer 0