Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-31 08:29:49

0001 // Created on: 1996-12-16
0002 // Created by: Bruno DUMORTIER
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BiTgte_Blend_HeaderFile
0018 #define _BiTgte_Blend_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepFill_DataMapOfShapeDataMapOfShapeListOfShape.hxx>
0025 #include <TopTools_DataMapOfShapeListOfShape.hxx>
0026 #include <TopTools_IndexedMapOfShape.hxx>
0027 #include <BRepOffset_Analyse.hxx>
0028 #include <BRepOffset_DataMapOfShapeOffset.hxx>
0029 #include <BRepAlgo_Image.hxx>
0030 #include <Standard_Integer.hxx>
0031 #include <TColStd_HArray1OfInteger.hxx>
0032 #include <TopTools_ListOfShape.hxx>
0033 #include <BiTgte_ContactType.hxx>
0034 #include <TopTools_DataMapOfShapeBox.hxx>
0035 class BRepAlgo_AsDes;
0036 class TopoDS_Face;
0037 class TopoDS_Edge;
0038 class Geom_Surface;
0039 class Geom_Curve;
0040 class Geom2d_Curve;
0041 class BRepOffset_Offset;
0042 class BRepOffset_Inter3d;
0043 
0044 //! Root class
0045 class BiTgte_Blend
0046 {
0047 public:
0048   DEFINE_STANDARD_ALLOC
0049 
0050   Standard_EXPORT BiTgte_Blend();
0051 
0052   //! <S>: Shape to be rounded
0053   //! <Radius>: radius of the fillet
0054   //! <Tol>: Tol3d used in approximations
0055   //! <NUBS>: if true,  generate only NUBS surfaces,
0056   //! if false, generate analytical surfaces if possible
0057   Standard_EXPORT BiTgte_Blend(const TopoDS_Shape&    S,
0058                                const Standard_Real    Radius,
0059                                const Standard_Real    Tol,
0060                                const Standard_Boolean NUBS);
0061 
0062   Standard_EXPORT void Init(const TopoDS_Shape&    S,
0063                             const Standard_Real    Radius,
0064                             const Standard_Real    Tol,
0065                             const Standard_Boolean NUBS);
0066 
0067   //! Clear all the Fields.
0068   Standard_EXPORT void Clear();
0069 
0070   //! Set two faces   of <myShape> on which the  Sphere
0071   //! must roll.
0072   Standard_EXPORT void SetFaces(const TopoDS_Face& F1, const TopoDS_Face& F2);
0073 
0074   //! Set an edge of <myShape> to be rounded.
0075   Standard_EXPORT void SetEdge(const TopoDS_Edge& Edge);
0076 
0077   //! Set a face on which the fillet must stop.
0078   Standard_EXPORT void SetStoppingFace(const TopoDS_Face& Face);
0079 
0080   //! Compute the generated surfaces.
0081   //! If <BuildShape> is true, compute the resulting Shape.
0082   //! If false, only the blending surfaces are computed.
0083   Standard_EXPORT void Perform(const Standard_Boolean BuildShape = Standard_True);
0084 
0085   Standard_EXPORT Standard_Boolean IsDone() const;
0086 
0087   //! returns the result
0088   Standard_EXPORT const TopoDS_Shape& Shape() const;
0089 
0090   //! returns the Number of generated surfaces.
0091   Standard_EXPORT Standard_Integer NbSurfaces() const;
0092 
0093   //! returns the surface of range Index
0094   Standard_EXPORT Handle(Geom_Surface) Surface(const Standard_Integer Index) const;
0095 
0096   //! returns the surface of range Index
0097   Standard_EXPORT const TopoDS_Face& Face(const Standard_Integer Index) const;
0098 
0099   //! set in <LC> all the center lines
0100   Standard_EXPORT void CenterLines(TopTools_ListOfShape& LC) const;
0101 
0102   //! returns  the surface generated  by the centerline.
0103   //! <CenterLine> may be
0104   //! - an edge  : generate a pipe.
0105   //! - a vertex : generate a sphere.
0106   //! Warning: returns a Null Handle if <CenterLine> generates
0107   //! no surface.
0108   Standard_EXPORT Handle(Geom_Surface) Surface(const TopoDS_Shape& CenterLine) const;
0109 
0110   //! returns  the face generated  by the centerline.
0111   //! <CenterLine> may be
0112   //! - an edge  : generate a pipe.
0113   //! - a vertex : generate a sphere.
0114   //! Warning: returns a Null Shape if <CenterLine> generates
0115   //! no surface.
0116   Standard_EXPORT const TopoDS_Face& Face(const TopoDS_Shape& CenterLine) const;
0117 
0118   //! returns the type of contact
0119   Standard_EXPORT BiTgte_ContactType ContactType(const Standard_Integer Index) const;
0120 
0121   //! gives the first support shape relative to
0122   //! SurfaceFillet(Index);
0123   Standard_EXPORT const TopoDS_Shape& SupportShape1(const Standard_Integer Index) const;
0124 
0125   //! gives the second support shape relative to
0126   //! SurfaceFillet(Index);
0127   Standard_EXPORT const TopoDS_Shape& SupportShape2(const Standard_Integer Index) const;
0128 
0129   //! gives the 3d curve of SurfaceFillet(Index)
0130   //! on SupportShape1(Index)
0131   Standard_EXPORT Handle(Geom_Curve) CurveOnShape1(const Standard_Integer Index) const;
0132 
0133   //! gives the 3d curve of SurfaceFillet(Index)
0134   //! on SupportShape2(Index)
0135   Standard_EXPORT Handle(Geom_Curve) CurveOnShape2(const Standard_Integer Index) const;
0136 
0137   //! gives the PCurve associated to CurvOnShape1(Index)
0138   //! on the support face
0139   //! Warning: returns a Null Handle if SupportShape1 is not a Face
0140   Standard_EXPORT Handle(Geom2d_Curve) PCurveOnFace1(const Standard_Integer Index) const;
0141 
0142   //! gives the PCurve associated to CurveOnShape1(Index)
0143   //! on the Fillet
0144   Standard_EXPORT Handle(Geom2d_Curve) PCurve1OnFillet(const Standard_Integer Index) const;
0145 
0146   //! gives the PCurve  associated to CurveOnShape2(Index)
0147   //! on the  support face
0148   //! Warning: returns a Null Handle if SupportShape2 is not a Face
0149   Standard_EXPORT Handle(Geom2d_Curve) PCurveOnFace2(const Standard_Integer Index) const;
0150 
0151   //! gives the PCurve associated to CurveOnShape2(Index)
0152   //! on the fillet
0153   Standard_EXPORT Handle(Geom2d_Curve) PCurve2OnFillet(const Standard_Integer Index) const;
0154 
0155   Standard_EXPORT Standard_Integer NbBranches();
0156 
0157   //! Set in <From>,<To>   the indices of the faces  of
0158   //! the branche <Index>.
0159   //!
0160   //! i.e: Branche<Index> = Face(From) + Face(From+1) + ..+ Face(To)
0161   Standard_EXPORT void IndicesOfBranche(const Standard_Integer Index,
0162                                         Standard_Integer&      From,
0163                                         Standard_Integer&      To) const;
0164 
0165   //! Computes the center lines
0166   Standard_EXPORT void ComputeCenters();
0167 
0168 protected:
0169 private:
0170   //! Perform the generated surfaces.
0171   Standard_EXPORT void ComputeSurfaces();
0172 
0173   //! Build the resulting shape
0174   //! All the faces must be computed
0175   Standard_EXPORT void ComputeShape();
0176 
0177   //! Computes the intersections with <Face> and all the
0178   //! OffsetFaces stored  in <myMapSF>.  Returns <True>
0179   //! if an intersections ends on a boundary of a Face.
0180   Standard_EXPORT Standard_Boolean Intersect(const TopoDS_Shape&               Init,
0181                                              const TopoDS_Face&                Face,
0182                                              const TopTools_DataMapOfShapeBox& MapSBox,
0183                                              const BRepOffset_Offset&          OF1,
0184                                              BRepOffset_Inter3d&               Inter);
0185 
0186   Standard_Real                                    myRadius;
0187   Standard_Real                                    myTol;
0188   Standard_Boolean                                 myNubs;
0189   TopoDS_Shape                                     myShape;
0190   TopoDS_Shape                                     myResult;
0191   Standard_Boolean                                 myBuildShape;
0192   TopTools_IndexedDataMapOfShapeListOfShape        myAncestors;
0193   BRepFill_DataMapOfShapeDataMapOfShapeListOfShape myCreated;
0194   TopTools_DataMapOfShapeListOfShape               myCutEdges;
0195   TopTools_IndexedMapOfShape                       myFaces;
0196   TopTools_IndexedMapOfShape                       myEdges;
0197   TopTools_MapOfShape                              myStopFaces;
0198   BRepOffset_Analyse                               myAnalyse;
0199   TopTools_IndexedMapOfShape                       myCenters;
0200   BRepOffset_DataMapOfShapeOffset                  myMapSF;
0201   BRepAlgo_Image                                   myInitOffsetFace;
0202   BRepAlgo_Image                                   myImage;
0203   BRepAlgo_Image                                   myImageOffset;
0204   Handle(BRepAlgo_AsDes)                           myAsDes;
0205   Standard_Integer                                 myNbBranches;
0206   Handle(TColStd_HArray1OfInteger)                 myIndices;
0207   Standard_Boolean                                 myDone;
0208 };
0209 
0210 #endif // _BiTgte_Blend_HeaderFile