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