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 <BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx>
25 #include <TopTools_DataMapOfShapeListOfShape.hxx>
26 #include <TopTools_IndexedMapOfShape.hxx>
27 #include <BRepOffset_Analyse.hxx>
28 #include <BRepOffset_DataMapOfShapeOffset.hxx>
29 #include <BRepAlgo_Image.hxx>
30 #include <Standard_Integer.hxx>
31 #include <TColStd_HArray1OfInteger.hxx>
32 #include <TopTools_ListOfShape.hxx>
33 #include <BiTgte_ContactType.hxx>
34 #include <TopTools_DataMapOfShapeBox.hxx>
41 class BRepOffset_Offset;
42 class BRepOffset_Inter3d;
53 Standard_EXPORT BiTgte_Blend();
55 //! <S>: Shape to be rounded
56 //! <Radius>: radius of the fillet
57 //! <Tol>: Tol3d used in approximations
58 //! <NUBS>: if true, generate only NUBS surfaces,
59 //! if false, generate analytical surfaces if possible
60 Standard_EXPORT BiTgte_Blend(const TopoDS_Shape& S, const Standard_Real Radius, const Standard_Real Tol, const Standard_Boolean NUBS);
62 Standard_EXPORT void Init (const TopoDS_Shape& S, const Standard_Real Radius, const Standard_Real Tol, const Standard_Boolean NUBS);
64 //! Clear all the Fields.
65 Standard_EXPORT void Clear();
67 //! Set two faces of <myShape> on which the Sphere
69 Standard_EXPORT void SetFaces (const TopoDS_Face& F1, const TopoDS_Face& F2);
71 //! Set an edge of <myShape> to be rounded.
72 Standard_EXPORT void SetEdge (const TopoDS_Edge& Edge);
74 //! Set a face on which the fillet must stop.
75 Standard_EXPORT void SetStoppingFace (const TopoDS_Face& Face);
77 //! Compute the generated surfaces.
78 //! If <BuildShape> is true, compute the resulting Shape.
79 //! If false, only the blending surfaces are computed.
80 Standard_EXPORT void Perform (const Standard_Boolean BuildShape = Standard_True);
82 Standard_EXPORT Standard_Boolean IsDone() const;
84 //! returns the result
85 Standard_EXPORT const TopoDS_Shape& Shape() const;
87 //! returns the Number of generated surfaces.
88 Standard_EXPORT Standard_Integer NbSurfaces() const;
90 //! returns the surface of range Index
91 Standard_EXPORT Handle(Geom_Surface) Surface (const Standard_Integer Index) const;
93 //! returns the surface of range Index
94 Standard_EXPORT const TopoDS_Face& Face (const Standard_Integer Index) const;
96 //! set in <LC> all the center lines
97 Standard_EXPORT void CenterLines (TopTools_ListOfShape& LC) const;
99 //! returns the surface generated by the centerline.
100 //! <CenterLine> may be
101 //! - an edge : generate a pipe.
102 //! - a vertex : generate a sphere.
103 //! Warning: returns a Null Handle if <CenterLine> generates
105 Standard_EXPORT Handle(Geom_Surface) Surface (const TopoDS_Shape& CenterLine) const;
107 //! returns the face 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 Shape if <CenterLine> generates
113 Standard_EXPORT const TopoDS_Face& Face (const TopoDS_Shape& CenterLine) const;
115 //! returns the type of contact
116 Standard_EXPORT BiTgte_ContactType ContactType (const Standard_Integer Index) const;
118 //! gives the first support shape relative to
119 //! SurfaceFillet(Index);
120 Standard_EXPORT const TopoDS_Shape& SupportShape1 (const Standard_Integer Index) const;
122 //! gives the second support shape relative to
123 //! SurfaceFillet(Index);
124 Standard_EXPORT const TopoDS_Shape& SupportShape2 (const Standard_Integer Index) const;
126 //! gives the 3d curve of SurfaceFillet(Index)
127 //! on SupportShape1(Index)
128 Standard_EXPORT Handle(Geom_Curve) CurveOnShape1 (const Standard_Integer Index) const;
130 //! gives the 3d curve of SurfaceFillet(Index)
131 //! on SupportShape2(Index)
132 Standard_EXPORT Handle(Geom_Curve) CurveOnShape2 (const Standard_Integer Index) const;
134 //! gives the PCurve associated to CurvOnShape1(Index)
135 //! on the support face
136 //! Warning: returns a Null Handle if SupportShape1 is not a Face
137 Standard_EXPORT Handle(Geom2d_Curve) PCurveOnFace1 (const Standard_Integer Index) const;
139 //! gives the PCurve associated to CurveOnShape1(Index)
141 Standard_EXPORT Handle(Geom2d_Curve) PCurve1OnFillet (const Standard_Integer Index) const;
143 //! gives the PCurve associated to CurveOnShape2(Index)
144 //! on the support face
145 //! Warning: returns a Null Handle if SupportShape2 is not a Face
146 Standard_EXPORT Handle(Geom2d_Curve) PCurveOnFace2 (const Standard_Integer Index) const;
148 //! gives the PCurve associated to CurveOnShape2(Index)
150 Standard_EXPORT Handle(Geom2d_Curve) PCurve2OnFillet (const Standard_Integer Index) const;
152 Standard_EXPORT Standard_Integer NbBranches();
154 //! Set in <From>,<To> the indices of the faces of
155 //! the branche <Index>.
157 //! i.e: Branche<Index> = Face(From) + Face(From+1) + ..+ Face(To)
158 Standard_EXPORT void IndicesOfBranche (const Standard_Integer Index, Standard_Integer& From, Standard_Integer& To) const;
160 //! Computes the center lines
161 Standard_EXPORT void ComputeCenters();
175 //! Perform the generated surfaces.
176 Standard_EXPORT void ComputeSurfaces();
178 //! Build the resulting shape
179 //! All the faces must be computed
180 Standard_EXPORT void ComputeShape();
182 //! Computes the intersections with <Face> and all the
183 //! OffsetFaces stored in <myMapSF>. Returns <True>
184 //! if an intersections ends on a boundary of a Face.
185 Standard_EXPORT Standard_Boolean Intersect (const TopoDS_Shape& Init, const TopoDS_Face& Face, const TopTools_DataMapOfShapeBox& MapSBox, const BRepOffset_Offset& OF1, BRepOffset_Inter3d& Inter);
188 Standard_Real myRadius;
190 Standard_Boolean myNubs;
191 TopoDS_Shape myShape;
192 TopoDS_Shape myResult;
193 Standard_Boolean myBuildShape;
194 TopTools_IndexedDataMapOfShapeListOfShape myAncestors;
195 BRepFill_DataMapOfShapeDataMapOfShapeListOfShape myCreated;
196 TopTools_DataMapOfShapeListOfShape myCutEdges;
197 TopTools_IndexedMapOfShape myFaces;
198 TopTools_IndexedMapOfShape myEdges;
199 TopTools_MapOfShape myStopFaces;
200 BRepOffset_Analyse myAnalyse;
201 TopTools_IndexedMapOfShape myCenters;
202 BRepOffset_DataMapOfShapeOffset myMapSF;
203 BRepAlgo_Image myInitOffsetFace;
204 BRepAlgo_Image myImage;
205 BRepAlgo_Image myImageOffset;
206 Handle(BRepAlgo_AsDes) myAsDes;
207 Standard_Integer myNbBranches;
208 Handle(TColStd_HArray1OfInteger) myIndices;
209 Standard_Boolean myDone;
220 #endif // _BiTgte_Blend_HeaderFile