1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _GEOMAlgo_Tools3D_HeaderFile
21 #define _GEOMAlgo_Tools3D_HeaderFile
23 #ifndef _Standard_Boolean_HeaderFile
24 #include <Standard_Boolean.hxx>
26 #ifndef _Standard_Integer_HeaderFile
27 #include <Standard_Integer.hxx>
29 #ifndef _TopAbs_ShapeEnum_HeaderFile
30 #include <TopAbs_ShapeEnum.hxx>
32 #ifndef _TopAbs_State_HeaderFile
33 #include <TopAbs_State.hxx>
35 #ifndef _Standard_Real_HeaderFile
36 #include <Standard_Real.hxx>
39 class IntTools_Context;
42 class TopTools_ListOfShape;
43 class TopTools_IndexedMapOfShape;
47 class TopTools_IndexedDataMapOfShapeListOfShape;
48 class NMTTools_ListOfCoupleOfShape;
51 #ifndef _Standard_HeaderFile
52 #include <Standard.hxx>
54 #ifndef _Standard_Macro_HeaderFile
55 #include <Standard_Macro.hxx>
58 //! Auxiliary tools for Algorithms <br>
59 class GEOMAlgo_Tools3D {
63 void* operator new(size_t,void* anAddress)
67 void* operator new(size_t size)
69 return Standard::Allocate(size);
71 void operator delete(void *anAddress)
73 if (anAddress) Standard::Free((Standard_Address&)anAddress);
78 //! Returns True if the shape theSplit has opposite <br>
79 //! direction than theShape <br>
80 //! theContext - cashed geometrical tools <br>
81 Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSplit,const TopoDS_Shape& theShape,IntTools_Context& theContext) ;
83 //! Returns True if normal direction of the face <br>
84 //! theShape is not the same as for the face <br>
86 //! theContext - cashed geometrical tools <br>
87 Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Face& theSplit,const TopoDS_Face& theShape,IntTools_Context& theContext) ;
89 //! Returns True if tangent direction of the edge <br>
90 //! theEdge is not the same as for the edge <br>
92 //! theContext - cashed geometrical tools <br>
93 Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theEdge,const TopoDS_Edge& theSplit,IntTools_Context& theContext) ;
95 //! For the couple of faces theF1, theF2 <br>
96 //! computes sense value <br>
97 //! Returns 0 if the faces are not sensible <br>
98 //! Returns 1 if the faces have same sense <br>
99 //! Returns 2 if the faces have opposite sense <br>
100 Standard_EXPORT static Standard_Integer Sense(const TopoDS_Face& theF1,const TopoDS_Face& theF2) ;
102 //! Makes new face theF2 from surface and wires <br>
103 //! of the face theF1 <br>
104 Standard_EXPORT static void CopyFace(const TopoDS_Face& theF1,TopoDS_Face& theF2) ;
106 //! Makes empty shape theShape of the type theType <br>
107 Standard_EXPORT static void MakeContainer(const TopAbs_ShapeEnum theType,TopoDS_Shape& theShape) ;
109 //! For the list of faces theLS build block <br>
110 //! theLSCB in terms of connexity by edges <br>
111 //! theMapAvoid - set of edges to avoid for <br>
112 //! the treatment <br>
113 Standard_EXPORT static void MakeConnexityBlock(const TopTools_ListOfShape& theLS,const TopTools_IndexedMapOfShape& theMapAvoid,TopTools_ListOfShape& theLSCB) ;
115 //! Computes the 3-D state of the shape theShape <br>
116 //! toward solid theSolid. <br>
117 //! theTol - value of precision of computation <br>
118 //! theContext- cahed geometrical tools <br>
119 //! Returns 3-D state. <br>
120 Standard_EXPORT static TopAbs_State ComputeStateByOnePoint(const TopoDS_Shape& theShape,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ;
122 //! Computes the 3-D state of the point thePoint <br>
123 //! toward solid theSolid. <br>
124 //! theTol - value of precision of computation <br>
125 //! theContext- cahed geometrical tools <br>
126 //! Returns 3-D state. <br>
127 Standard_EXPORT static TopAbs_State ComputeState(const gp_Pnt& thePoint,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ;
129 //! Computes the 3-D state of the vertex theVertex <br>
130 //! toward solid theSolid. <br>
131 //! theTol - value of precision of computation <br>
132 //! theContext- cahed geometrical tools <br>
133 //! Returns 3-D state. <br>
134 Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ;
136 //! Computes the 3-D state of the edge theEdge <br>
137 //! toward solid theSolid. <br>
138 //! theTol - value of precision of computation <br>
139 //! theContext- cahed geometrical tools <br>
140 //! Returns 3-D state. <br>
141 Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Edge& theEdge,const TopoDS_Solid& theSolid,const Standard_Real theTol,IntTools_Context& theContext) ;
143 //! Computes the 3-D state of the face theFace <br>
144 //! toward solid theSolid. <br>
145 //! theTol - value of precision of computation <br>
146 //! theBounds - set of edges of theFace to avoid <br>
147 //! theContext- cahed geometrical tools <br>
148 //! Returns 3-D state. <br>
149 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) ;
151 //! Returns True if the face theFace is inside of the <br>
152 //! couple of faces theFace1, theFace2. <br>
153 //! The faces theFace, theFace1, theFace2 must <br>
154 //! share the edge theEdge <br>
155 Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Edge& theEdge,const TopoDS_Face& theFace1,const TopoDS_Face& theFace2) ;
157 //! Returns True if the face theFace is inside of the <br>
158 //! appropriate couple of faces (from the set theLF) . <br>
159 //! The faces of the set theLF and theFace must <br>
160 //! share the edge theEdge <br>
161 Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,const TopoDS_Edge& theEdge,const TopTools_ListOfShape& theLF) ;
163 //! Returns True if the face theFace is inside the <br>
164 //! solid theSolid. <br>
165 //! theMEF - Map Edge/Faces for theSolid <br>
166 //! theTol - value of precision of computation <br>
167 //! theContext- cahed geometrical tools <br>
168 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) ;
170 //! For the face theFace and its edge theEdge <br>
171 //! finds the face suitable to produce shell. <br>
172 //! theLCEF - set of faces to search. All faces <br>
173 //! from theLCEF must share edge theEdge <br>
174 Standard_EXPORT static void GetFaceOff(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,const NMTTools_ListOfCoupleOfShape& theLCEF,TopoDS_Face& theFaceOff) ;
176 //! For the face theFace gets the edge theEdgeOnF <br>
177 //! that is the same as theEdge <br>
178 //! Returns True if such edge exists <br>
179 //! Returns False if there is no such edge <br>
180 Standard_EXPORT static Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,TopoDS_Edge& theEdgeOnF) ;
182 //! Returns True if the face theFace contains <br>
183 //! the edge theEdge but with opposite orientation. <br>
184 //! If the method returns True theEdgeOff is the <br>
185 //! edge founded <br>
186 Standard_EXPORT static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,TopoDS_Edge& theEdgeOff) ;
218 // other Inline functions and methods (like "C++: function call" methods)