Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:16:56

0001 // Created on: 1997-11-21
0002 // Created by: Philippe MANGIN
0003 // Copyright (c) 1997-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 _BRepFill_Sweep_HeaderFile
0018 #define _BRepFill_Sweep_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GeomFill_ApproxStyle.hxx>
0025 #include <GeomAbs_Shape.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <TopoDS_Shape.hxx>
0028 #include <TopTools_ShapeMapHasher.hxx>
0029 #include <NCollection_DataMap.hxx>
0030 #include <NCollection_List.hxx>
0031 #include <TopoDS_Wire.hxx>
0032 #include <NCollection_Map.hxx>
0033 #include <NCollection_Array2.hxx>
0034 #include <NCollection_HArray2.hxx>
0035 #include <BRepFill_TransitionStyle.hxx>
0036 class BRepFill_LocationLaw;
0037 class BRepFill_SectionLaw;
0038 class TopoDS_Edge;
0039 
0040 //! Topological Sweep Algorithm
0041 //! Computes an Sweep shell using a generating
0042 //! wire, an SectionLaw and an LocationLaw.
0043 class BRepFill_Sweep
0044 {
0045 public:
0046   DEFINE_STANDARD_ALLOC
0047 
0048   Standard_EXPORT BRepFill_Sweep(const occ::handle<BRepFill_SectionLaw>&  Section,
0049                                  const occ::handle<BRepFill_LocationLaw>& Location,
0050                                  const bool                               WithKPart);
0051 
0052   Standard_EXPORT void SetBounds(const TopoDS_Wire& FirstShape, const TopoDS_Wire& LastShape);
0053 
0054   //! Set Approximation Tolerance
0055   //! Tol3d : Tolerance to surface approximation
0056   //! Tol2d : Tolerance used to perform curve approximation
0057   //! Normally the 2d curve are approximated with a
0058   //! tolerance given by the resolution on support surfaces,
0059   //! but if this tolerance is too large Tol2d is used.
0060   //! TolAngular : Tolerance (in radian) to control the angle
0061   //! between tangents on the section law and
0062   //! tangent of iso-v on approximated surface
0063   Standard_EXPORT void SetTolerance(const double Tol3d,
0064                                     const double BoundTol   = 1.0,
0065                                     const double Tol2d      = 1.0e-5,
0066                                     const double TolAngular = 1.0e-2);
0067 
0068   //! Tolerance  To controle Corner management.
0069   //!
0070   //! If the discontinuity is lesser than <AngleMin> in radian The
0071   //! Transition Performed will be always "Modified"
0072   Standard_EXPORT void SetAngularControl(const double AngleMin = 0.01, const double AngleMax = 6.0);
0073 
0074   //! Set the flag that indicates attempt to approximate
0075   //! a C1-continuous surface if a swept surface proved
0076   //! to be C0.
0077   Standard_EXPORT void SetForceApproxC1(const bool ForceApproxC1);
0078 
0079   //! Build the Sweep Surface
0080   //! Transition define Transition strategy
0081   //! Approx define Approximation Strategy
0082   //! - GeomFill_Section : The composed Function Location X Section
0083   //! is directly approximated.
0084   //! - GeomFill_Location : The location law is approximated, and the
0085   //! SweepSurface builds an algebraic composition
0086   //! of approximated location law and section law
0087   //! This option is Ok, if Section.Surface() methode
0088   //! is effective.
0089   //! Continuity : The continuity in v waiting on the surface
0090   //! Degmax     : The maximum degree in v required on the surface
0091   //! Segmax     : The maximum number of span in v required on
0092   //! the surface.
0093   Standard_EXPORT void Build(NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& ReversedEdges,
0094                              NCollection_DataMap<TopoDS_Shape,
0095                                                  occ::handle<NCollection_HArray2<TopoDS_Shape>>,
0096                                                  TopTools_ShapeMapHasher>&           Tapes,
0097                              NCollection_DataMap<TopoDS_Shape,
0098                                                  occ::handle<NCollection_HArray2<TopoDS_Shape>>,
0099                                                  TopTools_ShapeMapHasher>&           Rails,
0100                              const BRepFill_TransitionStyle Transition = BRepFill_Modified,
0101                              const GeomAbs_Shape            Continuity = GeomAbs_C2,
0102                              const GeomFill_ApproxStyle     Approx     = GeomFill_Location,
0103                              const int                      Degmax     = 11,
0104                              const int                      Segmax     = 30);
0105 
0106   //! Say if the Shape is Build.
0107   Standard_EXPORT bool IsDone() const;
0108 
0109   //! Returns the Sweeping Shape
0110   Standard_EXPORT TopoDS_Shape Shape() const;
0111 
0112   //! Get the Approximation error.
0113   Standard_EXPORT double ErrorOnSurface() const;
0114 
0115   Standard_EXPORT occ::handle<NCollection_HArray2<TopoDS_Shape>> SubShape() const;
0116 
0117   Standard_EXPORT occ::handle<NCollection_HArray2<TopoDS_Shape>> InterFaces() const;
0118 
0119   Standard_EXPORT occ::handle<NCollection_HArray2<TopoDS_Shape>> Sections() const;
0120 
0121   //! Returns the Tape corresponding to Index-th edge of section
0122   Standard_EXPORT TopoDS_Shape Tape(const int Index) const;
0123 
0124 protected:
0125   Standard_EXPORT bool CorrectApproxParameters();
0126 
0127   Standard_EXPORT bool BuildWire(const BRepFill_TransitionStyle Transition);
0128 
0129   Standard_EXPORT bool BuildShell(
0130     const BRepFill_TransitionStyle                          Transition,
0131     const int                                               Vf,
0132     const int                                               Vl,
0133     NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& ReversedEdges,
0134     NCollection_DataMap<TopoDS_Shape,
0135                         occ::handle<NCollection_HArray2<TopoDS_Shape>>,
0136                         TopTools_ShapeMapHasher>&           Tapes,
0137     NCollection_DataMap<TopoDS_Shape,
0138                         occ::handle<NCollection_HArray2<TopoDS_Shape>>,
0139                         TopTools_ShapeMapHasher>&           Rails,
0140     const double                                            ExtendFirst = 0.0,
0141     const double                                            ExtendLast  = 0.0);
0142 
0143   Standard_EXPORT bool PerformCorner(const int                      Index,
0144                                      const BRepFill_TransitionStyle Transition,
0145                                      const occ::handle<NCollection_HArray2<TopoDS_Shape>>& Bounds);
0146 
0147   Standard_EXPORT double EvalExtrapol(const int                      Index,
0148                                       const BRepFill_TransitionStyle Transition) const;
0149 
0150   Standard_EXPORT bool MergeVertex(const TopoDS_Shape& V1, TopoDS_Shape& V2) const;
0151 
0152   Standard_EXPORT void UpdateVertex(const int     Ipath,
0153                                     const int     Isec,
0154                                     const double  Error,
0155                                     const double  Param,
0156                                     TopoDS_Shape& V) const;
0157 
0158   Standard_EXPORT void RebuildTopOrBottomEdge(
0159     const TopoDS_Edge&                                      aNewEdge,
0160     TopoDS_Edge&                                            anEdge,
0161     NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& ReversedEdges) const;
0162 
0163 private:
0164   bool                                                                     isDone;
0165   bool                                                                     KPart;
0166   double                                                                   myTol3d;
0167   double                                                                   myBoundTol;
0168   double                                                                   myTol2d;
0169   double                                                                   myTolAngular;
0170   double                                                                   myAngMin;
0171   double                                                                   myAngMax;
0172   GeomFill_ApproxStyle                                                     myApproxStyle;
0173   GeomAbs_Shape                                                            myContinuity;
0174   int                                                                      myDegmax;
0175   int                                                                      mySegmax;
0176   bool                                                                     myForceApproxC1;
0177   TopoDS_Shape                                                             myShape;
0178   occ::handle<BRepFill_LocationLaw>                                        myLoc;
0179   occ::handle<BRepFill_SectionLaw>                                         mySec;
0180   occ::handle<NCollection_HArray2<TopoDS_Shape>>                           myUEdges;
0181   occ::handle<NCollection_HArray2<TopoDS_Shape>>                           myVEdges;
0182   NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myVEdgesModified;
0183   occ::handle<NCollection_HArray2<TopoDS_Shape>>                           myFaces;
0184   NCollection_List<TopoDS_Shape>                                           myAuxShape;
0185   occ::handle<NCollection_HArray1<TopoDS_Shape>>                           myTapes;
0186   double                                                                   Error;
0187   TopoDS_Wire                                                              FirstShape;
0188   TopoDS_Wire                                                              LastShape;
0189 };
0190 
0191 #endif // _BRepFill_Sweep_HeaderFile