Salome HOME
19f9227b7e2add9ddb75d4c0c87d0d1dca9a1bce
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_AlgoTools.hxx
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File    : GEOMAlgo_AlgoTools.hxx
23 //  Created :
24 //  Author  : Peter KURNEV
25
26 #ifndef _GEOMAlgo_AlgoTools_HeaderFile
27 #define _GEOMAlgo_AlgoTools_HeaderFile
28
29 #include <Standard.hxx>
30 #include <Standard_Macro.hxx>
31 #include <Standard_Boolean.hxx>
32 #include <IntTools_Context.hxx>
33 #include <Standard_Integer.hxx>
34
35 #include <gp_Pnt.hxx>
36 #include <gp_Pnt2d.hxx>
37
38 #include <Geom_Surface.hxx>
39
40 #include <TopAbs_ShapeEnum.hxx>
41
42 #include <TopoDS_Face.hxx>
43 #include <TopoDS_Shape.hxx>
44 #include <TopoDS_Edge.hxx>
45
46 #include <TopTools_ListOfShape.hxx>
47 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
48 #include <TopTools_ListOfShape.hxx>
49 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
50
51 #include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
52 #include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
53 #include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
54
55 //!  Auxiliary tools for Algorithms <br>
56 //=======================================================================
57 //class    : GEOMAlgo_AlgoTools
58 //purpose  :
59 //=======================================================================
60 class GEOMAlgo_AlgoTools  {
61  public:
62
63   Standard_EXPORT
64     static void FaceNormal (const TopoDS_Face& aF,
65                             const Standard_Real U,
66                             const Standard_Real V,
67                             gp_Vec& aN);
68
69   //! Computes a point <theP> inside the face <theF>. <br>
70   //!          <theP2D> - 2D representation of <theP> <br>
71   //!          on the surface of <theF> <br>
72   //!          Returns 0 in case of success. <br>
73   Standard_EXPORT
74     static  Standard_Integer PntInFace(const TopoDS_Face& theF,
75                                        gp_Pnt& theP,
76                                        gp_Pnt2d& theP2D) ;
77
78   Standard_EXPORT
79     static  Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
80
81
82   Standard_EXPORT
83     static  Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ;
84
85   Standard_EXPORT
86     static  Standard_Integer RefineSDShapes
87       (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
88        const Standard_Real aTol,
89        const Handle(IntTools_Context)& aCtx) ;
90
91   Standard_EXPORT
92     static  Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
93                                           const Standard_Real aTol,
94                                           TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
95                                           const Handle(IntTools_Context)& aCtx) ;
96   Standard_EXPORT
97     static  Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,
98                                           const TopTools_ListOfShape& aLE,
99                                           const Standard_Real aTol,
100                                           TopTools_ListOfShape& aLESD,
101                                           const Handle(IntTools_Context)& aCtx) ;
102
103   Standard_EXPORT
104     static  void PointOnShape(const TopoDS_Shape& aS,
105                               gp_Pnt& aP3D) ;
106
107   Standard_EXPORT
108     static  void PointOnEdge(const TopoDS_Edge& aE,
109                              gp_Pnt& aP3D) ;
110
111   Standard_EXPORT
112     static  void PointOnEdge(const TopoDS_Edge& aE,
113                              const Standard_Real aT,gp_Pnt& aP3D) ;
114
115   Standard_EXPORT
116     static  void PointOnFace(const TopoDS_Face& aF,
117                              gp_Pnt& aP3D) ;
118
119   Standard_EXPORT
120     static  void PointOnFace(const TopoDS_Face& aF,
121                              const Standard_Real aU,
122                              const Standard_Real aV,
123                              gp_Pnt& aP3D) ;
124   Standard_EXPORT
125     static  Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,
126                                                  const TopoDS_Shape& aS,
127                                                  gp_Pnt& aP2,
128                                                  const Handle(IntTools_Context)& aCtx) ;
129
130   Standard_EXPORT
131     static void CorrectTolerances(const TopoDS_Shape& aShape,
132                                   const Standard_Real aMaxTol=0.0001);
133
134   Standard_EXPORT
135     static void CorrectPointOnCurve(const TopoDS_Shape& S,
136                                     const Standard_Real aMaxTol=0.0001);
137
138   Standard_EXPORT
139     static void CorrectCurveOnSurface(const TopoDS_Shape& S,
140                                       const Standard_Real aMaxTol=0.0001);
141
142
143   Standard_EXPORT
144     static Standard_Boolean IsSplitToReverse1 (const TopoDS_Edge& aEF1,
145                                                const TopoDS_Edge& aEF2,
146                                                const Handle(IntTools_Context)& aCtx) ;
147   Standard_EXPORT
148     static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
149                                           const TopoDS_Face& aF,
150                                           const Standard_Real aUMin,
151                                           const Standard_Real aUMax);
152
153   Standard_EXPORT
154     static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface) &aS);
155   
156   Standard_EXPORT
157     static void MakeContainer(const TopAbs_ShapeEnum theType,
158                               TopoDS_Shape& theC);
159
160   Standard_EXPORT
161     static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit,
162                                              const TopoDS_Edge& theEdge,
163                                              const Handle(IntTools_Context)& theCtx) ;
164   
165   Standard_EXPORT
166     static Standard_Boolean IsSplitToReverse  (const TopoDS_Face& theFSp,
167                                                const TopoDS_Face& theFSr,
168                                                const Handle(IntTools_Context)& theCtx) ;
169   
170   Standard_EXPORT
171     static Standard_Boolean IsSplitToReverse  (const TopoDS_Shape& theSp,
172                                                const TopoDS_Shape& theSr,
173                                                const Handle(IntTools_Context)& theCtx) ;
174   Standard_EXPORT
175     static Standard_Integer BuildPCurveForEdgeOnFace  (const TopoDS_Edge& aEold,
176                                                        const TopoDS_Edge& aEnew,
177                                                        const TopoDS_Face& aF,
178                                                        const Handle(IntTools_Context)& aCtx) ;
179
180 //
181   Standard_EXPORT
182     static void FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
183                            GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
184
185   Standard_EXPORT
186     static void FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
187                            GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
188
189   Standard_EXPORT
190     static  void CopyShape(const TopoDS_Shape& aS,
191                            TopoDS_Shape& aSC) ;
192   
193   Standard_EXPORT
194     static  void CopyShape(const TopoDS_Shape& aS,
195                            TopoDS_Shape& aSC,
196                            TopTools_IndexedDataMapOfShapeShape& aMSS) ;
197 };
198 #endif