OCC22311 A regression was found: face obtained from 2D offset of a wire is invalid
[occt.git] / src / BRepFill / BRepFill_SectionLaw.cxx
1 // File:        BRepFill_SectionLaw.cxx
2 // Created:     Wed Jan  7 13:40:00 1998
3 // Author:      Philippe MANGIN
4 //              <pmn@sgi29>
5
6
7 #include <BRepFill_SectionLaw.ixx>
8
9 #include <BRepTools_WireExplorer.hxx>
10 #include <BRep_Tool.hxx>
11 #include <BRepAdaptor_Curve.hxx>
12 #include <BRepLProp.hxx>
13 #include <TopExp.hxx>
14 #include <TopoDS.hxx>
15 #include <TopoDS_Vertex.hxx>
16
17 #include <Geom_Curve.hxx>
18 #include <Geom_Line.hxx>
19 #include <Geom_TrimmedCurve.hxx>
20 #include <Geom_BSplineCurve.hxx>
21 #include <GeomFill_UniformSection.hxx>
22
23 #include <TColgp_HArray1OfPnt.hxx>
24 #include <TColStd_HArray1OfReal.hxx>
25 #include <TColStd_HArray1OfInteger.hxx>
26
27
28 #include <Precision.hxx>
29
30
31 //=======================================================================
32 //function : NbLaw
33 //purpose  : Donne le nombre de loi elementaire (ou Geometrique)
34 //=======================================================================
35  Standard_Integer BRepFill_SectionLaw::NbLaw() const
36 {
37   return myLaws->Length();
38 }
39
40
41 //=======================================================================
42 //function : Law
43 //purpose  : 
44 //=======================================================================
45  const Handle(GeomFill_SectionLaw)& 
46  BRepFill_SectionLaw::Law(const Standard_Integer Index) const
47 {
48   return myLaws->Value(Index);
49 }
50
51 //=======================================================================
52 //function : IsUClosed
53 //purpose  : 
54 //=======================================================================
55  Standard_Boolean BRepFill_SectionLaw::IsUClosed() const
56 {
57   return uclosed;
58 }
59
60 //=======================================================================
61 //function : IsVClosed
62 //purpose  : 
63 //=======================================================================
64  Standard_Boolean BRepFill_SectionLaw::IsVClosed() const
65 {
66   return vclosed;
67 }
68
69 //=======================================================================
70 //function : Init
71 //purpose  : Prepare le parcour d'un wire
72 //=======================================================================
73  void BRepFill_SectionLaw::Init(const TopoDS_Wire& W)
74 {
75   myIterator.Init(W);
76 }
77
78 //=======================================================================
79 //function : 
80 //purpose  : Parcourt d'un wire en sautant les Edges degenere
81 //=======================================================================
82  TopoDS_Edge BRepFill_SectionLaw::CurrentEdge() 
83 {
84   TopoDS_Edge E;
85 // Class BRep_Tool without fields and without Constructor :
86 //  BRep_Tool B;
87   Standard_Boolean Suivant = Standard_False;
88   if (myIterator.More()) {
89     E =  myIterator.Current();
90 //    Suivant = (B.Degenerated(E));
91     Suivant = (BRep_Tool::Degenerated(E));
92   }
93
94   while (Suivant) {
95      myIterator.Next();
96      E = myIterator.Current();
97 //     Suivant = (B.Degenerated(E) && myIterator.More());
98      Suivant = (BRep_Tool::Degenerated(E) && myIterator.More());
99    }
100
101   if (myIterator.More()) myIterator.Next();
102   return E;
103 }
104