25ad516b1bbe29b07c1ff760dbffe8b3b6e004e6
[occt.git] / src / BRepOffset / BRepOffset_Tool.hxx
1 // Created on: 1995-10-23
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _BRepOffset_Tool_HeaderFile
18 #define _BRepOffset_Tool_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TopAbs_Orientation.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <TopTools_ListOfShape.hxx>
27 #include <TopAbs_State.hxx>
28 #include <Standard_Real.hxx>
29 #include <TopTools_DataMapOfShapeShape.hxx>
30 #include <TopTools_DataMapOfShapeListOfShape.hxx>
31 #include <TopTools_MapOfShape.hxx>
32 #include <TopTools_IndexedMapOfShape.hxx>
33 class TopoDS_Edge;
34 class TopoDS_Vertex;
35 class TopoDS_Face;
36 class BRepOffset_Analyse;
37 class TopoDS_Wire;
38 class TopoDS_Shape;
39 class BRepAlgo_AsDes;
40 class BRepAlgo_Image;
41 class Geom_Curve;
42
43
44
45 class BRepOffset_Tool 
46 {
47 public:
48
49   DEFINE_STANDARD_ALLOC
50
51   
52   //! <V1> is the FirstVertex ,<V2> is the Last Vertex of <Edge>
53   //! taking account the orientation of Edge.
54   Standard_EXPORT static void EdgeVertices (const TopoDS_Edge& E, TopoDS_Vertex& V1, TopoDS_Vertex& V2);
55   
56   //! returns the cumul  of the orientation  of <Edge>
57   //! and thc containing wire in <Face>
58   Standard_EXPORT static TopAbs_Orientation OriEdgeInFace (const TopoDS_Edge& E, const TopoDS_Face& F);
59   
60   //! <E> is a section  between <F1> and <F2>.  Computes
61   //! <O1> the orientation of <E> in <F1> influenced by <F2>.
62   //! idem for <O2>.
63   Standard_EXPORT static void OrientSection (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, TopAbs_Orientation& O1, TopAbs_Orientation& O2);
64   
65   //! Looks for the common Vertices and Edges between faces <theF1> and <theF2>.<br>
66   //! Returns TRUE if common shapes have been found.<br>
67   //! <theLE> will contain the found common edges;<br>
68   //! <theLV> will contain the found common vertices.
69   Standard_EXPORT static Standard_Boolean FindCommonShapes(const TopoDS_Face& theF1,
70                                                            const TopoDS_Face& theF2,
71                                                            TopTools_ListOfShape& theLE,
72                                                            TopTools_ListOfShape& theLV);
73
74   //! Looks for the common shapes of type <theType> between shapes <theS1> and <theS2>.<br>
75   //! Returns TRUE if common shapes have been found.<br>
76   //! <theLSC> will contain the found common shapes.
77   Standard_EXPORT static Standard_Boolean FindCommonShapes(const TopoDS_Shape& theS1,
78                                                            const TopoDS_Shape& theS2,
79                                                            const TopAbs_ShapeEnum theType,
80                                                            TopTools_ListOfShape& theLSC);
81
82   //! Computes the   Section betwwen  <F1> and  <F2> the
83   //! edges solution   are  stored in <LInt1>  with  the
84   //! orientation on <F1>, the sames edges are stored in
85   //! <Lint2> with the orientation on <F2>.
86   Standard_EXPORT static void Inter3D (const TopoDS_Face& F1, const TopoDS_Face& F2, TopTools_ListOfShape& LInt1, TopTools_ListOfShape& LInt2, const TopAbs_State Side, const TopoDS_Edge& RefEdge, const Standard_Boolean IsRefEdgeDefined = Standard_False);
87   
88   //! Find if the edges <Edges> of the face <F2> are on
89   //! the face <F1>.
90   //! Set in <LInt1> <LInt2> the updated edges.
91   //! If all the edges are computed, returns true.
92   Standard_EXPORT static Standard_Boolean TryProject (const TopoDS_Face& F1, const TopoDS_Face& F2, const TopTools_ListOfShape& Edges, TopTools_ListOfShape& LInt1, TopTools_ListOfShape& LInt2, const TopAbs_State Side, const Standard_Real TolConf);
93   
94   Standard_EXPORT static void PipeInter (const TopoDS_Face& F1, const TopoDS_Face& F2, TopTools_ListOfShape& LInt1, TopTools_ListOfShape& LInt2, const TopAbs_State Side);
95   
96   Standard_EXPORT static void Inter2d (const TopoDS_Face& F, const TopoDS_Edge& E1, const TopoDS_Edge& E2, TopTools_ListOfShape& LV, const Standard_Real Tol);
97   
98   Standard_EXPORT static void InterOrExtent (const TopoDS_Face& F1, const TopoDS_Face& F2, TopTools_ListOfShape& LInt1, TopTools_ListOfShape& LInt2, const TopAbs_State Side);
99   
100   Standard_EXPORT static void CheckBounds (const TopoDS_Face& F, const BRepOffset_Analyse& Analyse, Standard_Boolean& enlargeU, Standard_Boolean& enlargeVfirst, Standard_Boolean& enlargeVlast);
101   
102   //! if <ChangeGeom> is TRUE  ,   the surface  can  be
103   //! changed .
104   //! if <UpdatePCurve>  is  TRUE, update the  pcurves of the
105   //! edges of <F> on   the new surface.if the surface has  been changed,
106   //! Returns  True if The Surface of  <NF> has changed.
107   Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F, TopoDS_Face& NF, const Standard_Boolean ChangeGeom, const Standard_Boolean UpDatePCurve = Standard_False, const Standard_Boolean enlargeU = Standard_True, const Standard_Boolean enlargeVfirst = Standard_True, const Standard_Boolean enlargeVlast = Standard_True);
108   
109   Standard_EXPORT static void ExtentFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& ConstShapes, TopTools_DataMapOfShapeShape& ToBuild, const TopAbs_State Side, const Standard_Real TolConf, TopoDS_Face& NF);
110   
111   //! Via the wire explorer store in <NOnV1> for
112   //! an Edge <E> of <W> his Edge neighbour on the first
113   //! vertex <V1> of <E>.
114   //! Store in NOnV2 the Neighbour of <E>on the last
115   //! vertex <V2> of <E>.
116   Standard_EXPORT static void BuildNeighbour (const TopoDS_Wire& W, const TopoDS_Face& F, TopTools_DataMapOfShapeShape& NOnV1, TopTools_DataMapOfShapeShape& NOnV2);
117   
118   //! Store in MVE for a vertex <V>  in <S> the incident
119   //! edges <E> in <S>.
120   //! An Edge is Store only one Time for a vertex.
121   Standard_EXPORT static void MapVertexEdges (const TopoDS_Shape& S, TopTools_DataMapOfShapeListOfShape& MVE);
122   
123   //! Remove the non valid   part of an offsetshape
124   //! 1 - Remove all the free boundary  and the faces
125   //! connex to such edges.
126   //! 2 - Remove all the shapes not  valid in the result
127   //! (according to the side of offseting)
128   //! in this verion only the first point is implemented.
129   Standard_EXPORT static TopoDS_Shape Deboucle3D (const TopoDS_Shape& S, const TopTools_MapOfShape& Boundary);
130   
131   Standard_EXPORT static void CorrectOrientation (const TopoDS_Shape& SI, const TopTools_IndexedMapOfShape& NewEdges, Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& InitOffset, const Standard_Real Offset);
132   
133   Standard_EXPORT static Standard_Real Gabarit (const Handle(Geom_Curve)& aCurve);
134
135   //! Compares the normal directions of the planar faces and returns
136   //! TRUE if the directions are the same with the given precision.<br>
137   Standard_EXPORT static Standard_Boolean CheckPlanesNormals(const TopoDS_Face& theFace1,
138                                                              const TopoDS_Face& theFace2,
139                                                              const Standard_Real theTolAng = 1.e-8);
140
141 protected:
142
143 private:
144
145 };
146
147 #endif // _BRepOffset_Tool_HeaderFile