1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef _GEOMAlgo_Tools3D_HeaderFile
24 #define _GEOMAlgo_Tools3D_HeaderFile
26 #ifndef _Standard_Boolean_HeaderFile
27 #include <Standard_Boolean.hxx>
29 #ifndef _Standard_Integer_HeaderFile
30 #include <Standard_Integer.hxx>
32 #ifndef _TopAbs_ShapeEnum_HeaderFile
33 #include <TopAbs_ShapeEnum.hxx>
35 #ifndef _TopAbs_State_HeaderFile
36 #include <TopAbs_State.hxx>
38 #ifndef _Standard_Real_HeaderFile
39 #include <Standard_Real.hxx>
42 class IntTools_Context;
45 class TopTools_ListOfShape;
46 class TopTools_IndexedMapOfShape;
50 class TopTools_IndexedDataMapOfShapeListOfShape;
51 class NMTTools_ListOfCoupleOfShape;
54 #ifndef _Standard_HeaderFile
55 #include <Standard.hxx>
57 #ifndef _Standard_Macro_HeaderFile
58 #include <Standard_Macro.hxx>
61 //! Auxiliary tools for Algorithms <br>
62 class GEOMAlgo_Tools3D {
66 void* operator new(size_t,void* anAddress)
70 void* operator new(size_t size)
72 return Standard::Allocate(size);
74 void operator delete(void *anAddress)
76 if (anAddress) Standard::Free((Standard_Address&)anAddress);
81 //! Returns True if the shape theSplit has opposite <br>
82 //! direction than theShape <br>
83 //! theContext - cashed geometrical tools <br>
84 Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSplit,const TopoDS_Shape& theShape,IntTools_Context& theContext) ;
86 //! Returns True if normal direction of the face <br>
87 //! theShape is not the same as for the face <br>
89 //! theContext - cashed geometrical tools <br>
90 Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Face& theSplit,const TopoDS_Face& theShape,IntTools_Context& theContext) ;
92 //! Returns True if tangent direction of the edge <br>
93 //! theEdge is not the same as for the edge <br>
95 //! theContext - cashed geometrical tools <br>
96 Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theEdge,const TopoDS_Edge& theSplit,IntTools_Context& theContext) ;
98 //! For the couple of faces theF1, theF2 <br>
99 //! computes sense value <br>
100 //! Returns 0 if the faces are not sensible <br>
101 //! Returns 1 if the faces have same sense <br>
102 //! Returns 2 if the faces have opposite sense <br>
103 Standard_EXPORT static Standard_Integer Sense(const TopoDS_Face& theF1,const TopoDS_Face& theF2) ;
105 //! Makes new face theF2 from surface and wires <br>
106 //! of the face theF1 <br>
107 Standard_EXPORT static void CopyFace(const TopoDS_Face& theF1,TopoDS_Face& theF2) ;
109 //! Makes empty shape theShape of the type theType <br>
110 Standard_EXPORT static void MakeContainer(const TopAbs_ShapeEnum theType,TopoDS_Shape& theShape) ;
112 //! For the list of faces theLS build block <br>
113 //! theLSCB in terms of connexity by edges <br>
114 //! theMapAvoid - set of edges to avoid for <br>
115 //! the treatment <br>
116 Standard_EXPORT static void MakeConnexityBlock(const TopTools_ListOfShape& theLS,const TopTools_IndexedMapOfShape& theMapAvoid,TopTools_ListOfShape& theLSCB) ;
118 //! Computes the 3-D state of the shape theShape <br>
119 //! toward solid theSolid. <br>
120 //! theTol - value of precision of computation <br>
121 //! theContext- cahed geometrical tools <br>
122 //! Returns 3-D state. <br>
123 Standard_EXPORT static TopAbs_State ComputeStateByOnePoint(const TopoDS_Shape& theShape,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ;
125 //! Computes the 3-D state of the point thePoint <br>
126 //! toward solid theSolid. <br>
127 //! theTol - value of precision of computation <br>
128 //! theContext- cahed geometrical tools <br>
129 //! Returns 3-D state. <br>
130 Standard_EXPORT static TopAbs_State ComputeState(const gp_Pnt& thePoint,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ;
132 //! Computes the 3-D state of the vertex theVertex <br>
133 //! toward solid theSolid. <br>
134 //! theTol - value of precision of computation <br>
135 //! theContext- cahed geometrical tools <br>
136 //! Returns 3-D state. <br>
137 Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ;
139 //! Computes the 3-D state of the edge theEdge <br>
140 //! toward solid theSolid. <br>
141 //! theTol - value of precision of computation <br>
142 //! theContext- cahed geometrical tools <br>
143 //! Returns 3-D state. <br>
144 Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Edge& theEdge,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ;
146 //! Computes the 3-D state of the face theFace <br>
147 //! toward solid theSolid. <br>
148 //! theTol - value of precision of computation <br>
149 //! theBounds - set of edges of theFace to avoid <br>
150 //! theContext- cahed geometrical tools <br>
151 //! Returns 3-D state. <br>
152 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 //! Returns True if the face theFace is inside of the <br>
155 //! couple of faces theFace1, theFace2. <br>
156 //! The faces theFace, theFace1, theFace2 must <br>
157 //! share the edge theEdge <br>
158 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 //! Returns True if the face theFace is inside of the <br>
161 //! appropriate couple of faces (from the set theLF) . <br>
162 //! The faces of the set theLF and theFace must <br>
163 //! share the edge theEdge <br>
164 Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Edge& theEdge,const TopTools_ListOfShape& theLF,IntTools_Context& theContext) ;
166 //! Returns True if the face theFace is inside the <br>
167 //! solid theSolid. <br>
168 //! theMEF - Map Edge/Faces for theSolid <br>
169 //! theTol - value of precision of computation <br>
170 //! theContext- cahed geometrical tools <br>
171 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 //! For the face theFace and its edge theEdge <br>
174 //! finds the face suitable to produce shell. <br>
175 //! theLCEF - set of faces to search. All faces <br>
176 //! from theLCEF must share edge theEdge <br>
177 Standard_EXPORT static void GetFaceOff(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,const NMTTools_ListOfCoupleOfShape& theLCEF,TopoDS_Face& theFaceOff) ;
179 //! For the face theFace gets the edge theEdgeOnF <br>
180 //! that is the same as theEdge <br>
181 //! Returns True if such edge exists <br>
182 //! Returns False if there is no such edge <br>
183 Standard_EXPORT static Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,TopoDS_Edge& theEdgeOnF) ;
185 //! Returns True if the face theFace contains <br>
186 //! the edge theEdge but with opposite orientation. <br>
187 //! If the method returns True theEdgeOff is the <br>
188 //! edge founded <br>
189 Standard_EXPORT static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,TopoDS_Edge& theEdgeOff) ;
221 // other Inline functions and methods (like "C++: function call" methods)