1 // Copyright (C) 2007-2020 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, or (at your option) any later version.
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
22 // File : GEOMAlgo_AlgoTools.hxx
24 // Author : Peter KURNEV
26 #ifndef _GEOMAlgo_AlgoTools_HeaderFile
27 #define _GEOMAlgo_AlgoTools_HeaderFile
29 #include <Standard.hxx>
30 #include <Standard_Macro.hxx>
31 #include <Standard_Boolean.hxx>
32 #include <IntTools_Context.hxx>
33 #include <Standard_Integer.hxx>
36 #include <gp_Pnt2d.hxx>
38 #include <Geom_Surface.hxx>
40 #include <TopAbs_ShapeEnum.hxx>
42 #include <TopoDS_Face.hxx>
43 #include <TopoDS_Shape.hxx>
44 #include <TopoDS_Edge.hxx>
46 #include <TopTools_ListOfShape.hxx>
47 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
48 #include <TopTools_ListOfShape.hxx>
49 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
51 #include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
52 #include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
53 #include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
55 //! Auxiliary tools for Algorithms <br>
56 //=======================================================================
57 //class : GEOMAlgo_AlgoTools
59 //=======================================================================
60 class GEOMAlgo_AlgoTools {
64 static void FaceNormal (const TopoDS_Face& aF,
65 const Standard_Real U,
66 const Standard_Real V,
69 //! Computes a point <theP> inside the face <theF>. <br>
70 //! <theP2D> - 2D representation of <theP> <br>
71 //! on the surface of <theF> <br>
72 //! Returns 0 in case of success. <br>
74 static Standard_Integer PntInFace(const TopoDS_Face& theF,
79 static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
83 static Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ;
86 static Standard_Integer RefineSDShapes
87 (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
88 const Standard_Real aTol,
89 const Handle(IntTools_Context)& aCtx) ;
92 static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
93 const Standard_Real aTol,
94 TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
95 const Handle(IntTools_Context)& aCtx) ;
97 static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,
98 const TopTools_ListOfShape& aLE,
99 const Standard_Real aTol,
100 TopTools_ListOfShape& aLESD,
101 const Handle(IntTools_Context)& aCtx) ;
104 static void PointOnShape(const TopoDS_Shape& aS,
108 static void PointOnEdge(const TopoDS_Edge& aE,
112 static void PointOnEdge(const TopoDS_Edge& aE,
113 const Standard_Real aT,gp_Pnt& aP3D) ;
116 static void PointOnFace(const TopoDS_Face& aF,
120 static void PointOnFace(const TopoDS_Face& aF,
121 const Standard_Real aU,
122 const Standard_Real aV,
125 static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,
126 const TopoDS_Shape& aS,
128 const Handle(IntTools_Context)& aCtx) ;
131 static void CorrectTolerances(const TopoDS_Shape& aShape,
132 const Standard_Real aMaxTol=0.0001);
135 static void CorrectPointOnCurve(const TopoDS_Shape& S,
136 const Standard_Real aMaxTol=0.0001);
139 static void CorrectCurveOnSurface(const TopoDS_Shape& S,
140 const Standard_Real aMaxTol=0.0001);
144 static Standard_Boolean IsSplitToReverse1 (const TopoDS_Edge& aEF1,
145 const TopoDS_Edge& aEF2,
146 const Handle(IntTools_Context)& aCtx) ;
148 static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
149 const TopoDS_Face& aF,
150 const Standard_Real aUMin,
151 const Standard_Real aUMax);
154 static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface) &aS);
157 static void MakeContainer(const TopAbs_ShapeEnum theType,
161 static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit,
162 const TopoDS_Edge& theEdge,
163 const Handle(IntTools_Context)& theCtx) ;
166 static Standard_Boolean IsSplitToReverse (const TopoDS_Face& theFSp,
167 const TopoDS_Face& theFSr,
168 const Handle(IntTools_Context)& theCtx) ;
171 static Standard_Boolean IsSplitToReverse (const TopoDS_Shape& theSp,
172 const TopoDS_Shape& theSr,
173 const Handle(IntTools_Context)& theCtx) ;
175 static Standard_Integer BuildPCurveForEdgeOnFace (const TopoDS_Edge& aEold,
176 const TopoDS_Edge& aEnew,
177 const TopoDS_Face& aF,
178 const Handle(IntTools_Context)& aCtx) ;
182 static void FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
183 GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
186 static void FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
187 GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
190 static void CopyShape(const TopoDS_Shape& aS,
194 static void CopyShape(const TopoDS_Shape& aS,
196 TopTools_IndexedDataMapOfShapeShape& aMSS) ;