0026917: 3D Offset algorithm produces incorrect result
[occt.git] / src / BRepOffset / BRepOffset_Inter2d.hxx
1 // Created on: 1996-08-30
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1996-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_Inter2d_HeaderFile
18 #define _BRepOffset_Inter2d_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TopTools_IndexedMapOfShape.hxx>
25 #include <Standard_Real.hxx>
26 #include <TopTools_DataMapOfShapeShape.hxx>
27 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
28 class BRepAlgo_AsDes;
29 class TopoDS_Face;
30 class BRepOffset_Offset;
31
32
33 //! Computes the intersections betwwen edges on a face
34 //! stores result is SD as AsDes from BRepOffset.
35 class BRepOffset_Inter2d 
36 {
37 public:
38
39   DEFINE_STANDARD_ALLOC
40
41   
42   //! Computes the intersections between the edges stored
43   //! is AsDes as descendants of <F> . Intersections is computed
44   //! between two edges if one of them is bound in NewEdges.
45   //! When all faces of the shape are treated the intersection
46   //! vertices have to be fused using the FuseVertices method.
47   //! theDMVV contains the vertices that should be fused
48   Standard_EXPORT static void Compute (const Handle(BRepAlgo_AsDes)& AsDes, 
49                                        const TopoDS_Face& F, 
50                                        const TopTools_IndexedMapOfShape& NewEdges, 
51                                        const Standard_Real Tol,
52                                        TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
53
54   //! Computes the intersection between the offset edges of the <FI>.
55   //! All intersection vertices will be stored in AsDes2d.
56   //! When all faces of the shape are treated the intersection vertices
57   //! have to be fused using the FuseVertices method.
58   //! theDMVV contains the vertices that should be fused.
59   Standard_EXPORT static void ConnexIntByInt (const TopoDS_Face& FI,
60                                               BRepOffset_Offset& OFI,
61                                               TopTools_DataMapOfShapeShape& MES,
62                                               const TopTools_DataMapOfShapeShape& Build,
63                                               const Handle(BRepAlgo_AsDes)& AsDes2d,
64                                               const Standard_Real Offset,
65                                               const Standard_Real Tol,
66                                               TopTools_IndexedMapOfShape& FacesWithVerts,
67                                               TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
68
69   //! Computes the intersection between the offset edges generated
70   //! from vertices and stored into AsDes as descendants of the <FI>.
71   //! All intersection vertices will be stored in AsDes2d.
72   //! When all faces of the shape are treated the intersection vertices
73   //! have to be fused using the FuseVertices method.
74   //! theDMVV contains the vertices that should be fused.
75   Standard_EXPORT static void ConnexIntByIntInVert (const TopoDS_Face& FI,
76                                                     BRepOffset_Offset& OFI,
77                                                     TopTools_DataMapOfShapeShape& MES,
78                                                     const TopTools_DataMapOfShapeShape& Build,
79                                                     const Handle(BRepAlgo_AsDes)& AsDes,
80                                                     const Handle(BRepAlgo_AsDes)& AsDes2d,
81                                                     const Standard_Real Tol,
82                                                     TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
83
84   //! Fuses the chains of vertices in the theDMVV
85   //! and updates AsDes by replacing the old vertices
86   //! with the new ones.
87   Standard_EXPORT static void FuseVertices(const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
88                                            const Handle(BRepAlgo_AsDes)& theAsDes);
89   //! extents the edge
90   Standard_EXPORT static void ExtentEdge(const TopoDS_Edge& E,
91                                          TopoDS_Edge& NE,
92                                          const Standard_Real theOffset);
93
94 protected:
95
96 private:
97
98 };
99
100 #endif // _BRepOffset_Inter2d_HeaderFile