Salome HOME
added new GlueFaces feature
[modules/shaper.git] / src / GeomAlgoImpl / 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 <GeomAlgoImpl.h>
30
31 #include <Standard.hxx>
32 #include <Standard_Macro.hxx>
33 #include <Standard_Boolean.hxx>
34 #include <IntTools_Context.hxx>
35 #include <Standard_Integer.hxx>
36
37 #include <gp_Pnt.hxx>
38 #include <gp_Pnt2d.hxx>
39
40 #include <Geom_Surface.hxx>
41
42 #include <TopAbs_ShapeEnum.hxx>
43
44 #include <TopoDS_Face.hxx>
45 #include <TopoDS_Shape.hxx>
46 #include <TopoDS_Edge.hxx>
47 #include <TopoDS_Compound.hxx>
48
49 #include <TopTools_ListOfShape.hxx>
50 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
51 #include <TopTools_ListOfShape.hxx>
52 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
53
54 #include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
55 #include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
56 #include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
57
58
59 //!  Auxiliary tools for Algorithms <br>
60 //=======================================================================
61 //class    : GEOMAlgo_AlgoTools
62 //purpose  :
63 //=======================================================================
64 class GEOMAlgo_AlgoTools  {
65  public:
66
67   GEOMALGOIMPL_EXPORT
68     static void FaceNormal(const TopoDS_Face& aF,
69                            const Standard_Real U,
70                            const Standard_Real V,
71                            gp_Vec& aN);
72
73   //! Computes a point <theP> inside the face <theF>. <br>
74   //!          <theP2D> - 2D representation of <theP> <br>
75   //!          on the surface of <theF> <br>
76   //!          Returns 0 in case of success. <br>
77   GEOMALGOIMPL_EXPORT
78     static Standard_Integer PntInFace(const TopoDS_Face& theF,
79                                       gp_Pnt& theP,
80                                       gp_Pnt2d& theP2D);
81
82   //! Computes a set of points inside the face <theF>. <br>
83   //!          Returns 0 in case of success. <br>
84   GEOMALGOIMPL_EXPORT
85     static Standard_Integer PointCloudInFace(const TopoDS_Face& theF,
86                                              const int          theNbPnts,
87                                              TopoDS_Compound&   theCompound);
88
89   GEOMALGOIMPL_EXPORT
90     static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS);
91
92
93   GEOMALGOIMPL_EXPORT
94     static Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS);
95
96   GEOMALGOIMPL_EXPORT
97     static Standard_Integer RefineSDShapes(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
98                                            const Standard_Real aTol,
99                                            const Handle(IntTools_Context)& aCtx);
100
101   GEOMALGOIMPL_EXPORT
102     static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
103                                          const Standard_Real aTol,
104                                          TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
105                                          const Handle(IntTools_Context)& aCtx);
106
107   GEOMALGOIMPL_EXPORT
108     static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,
109                                          const TopTools_ListOfShape& aLE,
110                                          const Standard_Real aTol,
111                                          TopTools_ListOfShape& aLESD,
112                                          const Handle(IntTools_Context)& aCtx);
113
114   GEOMALGOIMPL_EXPORT
115     static void PointOnShape(const TopoDS_Shape& aS,
116                                                gp_Pnt& aP3D);
117
118   GEOMALGOIMPL_EXPORT
119     static void PointOnEdge(const TopoDS_Edge& aE,
120                                               gp_Pnt& aP3D);
121
122   GEOMALGOIMPL_EXPORT
123     static void PointOnEdge(const TopoDS_Edge& aE,
124                                               const Standard_Real aT,gp_Pnt& aP3D);
125
126   GEOMALGOIMPL_EXPORT
127     static void PointOnFace(const TopoDS_Face& aF,
128                                               gp_Pnt& aP3D);
129
130   GEOMALGOIMPL_EXPORT
131     static void PointOnFace(const TopoDS_Face& aF,
132                             const Standard_Real aU,
133                             const Standard_Real aV,
134                             gp_Pnt& aP3D);
135
136   GEOMALGOIMPL_EXPORT
137     static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,
138                                                 const TopoDS_Shape& aS,
139                                                 gp_Pnt& aP2,
140                                                 const Handle(IntTools_Context)& aCtx);
141
142   GEOMALGOIMPL_EXPORT
143     static void CorrectTolerances(const TopoDS_Shape& aShape,
144                                                           const Standard_Real aMaxTol=0.0001);
145
146   GEOMALGOIMPL_EXPORT
147     static void CorrectPointOnCurve(const TopoDS_Shape& S,
148                                                             const Standard_Real aMaxTol=0.0001);
149
150   GEOMALGOIMPL_EXPORT
151     static void CorrectCurveOnSurface(const TopoDS_Shape& S,
152                                                               const Standard_Real aMaxTol=0.0001);
153
154
155   GEOMALGOIMPL_EXPORT
156     static Standard_Boolean IsSplitToReverse1(const TopoDS_Edge& aEF1,
157                                               const TopoDS_Edge& aEF2,
158                                               const Handle(IntTools_Context)& aCtx);
159
160   GEOMALGOIMPL_EXPORT
161     static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
162                                           const TopoDS_Face& aF,
163                                           const Standard_Real aUMin,
164                                           const Standard_Real aUMax);
165
166   GEOMALGOIMPL_EXPORT
167     static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface) &aS);
168   
169   GEOMALGOIMPL_EXPORT
170     static void MakeContainer(const TopAbs_ShapeEnum theType,
171                                               TopoDS_Shape& theC);
172
173   GEOMALGOIMPL_EXPORT
174     static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit,
175                                              const TopoDS_Edge& theEdge,
176                                              const Handle(IntTools_Context)& theCtx);
177   
178   GEOMALGOIMPL_EXPORT
179     static Standard_Boolean IsSplitToReverse(const TopoDS_Face& theFSp,
180                                              const TopoDS_Face& theFSr,
181                                              const Handle(IntTools_Context)& theCtx);
182   
183   GEOMALGOIMPL_EXPORT
184     static Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSp,
185                                              const TopoDS_Shape& theSr,
186                                              const Handle(IntTools_Context)& theCtx);
187
188   GEOMALGOIMPL_EXPORT
189     static Standard_Integer BuildPCurveForEdgeOnFace(const TopoDS_Edge& aEold,
190                                                      const TopoDS_Edge& aEnew,
191                                                      const TopoDS_Face& aF,
192                                                      const Handle(IntTools_Context)& aCtx);
193
194 //
195   GEOMALGOIMPL_EXPORT
196     static void FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
197                                              GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
198
199   GEOMALGOIMPL_EXPORT
200     static void FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
201                                              GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
202
203   GEOMALGOIMPL_EXPORT
204     static void CopyShape(const TopoDS_Shape& aS,
205                                           TopoDS_Shape& aSC);
206   
207   GEOMALGOIMPL_EXPORT
208     static void CopyShape(const TopoDS_Shape& aS,
209                           TopoDS_Shape& aSC,
210                           TopTools_IndexedDataMapOfShapeShape& aMSS);
211 };
212
213 #endif