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