1 // Created on: 1996-12-16
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BiTgte_Blend_HeaderFile
18 #define _BiTgte_Blend_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Real.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <TopoDS_Shape.hxx>
27 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
28 #include <BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx>
29 #include <TopTools_DataMapOfShapeListOfShape.hxx>
30 #include <TopTools_IndexedMapOfShape.hxx>
31 #include <TopTools_MapOfShape.hxx>
32 #include <BRepOffset_Analyse.hxx>
33 #include <BRepOffset_DataMapOfShapeOffset.hxx>
34 #include <BRepAlgo_Image.hxx>
35 #include <Standard_Integer.hxx>
36 #include <TColStd_HArray1OfInteger.hxx>
37 #include <TopTools_ListOfShape.hxx>
38 #include <BiTgte_ContactType.hxx>
39 #include <TopTools_DataMapOfShapeBox.hxx>
41 class StdFail_NotDone;
42 class Standard_OutOfRange;
49 class BRepOffset_Offset;
50 class BRepOffset_Inter3d;
61 Standard_EXPORT BiTgte_Blend();
63 //! <S>: Shape to be rounded
64 //! <Radius>: radius of the fillet
65 //! <Tol>: Tol3d used in approximations
66 //! <NUBS>: if true, generate only NUBS surfaces,
67 //! if false, generate analytical surfaces if possible
68 Standard_EXPORT BiTgte_Blend(const TopoDS_Shape& S, const Standard_Real Radius, const Standard_Real Tol, const Standard_Boolean NUBS);
70 Standard_EXPORT void Init (const TopoDS_Shape& S, const Standard_Real Radius, const Standard_Real Tol, const Standard_Boolean NUBS);
72 //! Clear all the Fields.
73 Standard_EXPORT void Clear();
75 //! Set two faces of <myShape> on which the Sphere
77 Standard_EXPORT void SetFaces (const TopoDS_Face& F1, const TopoDS_Face& F2);
79 //! Set an edge of <myShape> to be rounded.
80 Standard_EXPORT void SetEdge (const TopoDS_Edge& Edge);
82 //! Set a face on which the fillet must stop.
83 Standard_EXPORT void SetStoppingFace (const TopoDS_Face& Face);
85 //! Compute the generated surfaces.
86 //! If <BuildShape> is true, compute the resulting Shape.
87 //! If false, only the blending surfaces are computed.
88 Standard_EXPORT void Perform (const Standard_Boolean BuildShape = Standard_True);
90 Standard_EXPORT Standard_Boolean IsDone() const;
92 //! returns the result
93 Standard_EXPORT const TopoDS_Shape& Shape() const;
95 //! returns the Number of generated surfaces.
96 Standard_EXPORT Standard_Integer NbSurfaces() const;
98 //! returns the surface of range Index
99 Standard_EXPORT Handle(Geom_Surface) Surface (const Standard_Integer Index) const;
101 //! returns the surface of range Index
102 Standard_EXPORT const TopoDS_Face& Face (const Standard_Integer Index) const;
104 //! set in <LC> all the center lines
105 Standard_EXPORT void CenterLines (TopTools_ListOfShape& LC) const;
107 //! returns the surface generated by the centerline.
108 //! <CenterLine> may be
109 //! - an edge : generate a pipe.
110 //! - a vertex : generate a sphere.
111 //! Warning: returns a Null Handle if <CenterLine> generates
113 Standard_EXPORT Handle(Geom_Surface) Surface (const TopoDS_Shape& CenterLine) const;
115 //! returns the face generated by the centerline.
116 //! <CenterLine> may be
117 //! - an edge : generate a pipe.
118 //! - a vertex : generate a sphere.
119 //! Warning: returns a Null Shape if <CenterLine> generates
121 Standard_EXPORT const TopoDS_Face& Face (const TopoDS_Shape& CenterLine) const;
123 //! returns the type of contact
124 Standard_EXPORT BiTgte_ContactType ContactType (const Standard_Integer Index) const;
126 //! gives the first support shape relative to
127 //! SurfaceFillet(Index);
128 Standard_EXPORT const TopoDS_Shape& SupportShape1 (const Standard_Integer Index) const;
130 //! gives the second support shape relative to
131 //! SurfaceFillet(Index);
132 Standard_EXPORT const TopoDS_Shape& SupportShape2 (const Standard_Integer Index) const;
134 //! gives the 3d curve of SurfaceFillet(Index)
135 //! on SupportShape1(Index)
136 Standard_EXPORT Handle(Geom_Curve) CurveOnShape1 (const Standard_Integer Index) const;
138 //! gives the 3d curve of SurfaceFillet(Index)
139 //! on SupportShape2(Index)
140 Standard_EXPORT Handle(Geom_Curve) CurveOnShape2 (const Standard_Integer Index) const;
142 //! gives the PCurve associated to CurvOnShape1(Index)
143 //! on the support face
144 //! Warning: returns a Null Handle if SupportShape1 is not a Face
145 Standard_EXPORT Handle(Geom2d_Curve) PCurveOnFace1 (const Standard_Integer Index) const;
147 //! gives the PCurve associated to CurveOnShape1(Index)
149 Standard_EXPORT Handle(Geom2d_Curve) PCurve1OnFillet (const Standard_Integer Index) const;
151 //! gives the PCurve associated to CurveOnShape2(Index)
152 //! on the support face
153 //! Warning: returns a Null Handle if SupportShape2 is not a Face
154 Standard_EXPORT Handle(Geom2d_Curve) PCurveOnFace2 (const Standard_Integer Index) const;
156 //! gives the PCurve associated to CurveOnShape2(Index)
158 Standard_EXPORT Handle(Geom2d_Curve) PCurve2OnFillet (const Standard_Integer Index) const;
160 Standard_EXPORT Standard_Integer NbBranches();
162 //! Set in <From>,<To> the indices of the faces of
163 //! the branche <Index>.
165 //! i.e: Branche<Index> = Face(From) + Face(From+1) + ..+ Face(To)
166 Standard_EXPORT void IndicesOfBranche (const Standard_Integer Index, Standard_Integer& From, Standard_Integer& To) const;
168 //! Computes the center lines
169 Standard_EXPORT void ComputeCenters();
183 //! Perform the generated surfaces.
184 Standard_EXPORT void ComputeSurfaces();
186 //! Build the resulting shape
187 //! All the faces must be computed
188 Standard_EXPORT void ComputeShape();
190 //! Computes the intersections with <Face> and all the
191 //! OffsetFaces stored in <myMapSF>. Returns <True>
192 //! if an intersections ends on a boundary of a Face.
193 Standard_EXPORT Standard_Boolean Intersect (const TopoDS_Shape& Init, const TopoDS_Face& Face, const TopTools_DataMapOfShapeBox& MapSBox, const BRepOffset_Offset& OF1, BRepOffset_Inter3d& Inter);
196 Standard_Real myRadius;
198 Standard_Boolean myNubs;
199 TopoDS_Shape myShape;
200 TopoDS_Shape myResult;
201 Standard_Boolean myBuildShape;
202 TopTools_IndexedDataMapOfShapeListOfShape myAncestors;
203 BRepFill_DataMapOfShapeDataMapOfShapeListOfShape myCreated;
204 TopTools_DataMapOfShapeListOfShape myCutEdges;
205 TopTools_IndexedMapOfShape myFaces;
206 TopTools_IndexedMapOfShape myEdges;
207 TopTools_MapOfShape myStopFaces;
208 BRepOffset_Analyse myAnalyse;
209 TopTools_IndexedMapOfShape myCenters;
210 BRepOffset_DataMapOfShapeOffset myMapSF;
211 BRepAlgo_Image myInitOffsetFace;
212 BRepAlgo_Image myImage;
213 BRepAlgo_Image myImageOffset;
214 Handle(BRepAlgo_AsDes) myAsDes;
215 Standard_Integer myNbBranches;
216 Handle(TColStd_HArray1OfInteger) myIndices;
217 Standard_Boolean myDone;
228 #endif // _BiTgte_Blend_HeaderFile