Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:17:17

0001 // Created on: 1993-09-28
0002 // Created by: Bruno DUMORTIER
0003 // Copyright (c) 1993-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 _GeomFill_AppSurf_HeaderFile
0018 #define _GeomFill_AppSurf_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <gp_Pnt.hxx>
0026 #include <NCollection_Array2.hxx>
0027 #include <NCollection_HArray2.hxx>
0028 #include <NCollection_Array1.hxx>
0029 #include <NCollection_HArray1.hxx>
0030 #include <gp_Pnt2d.hxx>
0031 #include <NCollection_Sequence.hxx>
0032 #include <Approx_ParametrizationType.hxx>
0033 #include <GeomAbs_Shape.hxx>
0034 #include <AppBlend_Approx.hxx>
0035 class StdFail_NotDone;
0036 class Standard_DomainError;
0037 class Standard_OutOfRange;
0038 class GeomFill_SectionGenerator;
0039 class GeomFill_Line;
0040 
0041 //! Approximate a BSplineSurface passing by all the
0042 //! curves described in the SectionGenerator
0043 
0044 class GeomFill_AppSurf : public AppBlend_Approx
0045 {
0046 public:
0047   DEFINE_STANDARD_ALLOC
0048 
0049   Standard_EXPORT GeomFill_AppSurf();
0050 
0051   Standard_EXPORT GeomFill_AppSurf(const int    Degmin,
0052                                    const int    Degmax,
0053                                    const double Tol3d,
0054                                    const double Tol2d,
0055                                    const int    NbIt,
0056                                    const bool   KnownParameters = false);
0057 
0058   Standard_EXPORT void Init(const int    Degmin,
0059                             const int    Degmax,
0060                             const double Tol3d,
0061                             const double Tol2d,
0062                             const int    NbIt,
0063                             const bool   KnownParameters = false);
0064 
0065   //! Define the type of parametrization used in the approximation
0066   Standard_EXPORT void SetParType(const Approx_ParametrizationType ParType);
0067 
0068   //! Define the Continuity used in the approximation
0069   Standard_EXPORT void SetContinuity(const GeomAbs_Shape C);
0070 
0071   //! define the Weights associed to the criterium used in
0072   //! the optimization.
0073   //!
0074   //! if Wi <= 0
0075   Standard_EXPORT void SetCriteriumWeight(const double W1, const double W2, const double W3);
0076 
0077   //! returns the type of parametrization used in the approximation
0078   Standard_EXPORT Approx_ParametrizationType ParType() const;
0079 
0080   //! returns the Continuity used in the approximation
0081   Standard_EXPORT GeomAbs_Shape Continuity() const;
0082 
0083   //! returns the Weights (as percent) associed to the criterium used in
0084   //! the optimization.
0085   Standard_EXPORT void CriteriumWeight(double& W1, double& W2, double& W3) const;
0086 
0087   Standard_EXPORT void Perform(const occ::handle<GeomFill_Line>& Lin,
0088                                GeomFill_SectionGenerator&        SecGen,
0089                                const bool                        SpApprox = false);
0090 
0091   Standard_EXPORT void PerformSmoothing(const occ::handle<GeomFill_Line>& Lin,
0092                                         GeomFill_SectionGenerator&        SecGen);
0093 
0094   Standard_EXPORT void Perform(const occ::handle<GeomFill_Line>& Lin,
0095                                GeomFill_SectionGenerator&        SecGen,
0096                                const int                         NbMaxP);
0097 
0098   bool IsDone() const override;
0099 
0100   Standard_EXPORT void SurfShape(int& UDegree,
0101                                  int& VDegree,
0102                                  int& NbUPoles,
0103                                  int& NbVPoles,
0104                                  int& NbUKnots,
0105                                  int& NbVKnots) const override;
0106 
0107   Standard_EXPORT void Surface(NCollection_Array2<gp_Pnt>& TPoles,
0108                                NCollection_Array2<double>& TWeights,
0109                                NCollection_Array1<double>& TUKnots,
0110                                NCollection_Array1<double>& TVKnots,
0111                                NCollection_Array1<int>&    TUMults,
0112                                NCollection_Array1<int>&    TVMults) const override;
0113 
0114   int UDegree() const override;
0115 
0116   int VDegree() const override;
0117 
0118   const NCollection_Array2<gp_Pnt>& SurfPoles() const override;
0119 
0120   const NCollection_Array2<double>& SurfWeights() const override;
0121 
0122   const NCollection_Array1<double>& SurfUKnots() const override;
0123 
0124   const NCollection_Array1<double>& SurfVKnots() const override;
0125 
0126   const NCollection_Array1<int>& SurfUMults() const override;
0127 
0128   const NCollection_Array1<int>& SurfVMults() const override;
0129 
0130   int NbCurves2d() const override;
0131 
0132   Standard_EXPORT void Curves2dShape(int& Degree, int& NbPoles, int& NbKnots) const override;
0133 
0134   Standard_EXPORT void Curve2d(const int                     Index,
0135                                NCollection_Array1<gp_Pnt2d>& TPoles,
0136                                NCollection_Array1<double>&   TKnots,
0137                                NCollection_Array1<int>&      TMults) const override;
0138 
0139   int Curves2dDegree() const override;
0140 
0141   const NCollection_Array1<gp_Pnt2d>& Curve2dPoles(const int Index) const override;
0142 
0143   const NCollection_Array1<double>& Curves2dKnots() const override;
0144 
0145   const NCollection_Array1<int>& Curves2dMults() const override;
0146 
0147   void TolReached(double& Tol3d, double& Tol2d) const override;
0148 
0149   Standard_EXPORT double TolCurveOnSurf(const int Index) const override;
0150 
0151 private:
0152   Standard_EXPORT void InternalPerform(const occ::handle<GeomFill_Line>& Lin,
0153                                        GeomFill_SectionGenerator&        SecGen,
0154                                        const bool                        SpApprox,
0155                                        const bool                        UseVariational);
0156 
0157   bool                                                             done;
0158   int                                                              dmin;
0159   int                                                              dmax;
0160   double                                                           tol3d;
0161   double                                                           tol2d;
0162   int                                                              nbit;
0163   int                                                              udeg;
0164   int                                                              vdeg;
0165   bool                                                             knownp;
0166   occ::handle<NCollection_HArray2<gp_Pnt>>                         tabPoles;
0167   occ::handle<NCollection_HArray2<double>>                         tabWeights;
0168   occ::handle<NCollection_HArray1<double>>                         tabUKnots;
0169   occ::handle<NCollection_HArray1<double>>                         tabVKnots;
0170   occ::handle<NCollection_HArray1<int>>                            tabUMults;
0171   occ::handle<NCollection_HArray1<int>>                            tabVMults;
0172   NCollection_Sequence<occ::handle<NCollection_HArray1<gp_Pnt2d>>> seqPoles2d;
0173   double                                                           tol3dreached;
0174   double                                                           tol2dreached;
0175   Approx_ParametrizationType                                       paramtype;
0176   GeomAbs_Shape                                                    continuity;
0177   double                                                           critweights[3];
0178 };
0179 
0180 #define TheSectionGenerator GeomFill_SectionGenerator
0181 #define TheSectionGenerator_hxx <GeomFill_SectionGenerator.hxx>
0182 #define Handle_TheLine occ::handle<GeomFill_Line>
0183 #define TheLine GeomFill_Line
0184 #define TheLine_hxx <GeomFill_Line.hxx>
0185 #define AppBlend_AppSurf GeomFill_AppSurf
0186 #define AppBlend_AppSurf_hxx <GeomFill_AppSurf.hxx>
0187 
0188 #include <AppBlend_AppSurf.lxx>
0189 
0190 #undef TheSectionGenerator
0191 #undef TheSectionGenerator_hxx
0192 #undef Handle_TheLine
0193 #undef TheLine
0194 #undef TheLine_hxx
0195 #undef AppBlend_AppSurf
0196 #undef AppBlend_AppSurf_hxx
0197 
0198 #endif // _GeomFill_AppSurf_HeaderFile