Salome HOME
This commit was generated by cvs2git to create tag 'TRIPOLI_323'.
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_Tools3D.hxx
1 // Copyright (C) 2007-2012  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.
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_Tools3D.hxx
23 //  Created :
24 //  Author  : Peter KURNEV
25
26 #ifndef _GEOMAlgo_Tools3D_HeaderFile
27 #define _GEOMAlgo_Tools3D_HeaderFile
28
29 #include <Standard.hxx>
30 #include <Standard_Macro.hxx>
31 #include <Standard_Boolean.hxx>
32 #include <Handle_IntTools_Context.hxx>
33 #include <Standard_Integer.hxx>
34 #include <TopAbs_ShapeEnum.hxx>
35 #include <TopAbs_State.hxx>
36 #include <Standard_Real.hxx>
37 #include <NMTTools_ListOfCoupleOfShape.hxx>
38 #include <TopoDS_Shape.hxx>
39 #include <IntTools_Context.hxx>
40 #include <TopoDS_Face.hxx>
41 #include <TopoDS_Edge.hxx>
42 #include <TopTools_ListOfShape.hxx>
43 #include <TopTools_IndexedMapOfShape.hxx>
44 #include <TopoDS_Solid.hxx>
45 #include <gp_Pnt.hxx>
46 #include <TopoDS_Vertex.hxx>
47 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
48 #include <gp_Pnt2d.hxx>
49
50
51 //!  Auxiliary tools for Algorithms <br>
52 //=======================================================================
53 //class    : GEOMAlgo_Tools3D
54 //purpose  :
55 //=======================================================================
56 class GEOMAlgo_Tools3D  {
57  public:
58   //! Returns True if the shape theSplit has opposite <br>
59   //!          direction than theShape <br>
60   //!          theContext - cashed geometrical tools <br>
61   Standard_EXPORT
62     static  Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSplit,
63                                               const TopoDS_Shape& theShape,
64                                               const Handle(IntTools_Context)& theContext) ;
65
66   //! Returns True if normal direction of the face <br>
67   //!          theShape is not the same as for the face <br>
68   //!          theSplit <br>
69   //!          theContext - cashed geometrical tools <br>
70   Standard_EXPORT
71     static  Standard_Boolean IsSplitToReverse(const TopoDS_Face& theSplit,
72                                               const TopoDS_Face& theShape,
73                                               const Handle(IntTools_Context)& theContext) ;
74
75   //! Returns True if tangent direction of the edge <br>
76   //!          theEdge is not the same as for the edge <br>
77   //!          theSplit <br>
78   //!          theContext - cashed geometrical tools <br>
79   Standard_EXPORT
80     static  Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theEdge,
81                                               const TopoDS_Edge& theSplit,
82                                               const Handle(IntTools_Context)& theContext) ;
83
84   //! For the couple of faces theF1, theF2 <br>
85   //!          computes sense value <br>
86   //!          Returns 0 if the faces are not sensible <br>
87   //!          Returns 1 if the faces have same sense <br>
88   //!          Returns 2 if the faces have opposite sense <br>
89   Standard_EXPORT
90     static  Standard_Integer Sense(const TopoDS_Face& theF1,
91                                    const TopoDS_Face& theF2) ;
92
93   //! Makes new face theF2 from surface and wires <br>
94   //!          of the face theF1 <br>
95   Standard_EXPORT
96     static  void CopyFace(const TopoDS_Face& theF1,
97                           TopoDS_Face& theF2) ;
98
99   //! Makes empty shape theShape of the type theType <br>
100   Standard_EXPORT
101     static  void MakeContainer(const TopAbs_ShapeEnum theType,
102                                TopoDS_Shape& theShape) ;
103
104   //! For the list of faces theLS build block <br>
105   //!          theLSCB in terms of connexity by edges <br>
106   //!          theMapAvoid - set of edges to avoid for <br>
107   //!          the treatment <br>
108   Standard_EXPORT
109     static  void MakeConnexityBlock(const TopTools_ListOfShape& theLS,
110                                     const TopTools_IndexedMapOfShape& theMapAvoid,
111                                     TopTools_ListOfShape& theLSCB) ;
112
113   //! Computes the 3-D state of the shape theShape <br>
114   //!          toward solid theSolid. <br>
115   //!          theTol - value of precision of computation <br>
116   //!          theContext- cahed geometrical tools <br>
117   //!          Returns 3-D state. <br>
118   Standard_EXPORT
119     static  TopAbs_State ComputeStateByOnePoint(const TopoDS_Shape& theShape,
120                                                 const TopoDS_Solid& theSolid,
121                                                 const Standard_Real theTol,
122                                                 const Handle(IntTools_Context)& theContext) ;
123
124   //! Computes the 3-D state of the point thePoint <br>
125   //!          toward solid theSolid. <br>
126   //!          theTol - value of precision of computation <br>
127   //!          theContext- cahed geometrical tools <br>
128   //!          Returns 3-D state. <br>
129   Standard_EXPORT
130     static  TopAbs_State ComputeState(const gp_Pnt& thePoint,
131                                       const TopoDS_Solid& theSolid,
132                                       const Standard_Real theTol,
133                                       const Handle(IntTools_Context)& theContext) ;
134
135   //! Computes the 3-D state of the vertex theVertex <br>
136   //!          toward solid theSolid. <br>
137   //!          theTol - value of precision of computation <br>
138   //!          theContext- cahed geometrical tools <br>
139   //!          Returns 3-D state. <br>
140   Standard_EXPORT
141     static  TopAbs_State ComputeState(const TopoDS_Vertex& theVertex,
142                                       const TopoDS_Solid& theSolid,
143                                       const Standard_Real theTol,
144                                       const Handle(IntTools_Context)& theContext) ;
145
146   //! Computes the 3-D state of the edge theEdge <br>
147   //!          toward solid theSolid. <br>
148   //!          theTol - value of precision of computation <br>
149   //!          theContext- cahed geometrical tools <br>
150   //!          Returns 3-D state. <br>
151   Standard_EXPORT
152     static  TopAbs_State ComputeState(const TopoDS_Edge& theEdge,
153                                       const TopoDS_Solid& theSolid,
154                                       const Standard_Real theTol,
155                                       const Handle(IntTools_Context)& theContext) ;
156
157   //! Computes the 3-D state of the face theFace <br>
158   //!          toward solid theSolid. <br>
159   //!          theTol - value of precision of computation <br>
160   //!          theBounds - set of edges of theFace to avoid <br>
161   //!          theContext- cahed geometrical tools <br>
162   //!          Returns 3-D state. <br>
163   Standard_EXPORT
164     static  TopAbs_State ComputeState(const TopoDS_Face& theFace,
165                                       const TopoDS_Solid& theSolid,
166                                       const Standard_Real theTol,
167                                       const TopTools_IndexedMapOfShape& theBounds,
168                                       const Handle(IntTools_Context)& theContext) ;
169
170   //! Returns True if the face theFace is inside of the <br>
171   //!          couple of faces theFace1, theFace2. <br>
172   //!          The faces theFace, theFace1, theFace2  must <br>
173   //!          share the edge theEdge <br>
174   Standard_EXPORT
175     static  Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,
176                                             const TopoDS_Edge& theEdge,
177                                             const TopoDS_Face& theFace1,
178                                             const TopoDS_Face& theFace2,
179                                             const Handle(IntTools_Context)& theContext) ;
180
181   //! Returns True if the face theFace is inside of the <br>
182   //!          appropriate couple of faces (from the set theLF)    . <br>
183   //!          The faces of the set theLF and theFace  must <br>
184   //!          share the edge theEdge <br>
185   Standard_EXPORT
186     static  Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,
187                                             const TopoDS_Edge& theEdge,
188                                             const TopTools_ListOfShape& theLF,
189                                             const Handle(IntTools_Context)& theContext) ;
190
191   //! Returns True if the face theFace is inside the <br>
192   //!          solid theSolid. <br>
193   //!          theMEF - Map Edge/Faces for theSolid <br>
194   //!          theTol - value of precision of computation <br>
195   //!          theContext- cahed geometrical tools <br>
196   Standard_EXPORT
197     static  Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,
198                                             const TopoDS_Solid& theSolid,
199                                             const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
200                                             const Standard_Real theTol,
201                                             const Handle(IntTools_Context)& theContext) ;
202
203   //!  For the face theFace and its edge theEdge <br>
204   //!           finds the face suitable to produce shell. <br>
205   //!           theLCEF - set of faces to search. All faces <br>
206   //!           from theLCEF must share edge theEdge <br>
207   Standard_EXPORT
208     static  void GetFaceOff(const TopoDS_Edge& theEdge,
209                             const TopoDS_Face& theFace,
210                             const NMTTools_ListOfCoupleOfShape& theLCEF,
211                             TopoDS_Face& theFaceOff) ;
212
213   //! For the face theFace gets the edge theEdgeOnF <br>
214   //!          that is the same as theEdge <br>
215   //!          Returns True if such edge exists <br>
216   //!          Returns False if there is no such edge <br>
217   Standard_EXPORT
218     static  Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdge,
219                                            const TopoDS_Face& theFace,
220                                            TopoDS_Edge& theEdgeOnF) ;
221
222   //! Returns True if the face theFace contains <br>
223   //!          the edge theEdge but with opposite orientation. <br>
224   //!          If the method  returns True theEdgeOff is the <br>
225   //!          edge founded <br>
226   Standard_EXPORT
227     static  Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge,
228                                         const TopoDS_Face& theFace,
229                                         TopoDS_Edge& theEdgeOff) ;
230
231   //! Computes a point <theP> inside the face <theF>. <br>
232   //!          <theP2D> -  2D  representation of <theP> <br>
233   //!          on the surface of <theF> <br>
234   //!          Returns 0 in case of success. <br>
235   Standard_EXPORT
236     static  Standard_Integer PntInFace(const TopoDS_Face& theF,
237                                        gp_Pnt& theP,
238                                        gp_Pnt2d& theP2D) ;
239 };
240 #endif